From 9478053838ae2d950b162c2b93a2a400c82d9bf7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 13 May 2018 19:34:29 +0200 Subject: Create and init QQuickTheme from QtQuickControls2Plugin Instead of creating and setting the QQuickTheme instance from each style plugin (e.g. QtQuickControls2MaterialStylePlugin), create the QQuickTheme instance in QtQuickControls2Plugin when the style is being resolved, and just pass the instance to be initialized by the style plugin(s). This avoids the problem that QQuickTheme API was virtual, and sub-classes created from plugins would have vtables destroyed before the QQuickTheme was destroyed. Task-number: QTBUG-67062 Task-number: QTBUG-68087 Change-Id: I19e9ced5296b708c2668c30163389cb3da6be7cf Reviewed-by: Mitch Curtis --- tests/auto/font/tst_font.cpp | 2 +- tests/auto/palette/tst_palette.cpp | 2 +- tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/font/tst_font.cpp b/tests/auto/font/tst_font.cpp index 6746e39e..84f6334b 100644 --- a/tests/auto/font/tst_font.cpp +++ b/tests/auto/font/tst_font.cpp @@ -222,7 +222,7 @@ class TestFontTheme : public QQuickTheme public: static const int NFonts = QQuickTheme::Tumbler + 1; - void resolve() override + TestFontTheme() { for (int i = 0; i < NFonts; ++i) { QFont font = QFont(); diff --git a/tests/auto/palette/tst_palette.cpp b/tests/auto/palette/tst_palette.cpp index ab7d9b16..e91fd732 100644 --- a/tests/auto/palette/tst_palette.cpp +++ b/tests/auto/palette/tst_palette.cpp @@ -221,7 +221,7 @@ class TestTheme : public QQuickTheme public: static const int NPalettes = QQuickTheme::Tumbler + 1; - void resolve() override + TestTheme() { for (int i = 0; i < NPalettes; ++i) setPalette(static_cast(i), QPalette(QColor::fromRgb(i))); diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 4ab3be4e..dec32e36 100644 --- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -558,7 +558,7 @@ void tst_QQuickApplicationWindow::font() class TestTheme : public QQuickTheme { public: - void resolve() override + TestTheme() { setFont(System, QFont("Courier")); } -- cgit v1.2.3