diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-15 14:23:28 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-16 21:12:49 +0000 |
commit | 273114582aaa944b4a22f1782cc5799fdd1e8e7b (patch) | |
tree | 9d3f7af5fd6a8bf081185be6b6a9ffd35867a940 /src | |
parent | a93ff2c2483b7d2f0c678aa3e52495e4cb36e9e1 (diff) |
Add QStyleHints::setTabFocusBehavior() for testing purposes
So far we've been dependent on the focus behavior setting in OS X
system preferences. This change allows us to start testing both
behaviors on any platform.
Change-Id: I9ce004f8b9479f8e722a387b795de16edb166a07
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src')
-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; |