diff options
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 22 | ||||
-rw-r--r-- | src/gui/kernel/qstylehints.h | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index b295fe986a..e184fed275 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -76,6 +76,7 @@ public: , m_startDragTime(-1) , m_keyboardInputInterval(-1) , m_cursorFlashTime(-1) + , m_tabFocusBehavior(-1) {} int m_mouseDoubleClickInterval; @@ -84,6 +85,7 @@ public: int m_startDragTime; int m_keyboardInputInterval; int m_cursorFlashTime; + int m_tabFocusBehavior; }; /*! @@ -416,7 +418,25 @@ bool QStyleHints::setFocusOnTouchRelease() const Qt::TabFocusBehavior QStyleHints::tabFocusBehavior() const { - return Qt::TabFocusBehavior(themeableHint(QPlatformTheme::TabFocusBehavior, QPlatformIntegration::TabFocusBehavior).toInt()); + Q_D(const QStyleHints); + return Qt::TabFocusBehavior(d->m_tabFocusBehavior >= 0 ? + d->m_tabFocusBehavior : + themeableHint(QPlatformTheme::TabFocusBehavior, QPlatformIntegration::TabFocusBehavior).toInt()); +} + +/*! + Sets the \a tabFocusBehavior. + \internal + \sa tabFocusBehavior() + \since 5.7 +*/ +void QStyleHints::setTabFocusBehavior(Qt::TabFocusBehavior tabFocusBehavior) +{ + Q_D(QStyleHints); + if (d->m_tabFocusBehavior == tabFocusBehavior) + return; + d->m_tabFocusBehavior = tabFocusBehavior; + emit tabFocusBehaviorChanged(tabFocusBehavior); } /*! diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h index a79fad805a..0b07e60579 100644 --- a/src/gui/kernel/qstylehints.h +++ b/src/gui/kernel/qstylehints.h @@ -67,7 +67,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL) 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(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL) Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL) public: @@ -93,6 +93,7 @@ public: bool useRtlExtensions() const; bool setFocusOnTouchRelease() const; Qt::TabFocusBehavior tabFocusBehavior() const; + void setTabFocusBehavior(Qt::TabFocusBehavior tabFocusBehavior); bool singleClickActivation() const; Q_SIGNALS: @@ -102,6 +103,7 @@ Q_SIGNALS: void mousePressAndHoldIntervalChanged(int mousePressAndHoldInterval); void startDragDistanceChanged(int startDragDistance); void startDragTimeChanged(int startDragTime); + void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior); private: friend class QGuiApplication; |