diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2022-09-16 16:14:49 +0200 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2022-09-24 01:30:48 +0200 |
commit | d35feca20c02539d04f10c23fc057454cb3fcc12 (patch) | |
tree | f6aaf331877207697be38f52c23c2f78e48f9e4b /src/gui/kernel/qstylehints.cpp | |
parent | ac2154c7e90d68e4477cb383d1090aaa1939efec (diff) |
Propagate appearance property from QPlatformTheme to QStyleHints
Implement appearance property, getter and notifier in QStyleHints.
Update appearance property in QStyleHints when handling theme
change in QGuiApplicationPrivate.
Task-number: QTBUG-106381
Change-Id: Idd67ca9df248ec9d9e67c0d48121e8eead11a9e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qstylehints.cpp')
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 042f793a27..6819aeaf2e 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qstylehints.h> +#include "qstylehints_p.h" #include <qpa/qplatformintegration.h> #include <qpa/qplatformtheme.h> #include <private/qguiapplication_p.h> @@ -43,25 +44,6 @@ static inline QVariant themeableHint(QPlatformTheme::ThemeHint th) return QPlatformTheme::defaultThemeHint(th); } -class QStyleHintsPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QStyleHints) -public: - int m_mouseDoubleClickInterval = -1; - int m_mousePressAndHoldInterval = -1; - int m_startDragDistance = -1; - int m_startDragTime = -1; - int m_keyboardInputInterval = -1; - int m_cursorFlashTime = -1; - int m_tabFocusBehavior = -1; - int m_uiEffects = -1; - int m_showShortcutsInContextMenus = -1; - int m_wheelScrollLines = -1; - int m_mouseQuickSelectionThreshold = -1; - int m_mouseDoubleClickDistance = -1; - int m_touchDoubleTapDistance = -1; -}; - /*! \class QStyleHints \since 5.0 @@ -140,6 +122,17 @@ int QStyleHints::touchDoubleTapDistance() const } /*! + \property QStyleHints::appearance + \brief the appearance of the platform theme + \sa Qt::Appearance + \since 6.5 +*/ +Qt::Appearance QStyleHints::appearance() const +{ + return d_func()->appearance(); +} + +/*! Sets the \a mousePressAndHoldInterval. \internal \sa mousePressAndHoldInterval() @@ -583,6 +576,26 @@ int QStyleHints::mouseQuickSelectionThreshold() const return themeableHint(QPlatformTheme::MouseQuickSelectionThreshold, QPlatformIntegration::MouseQuickSelectionThreshold).toInt(); } +/*! + \internal + QStyleHintsPrivate::setAppearance - set a new appearance. + Set \a appearance as the new appearance of the QStyleHints. + The appearanceChanged signal will be emitted if present and new appearance differ. + */ +void QStyleHintsPrivate::setAppearance(Qt::Appearance appearance) +{ + if (m_appearance != appearance) { + m_appearance = appearance; + emit q_func()->appearanceChanged(appearance); + } +} + +QStyleHintsPrivate *QStyleHintsPrivate::get(QStyleHints *q) +{ + Q_ASSERT(q); + return q->d_func(); +} + QT_END_NAMESPACE #include "moc_qstylehints.cpp" |