Improve interaction between QPlatformTheme and QPlatformIntegration hinting.

Ensure that custom style hints returned by subclassed
QPlatformIntegration::styleHints() are used if not explicitly overridden
by subclassed QPlatformTheme::themHints().

Task-number: QTBUG-34589
Change-Id: I0a3114cb00b532d2a5cd40941eca192b32412bcf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
bb10
Michael Brasser 2013-11-06 19:32:45 -06:00 committed by The Qt Project
parent f59e29d9bf
commit 42aacbf5eb
1 changed files with 27 additions and 1 deletions

View File

@ -50,6 +50,7 @@
#include <qtextformat.h>
#include <private/qiconloader_p.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
@ -399,7 +400,32 @@ QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
return QPlatformTheme::defaultThemeHint(hint);
// For theme hints which mirror platform integration style hints, query
// the platform integration. The base QPlatformIntegration::styleHint()
// function will in turn query QPlatformTheme::defaultThemeHint() if there
// is no custom value.
switch (hint) {
case QPlatformTheme::CursorFlashTime:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime);
case QPlatformTheme::KeyboardInputInterval:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval);
case QPlatformTheme::KeyboardAutoRepeatRate:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate);
case QPlatformTheme::MouseDoubleClickInterval:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval);
case QPlatformTheme::StartDragDistance:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance);
case QPlatformTheme::StartDragTime:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime);
case QPlatformTheme::StartDragVelocity:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity);
case QPlatformTheme::PasswordMaskDelay:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay);
case QPlatformTheme::PasswordMaskCharacter:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
}
QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)