summaryrefslogtreecommitdiff
path: root/src/controls/plugin.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-12-07 14:26:07 +0100
committerAndy Shaw <andy.shaw@qt.io>2018-12-10 13:29:36 +0000
commita9436b597916d5619cbbbbd103bc482ddaf4359a (patch)
tree784d2338a57a40b964a93868c9ea105e24dad499 /src/controls/plugin.cpp
parent8abf15b4ba974576e13f37b09117454fc1e6b1d9 (diff)
downloadqtquickcontrols-a9436b597916d5619cbbbbd103bc482ddaf4359a.tar.gz
Static: Register the base style qml files so they can be found
If the files are not registered then it will look for them on the disk instead because it has no entry for them. This changed at some point in the Qt 5.12.0 release but has technically been wrong for some time as they should always be registered. Change-Id: I8246a4f5fb4d94ebc5f7ca262d1821a409eb6c9f Fixes: QTBUG-72338 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/controls/plugin.cpp')
-rw-r--r--src/controls/plugin.cpp49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index 8aca0c49..82eef800 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -73,10 +73,12 @@
QT_BEGIN_NAMESPACE
-static const struct {
+struct QmldirStruct {
const char *type;
int major, minor;
-} qmldir [] = {
+};
+
+static const QmldirStruct qmldir [] = {
{ "ApplicationWindow", 1, 0 },
{ "Button", 1, 0 },
{ "Calendar", 1, 2 },
@@ -119,6 +121,43 @@ static const struct {
{ "Slider", 1, 6 }
};
+static const QmldirStruct stylesQmldir [] = {
+ { "ApplicationWindowStyle", 1, 3 },
+ { "ButtonStyle", 1, 0 },
+ { "BusyIndicatorStyle", 1, 1 },
+ { "CalendarStyle", 1, 1 },
+ { "CheckBoxStyle", 1, 0 },
+ { "ComboBoxStyle", 1, 0 },
+ { "MenuStyle", 1, 2 },
+ { "MenuBarStyle", 1, 2 },
+ { "ProgressBarStyle", 1, 0 },
+ { "RadioButtonStyle", 1, 0 },
+ { "ScrollViewStyle", 1, 0 },
+ { "SliderStyle", 1, 0 },
+ { "SpinBoxStyle", 1, 1 },
+ { "SwitchStyle", 1, 1 },
+ { "TabViewStyle", 1, 0 },
+ { "TableViewStyle", 1, 0 },
+ { "TreeViewStyle", 1, 4 },
+ { "TextAreaStyle", 1, 1 },
+ { "TextFieldStyle", 1, 0 },
+ { "ToolBarStyle", 1, 0 },
+ { "StatusBarStyle", 1, 0 },
+ { "CircularGaugeStyle", 1, 0 },
+ { "CircularButtonStyle", 1, 0 },
+ { "CircularTickmarkLabelStyle", 1, 0 },
+ { "CommonStyleHelper", 1, 0 },
+ { "DelayButtonStyle", 1, 0 },
+ { "DialStyle", 1, 1 },
+ { "GaugeStyle", 1, 0 },
+ { "HandleStyle", 1, 0 },
+ { "HandleStyleHelper", 1, 0 },
+ { "PieMenuStyle", 1, 3 },
+ { "StatusIndicatorStyle", 1, 1 },
+ { "ToggleButtonStyle", 1, 0 },
+ { "TumblerStyle", 1, 2 }
+};
+
QtQuickControls1Plugin::QtQuickControls1Plugin(QObject *parent) : QQmlExtensionPlugin(parent)
{
}
@@ -172,6 +211,12 @@ void QtQuickControls1Plugin::registerTypes(const char *uri)
#ifdef QT_WIDGETS_LIB
qmlRegisterType<QQuickStyleItem1>(private_uri, 1, 0, "StyleItem");
#endif
+
+ const char *styles_uri = "QtQuick.Controls.Styles";
+ const QString baseStyleLocation = filesLocation + "/Styles/Base";
+ for (int i = 0; i < int(sizeof(stylesQmldir)/sizeof(stylesQmldir[0])); i++)
+ qmlRegisterType(QUrl(baseStyleLocation + "/" + stylesQmldir[i].type + ".qml"), styles_uri,
+ stylesQmldir[i].major, stylesQmldir[i].minor, stylesQmldir[i].type);
}
void QtQuickControls1Plugin::initializeEngine(QQmlEngine *engine, const char *uri)