From 9fc3659a678e6d1bd6b2514486bde1d1725963da Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 10 Apr 2017 11:22:34 +0200 Subject: Replace QQuickColorImageProvider with QQuickColorImage Now that QQuickImage is exported, we can colorize images using a simple QQuickImage subclass instead of using an image provider. The main issue with QQuickColorImageProvider was that it was based on QGuiApplication::devicePixelRatio(). Now each QQuickColorImage handles its device pixel ratio correctly depending on which screen it is on. Even though we now have to use two bindings (color and source) instead of encoding the color to the source, at the same time we can remove the sourceSize bindings that were added as image provider specific high DPI workarounds (ca87ab8). Task-number: QTBUG-58925 Change-Id: Iba14d2afe3bda540189682ba5be7c58d907d88f7 Reviewed-by: Mitch Curtis --- src/imports/controls/qtquickcontrols2plugin.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/imports/controls/qtquickcontrols2plugin.cpp') diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 19d2c6d7..2014be79 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -37,13 +37,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview) #include #endif @@ -175,9 +175,7 @@ static QObject *colorSingleton(QQmlEngine *engine, QJSEngine *scriptEngine) void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri) { - Q_UNUSED(uri); - - engine->addImageProvider(QStringLiteral("default"), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/QtQuick/Controls.2/images"))); + Q_UNUSED(engine); const QByteArray import = QByteArray(uri) + ".impl"; qmlRegisterModule(import, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2... @@ -194,6 +192,7 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator"); + qmlRegisterType(import, 2, 3, "ColorImage"); qmlRegisterType(import, 2, 3, "IconImage"); qmlRegisterSingletonType(import, 2, 3, "Color", colorSingleton); qmlRegisterType(import, 2, 3, "IconLabel"); -- cgit v1.2.3