diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-23 13:42:49 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-25 19:10:29 +0000 |
commit | 4d3a35f63788fa5ff7a11a5bb7bd6176bd2ac70e (patch) | |
tree | bac37e31bb149ea56b71deed78dcd766fc99ccc3 /src/gui/kernel/qstylehints.cpp | |
parent | 69e233d2ba4a3e8762726aa3a168777f1df460c4 (diff) |
Make wheelScrollLines a QStyleHint
The number of lines to scroll on a wheel click have previously been
a QPlatformTheme hint and QApplication setting, this patch moves it to
QStyleHint so it may be easier read by QGuiApplications.
Change-Id: I80673c7b99d78c6407b1202b3742e1cb5fef0583
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qstylehints.cpp')
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 22c077da41..85c0768e35 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -78,6 +78,7 @@ public: , m_cursorFlashTime(-1) , m_tabFocusBehavior(-1) , m_uiEffects(-1) + , m_wheelScrollLines(-1) {} int m_mouseDoubleClickInterval; @@ -88,6 +89,7 @@ public: int m_cursorFlashTime; int m_tabFocusBehavior; int m_uiEffects; + int m_wheelScrollLines; }; /*! @@ -495,4 +497,33 @@ void QStyleHints::setUseHoverEffects(bool useHoverEffects) emit useHoverEffectsChanged(useHoverEffects); } +/*! + \property QStyleHints::wheelScrollLines + \brief Number of lines to scroll by default for each wheel click. + + \since 5.9 +*/ +int QStyleHints::wheelScrollLines() const +{ + Q_D(const QStyleHints); + if (d->m_wheelScrollLines > 0) + return d->m_wheelScrollLines; + return themeableHint(QPlatformTheme::WheelScrollLines, QPlatformIntegration::WheelScrollLines).toInt(); +} + +/*! + Sets the \a wheelScrollLines. + \internal + \sa wheelScrollLines() + \since 5.9 +*/ +void QStyleHints::setWheelScrollLines(int scrollLines) +{ + Q_D(QStyleHints); + if (d->m_wheelScrollLines == scrollLines) + return; + d->m_wheelScrollLines = scrollLines; + emit wheelScrollLinesChanged(scrollLines); +} + QT_END_NAMESPACE |