Expose ItemViewActivateItemOnSingleClick in QStyleHints
This completes support for ItemViewActivateItemOnSingleClick in QPlatformIntegration and exposes the setting in QStyleHints. Based on the review process, the public name used is 'singleClickActivation' for brevity, as well as to avoid con- fusion over alluding to "item views" in the Qt Quick context. KDE Plasma intends to use this via Qt.styleHints to have Qt Quick-based UI correctly implement the global single vs. double click user preference for item activation. [ChangeLog][QtGui] Added QStyleHints::singleClickActivation to access whether the platform expects item activation to occur on single clicks rather than double clicks. Change-Id: I0916e9e68c3a157f95053da8227b2612803653f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>bb10
parent
34ec0713bb
commit
417a221072
|
|
@ -396,6 +396,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
|
|||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
|
||||
case ReplayMousePressOutsidePopup:
|
||||
return true;
|
||||
case ItemViewActivateItemOnSingleClick:
|
||||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,8 @@ public:
|
|||
ShowIsMaximized,
|
||||
MousePressAndHoldInterval,
|
||||
TabFocusBehavior,
|
||||
ReplayMousePressOutsidePopup
|
||||
ReplayMousePressOutsidePopup,
|
||||
ItemViewActivateItemOnSingleClick
|
||||
};
|
||||
|
||||
virtual QVariant styleHint(StyleHint hint) const;
|
||||
|
|
|
|||
|
|
@ -434,6 +434,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
|||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
|
||||
case QPlatformTheme::MousePressAndHoldInterval:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval);
|
||||
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick);
|
||||
default:
|
||||
return QPlatformTheme::defaultThemeHint(hint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,4 +377,16 @@ Qt::TabFocusBehavior QStyleHints::tabFocusBehavior() const
|
|||
return Qt::TabFocusBehavior(themeableHint(QPlatformTheme::TabFocusBehavior, QPlatformIntegration::TabFocusBehavior).toInt());
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QStyleHints::singleClickActivation
|
||||
\brief \c true if items should be activated by single click, \b false
|
||||
if they should be activated by double click instead.
|
||||
|
||||
\since 5.5
|
||||
*/
|
||||
bool QStyleHints::singleClickActivation() const
|
||||
{
|
||||
return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
|
|||
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
|
||||
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
|
||||
Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior STORED false CONSTANT FINAL)
|
||||
Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
|
||||
|
||||
public:
|
||||
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
|
||||
|
|
@ -83,6 +84,7 @@ public:
|
|||
bool useRtlExtensions() const;
|
||||
bool setFocusOnTouchRelease() const;
|
||||
Qt::TabFocusBehavior tabFocusBehavior() const;
|
||||
bool singleClickActivation() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void cursorFlashTimeChanged(int cursorFlashTime);
|
||||
|
|
|
|||
Loading…
Reference in New Issue