From 03c7e64ef5f3dfd10d61fd2473fb9f09b124c6e6 Mon Sep 17 00:00:00 2001 From: Caroline Chao <caroline.chao@digia.com> Date: Fri, 14 Jun 2013 15:01:34 +0200 Subject: [PATCH] Revert "Add qml/js files in resource files" We need to investigate more this solution. Deployment issue for Qt Quick Controls will be a known limitation in 5.1.0. This reverts commit 41e13d3746c8b7b5cd550091c63fd8ab066422cf. Change-Id: I501be7494bdbdfbb799d31c612d0c20e7f87ffc7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com> --- examples/quick/controls/text/qml/main.qml | 1 - src/controls/Button.qml | 1 - src/controls/CheckBox.qml | 1 - src/controls/ComboBox.qml | 1 - src/controls/MenuBar.qml | 1 - src/controls/ProgressBar.qml | 1 - src/controls/RadioButton.qml | 1 - src/controls/Slider.qml | 1 - src/controls/SpinBox.qml | 1 - src/controls/StackView.qml | 2 +- src/controls/StatusBar.qml | 1 - src/controls/TabView.qml | 1 - src/controls/TextField.qml | 2 +- src/controls/ToolBar.qml | 1 - src/controls/ToolButton.qml | 1 - src/controls/controls.pro | 5 +- src/controls/plugin.cpp | 28 ------- src/controls/qmldir | 26 +++++++ src/controls/resources.qrc | 30 ------- src/private/FocusFrame.qml | 1 - src/private/plugin.cpp | 11 --- src/private/private.pro | 5 +- src/private/qmldir | 15 ++-- src/private/qquickcontrolsettings.cpp | 24 ++---- src/private/qquickcontrolsettings_p.h | 5 +- src/private/resources.qrc | 16 ---- src/src.pro | 3 +- src/styles/Base/MenuBarStyle.qml | 2 +- src/styles/Base/MenuStyle.qml | 2 +- src/styles/plugin.cpp | 78 ------------------- src/styles/private/private.pro | 3 + src/styles/private/qmldir | 7 ++ src/styles/qmldir | 11 ++- src/styles/resources.qrc | 61 --------------- src/styles/styles.pro | 18 +---- tests/auto/controls/data/tst_groupbox.qml | 2 +- tests/auto/controls/data/tst_styles.qml | 10 +-- tests/manual/testbench/content/Components.qml | 2 +- 38 files changed, 84 insertions(+), 298 deletions(-) delete mode 100644 src/controls/resources.qrc delete mode 100644 src/private/resources.qrc delete mode 100644 src/styles/plugin.cpp create mode 100644 src/styles/private/private.pro create mode 100644 src/styles/private/qmldir delete mode 100644 src/styles/resources.qrc diff --git a/examples/quick/controls/text/qml/main.qml b/examples/quick/controls/text/qml/main.qml index b2b863e28..d8f175ed1 100644 --- a/examples/quick/controls/text/qml/main.qml +++ b/examples/quick/controls/text/qml/main.qml @@ -319,7 +319,6 @@ ApplicationWindow { anchors.bottom: parent.bottom text: document.text textFormat: Qt.RichText - baseUrl: "qrc:/" Component.onCompleted: forceActiveFocus() } diff --git a/src/controls/Button.qml b/src/controls/Button.qml index efafe26bc..0a3cb1316 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype Button diff --git a/src/controls/CheckBox.qml b/src/controls/CheckBox.qml index 9d6f5dfed..48d5e8b2a 100644 --- a/src/controls/CheckBox.qml +++ b/src/controls/CheckBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype CheckBox diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index b65e749a6..9282c58d8 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ComboBox diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 566c814f7..65af1c124 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -42,7 +42,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype MenuBar diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index 2270ff49d..e472e66e0 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ProgressBar diff --git a/src/controls/RadioButton.qml b/src/controls/RadioButton.qml index 305e464c8..fde08817b 100644 --- a/src/controls/RadioButton.qml +++ b/src/controls/RadioButton.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype RadioButton diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 9fee75e64..64dcfff1d 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype Slider diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 06ec64cee..b1f87cec7 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype SpinBox diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index 623a1026f..9559ea872 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import "../private/StackView.js" as JSArray +import "Private/StackView.js" as JSArray /*! \qmltype StackView diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 62b818077..85cc6681c 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype StatusBar diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index 503a203e6..6319d72cd 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype TabView diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index b7e6996e8..32b2d4fb2 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 +import "Styles" /*! \qmltype TextField diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index cadea5c76..b73a6f3eb 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolBar diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index 3cf327898..3c1eab1a6 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolButton diff --git a/src/controls/controls.pro b/src/controls/controls.pro index fad8f2d9a..fbda88fcc 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -5,7 +5,7 @@ QT += qml quick gui-private core-private QMAKE_DOCS = $$PWD/doc/qtquickcontrols.qdocconf -OTHER_FILES = \ +QML_FILES = \ ApplicationWindow.qml \ Button.qml \ CheckBox.qml \ @@ -37,6 +37,3 @@ include(plugin.pri) CONFIG += no_cxx_module load(qml_plugin) - -RESOURCES += \ - resources.qrc diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp index 71cc3196e..1b255302a 100644 --- a/src/controls/plugin.cpp +++ b/src/controls/plugin.cpp @@ -98,34 +98,6 @@ void QtQuickControlsPlugin::registerTypes(const char *uri) QLatin1String("Do not create objects of type MenuBase")); qmlRegisterUncreatableType<QQuickStack>(uri, 1, 0, "Stack", QLatin1String("Do not create objects of type Stack")); - - // Controls in resources file - qmlRegisterType(QUrl("qrc:/controls/ApplicationWindow.qml"), uri, 1, 0, "ApplicationWindow"); - qmlRegisterType(QUrl("qrc:/controls/Button.qml"), uri, 1, 0, "Button"); - qmlRegisterType(QUrl("qrc:/controls/CheckBox.qml"), uri, 1, 0, "CheckBox"); - qmlRegisterType(QUrl("qrc:/controls/ComboBox.qml"), uri, 1, 0, "ComboBox"); - qmlRegisterType(QUrl("qrc:/controls/GroupBox.qml"), uri, 1, 0, "GroupBox"); - qmlRegisterType(QUrl("qrc:/controls/Label.qml"), uri, 1, 0, "Label"); - qmlRegisterType(QUrl("qrc:/controls/Menu.qml"), uri, 1, 0, "Menu"); - qmlRegisterType(QUrl("qrc:/controls/MenuBar.qml"), uri, 1, 0, "MenuBar"); - qmlRegisterType(QUrl("qrc:/controls/ProgressBar.qml"), uri, 1, 0, "ProgressBar"); - qmlRegisterType(QUrl("qrc:/controls/RadioButton.qml"), uri, 1, 0, "RadioButton"); - qmlRegisterType(QUrl("qrc:/controls/ScrollView.qml"), uri, 1, 0, "ScrollView"); - qmlRegisterType(QUrl("qrc:/controls/Slider.qml"), uri, 1, 0, "Slider"); - qmlRegisterType(QUrl("qrc:/controls/SpinBox.qml"), uri, 1, 0, "SpinBox"); - qmlRegisterType(QUrl("qrc:/controls/SplitView.qml"), uri, 1, 0, "SplitView"); - qmlRegisterType(QUrl("qrc:/controls/StackView.qml"), uri, 1, 0, "StackView"); - qmlRegisterType(QUrl("qrc:/controls/StackViewDelegate.qml"), uri, 1, 0, "StackViewDelegate"); - qmlRegisterType(QUrl("qrc:/controls/StackViewTransition.qml"), uri, 1, 0, "StackViewTransition"); - qmlRegisterType(QUrl("qrc:/controls/StatusBar.qml"), uri, 1, 0, "StatusBar"); - qmlRegisterType(QUrl("qrc:/controls/Tab.qml"), uri, 1, 0, "Tab"); - qmlRegisterType(QUrl("qrc:/controls/TableView.qml"), uri, 1, 0, "TableView"); - qmlRegisterType(QUrl("qrc:/controls/TableViewColumn.qml"), uri, 1, 0, "TableViewColumn"); - qmlRegisterType(QUrl("qrc:/controls/TextField.qml"), uri, 1, 0, "TextField"); - qmlRegisterType(QUrl("qrc:/controls/TabView.qml"), uri, 1, 0, "TabView"); - qmlRegisterType(QUrl("qrc:/controls/TextArea.qml"), uri, 1, 0, "TextArea"); - qmlRegisterType(QUrl("qrc:/controls/ToolBar.qml"), uri, 1, 0, "ToolBar"); - qmlRegisterType(QUrl("qrc:/controls/ToolButton.qml"), uri, 1, 0, "ToolButton"); } void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) diff --git a/src/controls/qmldir b/src/controls/qmldir index 41d4d5122..c243360cd 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -1,2 +1,28 @@ module QtQuick.Controls plugin qtquickcontrolsplugin +ApplicationWindow 1.0 ApplicationWindow.qml +Button 1.0 Button.qml +CheckBox 1.0 CheckBox.qml +ComboBox 1.0 ComboBox.qml +GroupBox 1.0 GroupBox.qml +Label 1.0 Label.qml +MenuBar 1.0 MenuBar.qml +Menu 1.0 Menu.qml +StackView 1.0 StackView.qml +ProgressBar 1.0 ProgressBar.qml +RadioButton 1.0 RadioButton.qml +ScrollView 1.0 ScrollView.qml +Slider 1.0 Slider.qml +SpinBox 1.0 SpinBox.qml +SplitView 1.0 SplitView.qml +StackViewDelegate 1.0 StackViewDelegate.qml +StackViewTransition 1.0 StackViewTransition.qml +StatusBar 1.0 StatusBar.qml +Tab 1.0 Tab.qml +TabView 1.0 TabView.qml +TableView 1.0 TableView.qml +TableViewColumn 1.0 TableViewColumn.qml +TextArea 1.0 TextArea.qml +TextField 1.0 TextField.qml +ToolBar 1.0 ToolBar.qml +ToolButton 1.0 ToolButton.qml diff --git a/src/controls/resources.qrc b/src/controls/resources.qrc deleted file mode 100644 index 5cf71c613..000000000 --- a/src/controls/resources.qrc +++ /dev/null @@ -1,30 +0,0 @@ -<RCC> - <qresource prefix="/controls"> - <file>ApplicationWindow.qml</file> - <file>Button.qml</file> - <file>CheckBox.qml</file> - <file>ComboBox.qml</file> - <file>GroupBox.qml</file> - <file>Label.qml</file> - <file>Menu.qml</file> - <file>MenuBar.qml</file> - <file>ProgressBar.qml</file> - <file>RadioButton.qml</file> - <file>ScrollView.qml</file> - <file>Slider.qml</file> - <file>SpinBox.qml</file> - <file>SplitView.qml</file> - <file>StackView.qml</file> - <file>StackViewDelegate.qml</file> - <file>StackViewTransition.qml</file> - <file>StatusBar.qml</file> - <file>Tab.qml</file> - <file>TableView.qml</file> - <file>TableViewColumn.qml</file> - <file>TabView.qml</file> - <file>TextArea.qml</file> - <file>TextField.qml</file> - <file>ToolBar.qml</file> - <file>ToolButton.qml</file> - </qresource> -</RCC> diff --git a/src/private/FocusFrame.qml b/src/private/FocusFrame.qml index b734a4ff1..3a07701c5 100644 --- a/src/private/FocusFrame.qml +++ b/src/private/FocusFrame.qml @@ -40,7 +40,6 @@ import QtQuick 2.1 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype FocusFrame diff --git a/src/private/plugin.cpp b/src/private/plugin.cpp index 3ae91d35f..e33c2d375 100644 --- a/src/private/plugin.cpp +++ b/src/private/plugin.cpp @@ -91,17 +91,6 @@ void QtQuickControlsPrivatePlugin::registerTypes(const char *uri) #ifndef QT_NO_WIDGETS qmlRegisterType<QQuickStyleItem>(uri, 1, 0, "StyleItem"); #endif - - qmlRegisterType(QUrl("qrc:/private/AbstractCheckable.qml"), uri, 1, 0, "AbstractCheckable"); - qmlRegisterType(QUrl("qrc:/private/BasicButton.qml"), uri, 1, 0, "BasicButton"); - qmlRegisterType(QUrl("qrc:/private/Control.qml"), uri, 1, 0, "Control"); - qmlRegisterType(QUrl("qrc:/private/FocusFrame.qml"), uri, 1, 0, "FocusFrame"); - qmlRegisterType(QUrl("qrc:/private/ModalPopupBehavior.qml"), uri, 1, 0, "ModalPopupBehavior"); - qmlRegisterType(QUrl("qrc:/private/ScrollBar.qml"), uri, 1, 0, "ScrollBar"); - qmlRegisterType(QUrl("qrc:/private/ScrollViewHelper.qml"), uri, 1, 0, "ScrollViewHelper"); - qmlRegisterType(QUrl("qrc:/private/StackViewSlideDelegate.qml"), uri, 1, 0, "StackViewSlideDelegate"); - qmlRegisterType(QUrl("qrc:/private/Style.qml"), uri, 1, 0, "Style"); - qmlRegisterType(QUrl("qrc:/private/TabBar.qml"), uri, 1, 0, "TabBar"); } QT_END_NAMESPACE diff --git a/src/private/private.pro b/src/private/private.pro index 8e1767dd7..803b703f4 100644 --- a/src/private/private.pro +++ b/src/private/private.pro @@ -23,7 +23,7 @@ SOURCES += \ $$PWD/qquickabstractstyle.cpp # private qml files -OTHER_FILES += \ +QML_FILES += \ AbstractCheckable.qml \ TabBar.qml \ BasicButton.qml \ @@ -50,6 +50,3 @@ mac { CONFIG += no_cxx_module load(qml_plugin) - -RESOURCES += \ - resources.qrc diff --git a/src/private/qmldir b/src/private/qmldir index 639197109..7f73028e0 100644 --- a/src/private/qmldir +++ b/src/private/qmldir @@ -1,7 +1,12 @@ module QtQuick.Controls.Private plugin qtquickcontrolsprivateplugin -GroupBoxStyle 1.0 qrc:/Base/GroupBoxStyle.qml -SpinBoxStyle 1.0 qrc:/Base/SpinBoxStyle.qml -ToolBarStyle 1.0 qrc:/Base/ToolBarStyle.qml -StatusBarStyle 1.0 qrc:/Base/StatusBarStyle.qml -ToolButtonStyle 1.0 qrc:/Base/ToolButtonStyle.qml +AbstractCheckable 1.0 AbstractCheckable.qml +Control 1.0 Control.qml +FocusFrame 1.0 FocusFrame.qml +Margins 1.0 Margins.qml +BasicButton 1.0 BasicButton.qml +ScrollBar 1.0 ScrollBar.qml +ScrollViewHelper 1.0 ScrollViewHelper.qml +Style 1.0 Style.qml +TabBar 1.0 TabBar.qml +StackViewSlideDelegate 1.0 StackViewSlideDelegate.qml diff --git a/src/private/qquickcontrolsettings.cpp b/src/private/qquickcontrolsettings.cpp index d2853982e..e2daa17fa 100644 --- a/src/private/qquickcontrolsettings.cpp +++ b/src/private/qquickcontrolsettings.cpp @@ -63,24 +63,18 @@ static QString styleImportName() return QFileInfo(name).fileName(); } -static QString styleImportPath(QQmlEngine *engine, const QString &styleName, bool &fromResources) +static QString styleImportPath(QQmlEngine *engine, const QString &styleName) { QString path = qgetenv("QT_QUICK_CONTROLS_STYLE"); QFileInfo info(path); if (info.isRelative()) { - bool found = false; foreach (const QString &import, engine->importPathList()) { QDir dir(import + QLatin1String("/QtQuick/Controls/Styles")); if (dir.exists(styleName)) { - found = true; path = dir.absolutePath(); break; } } - if (!found) { - fromResources = true; - path = "qrc:"; - } } else { path = info.absolutePath(); } @@ -89,27 +83,23 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName, boo QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine) { - m_fromResources = false; m_name = styleImportName(); - m_path = styleImportPath(engine, m_name, m_fromResources); + m_path = styleImportPath(engine, m_name); - if (!m_fromResources && !QFile::exists(styleFilePath())) { + if (!QFile::exists(styleFilePath())) { QString unknownStyle = m_name; m_name = defaultStyleName(); - m_path = styleImportPath(engine, m_name, m_fromResources); - qWarning() << "WARNING: Cannot find style" << unknownStyle << " locally - fallback:" << styleFilePath(); + m_path = styleImportPath(engine, m_name); + qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath(); } connect(this, SIGNAL(styleNameChanged()), SIGNAL(styleChanged())); connect(this, SIGNAL(stylePathChanged()), SIGNAL(styleChanged())); } -QString QQuickControlSettings::style() const +QUrl QQuickControlSettings::style() const { - if (m_fromResources) - return styleFilePath(); - else - return QUrl::fromLocalFile(styleFilePath()).toString(); + return QUrl::fromLocalFile(styleFilePath()); } QString QQuickControlSettings::styleName() const diff --git a/src/private/qquickcontrolsettings_p.h b/src/private/qquickcontrolsettings_p.h index e9ba41860..8ff0ecbf5 100644 --- a/src/private/qquickcontrolsettings_p.h +++ b/src/private/qquickcontrolsettings_p.h @@ -52,7 +52,7 @@ class QQmlEngine; class QQuickControlSettings : public QObject { Q_OBJECT - Q_PROPERTY(QString style READ style NOTIFY styleChanged) + Q_PROPERTY(QUrl style READ style NOTIFY styleChanged) Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged) Q_PROPERTY(QString stylePath READ stylePath WRITE setStylePath NOTIFY stylePathChanged) Q_PROPERTY(qreal dpiScaleFactor READ dpiScaleFactor CONSTANT) @@ -60,7 +60,7 @@ class QQuickControlSettings : public QObject public: QQuickControlSettings(QQmlEngine *engine); - QString style() const; + QUrl style() const; QString styleName() const; void setStyleName(const QString &name); @@ -80,7 +80,6 @@ private: QString m_name; QString m_path; - bool m_fromResources; }; QT_END_NAMESPACE diff --git a/src/private/resources.qrc b/src/private/resources.qrc deleted file mode 100644 index 27ebfa137..000000000 --- a/src/private/resources.qrc +++ /dev/null @@ -1,16 +0,0 @@ -<RCC> - <qresource prefix="/private"> - <file>AbstractCheckable.qml</file> - <file>BasicButton.qml</file> - <file>Control.qml</file> - <file>FocusFrame.qml</file> - <file>ModalPopupBehavior.qml</file> - <file>ScrollBar.qml</file> - <file>ScrollViewHelper.qml</file> - <file>StackView.js</file> - <file>StackViewSlideDelegate.qml</file> - <file>style.js</file> - <file>Style.qml</file> - <file>TabBar.qml</file> - </qresource> -</RCC> diff --git a/src/src.pro b/src/src.pro index 2b70573c4..719a3c7b5 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += controls styles private +SUBDIRS += controls styles private styles/private + SUBDIRS += layouts diff --git a/src/styles/Base/MenuBarStyle.qml b/src/styles/Base/MenuBarStyle.qml index 571ebe12c..4effd6eec 100644 --- a/src/styles/Base/MenuBarStyle.qml +++ b/src/styles/Base/MenuBarStyle.qml @@ -40,7 +40,7 @@ import QtQuick 2.1 import QtQuick.Controls.Private 1.0 -import "../private/style.js" as StyleHelpers +import "../../Private/style.js" as StyleHelpers /*! \qmltype MenuBarStyle diff --git a/src/styles/Base/MenuStyle.qml b/src/styles/Base/MenuStyle.qml index e6fc49fbb..eab18f7df 100644 --- a/src/styles/Base/MenuStyle.qml +++ b/src/styles/Base/MenuStyle.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import "../private/style.js" as StyleHelpers +import "../../Private/style.js" as StyleHelpers /*! \qmltype MenuStyle diff --git a/src/styles/plugin.cpp b/src/styles/plugin.cpp deleted file mode 100644 index aedbfa5a6..000000000 --- a/src/styles/plugin.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml> - -QT_BEGIN_NAMESPACE - -class QtQuickControlsStylesPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") - -public: - void registerTypes(const char *uri); - void initializeEngine(QQmlEngine *engine, const char *uri); -}; - -void QtQuickControlsStylesPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(QUrl("qrc:/Base/ButtonStyle.qml"), uri, 1, 0, "ButtonStyle"); - qmlRegisterType(QUrl("qrc:/Base/CheckBoxStyle.qml"), uri, 1, 0, "CheckBoxStyle"); - qmlRegisterType(QUrl("qrc:/Base/ComboBoxStyle.qml"), uri, 1, 0, "ComboBoxStyle"); - qmlRegisterType(QUrl("qrc:/Base/ProgressBarStyle.qml"), uri, 1, 0, "ProgressBarStyle"); - qmlRegisterType(QUrl("qrc:/Base/RadioButtonStyle.qml"), uri, 1, 0, "RadioButtonStyle"); - qmlRegisterType(QUrl("qrc:/Base/ScrollViewStyle.qml"), uri, 1, 0, "ScrollViewStyle"); - qmlRegisterType(QUrl("qrc:/Base/SliderStyle.qml"), uri, 1, 0, "SliderStyle"); - qmlRegisterType(QUrl("qrc:/Base/TabViewStyle.qml"), uri, 1, 0, "TabViewStyle"); - qmlRegisterType(QUrl("qrc:/Base/TableViewStyle.qml"), uri, 1, 0, "TableViewStyle"); - qmlRegisterType(QUrl("qrc:/Base/TextFieldStyle.qml"), uri, 1, 0, "TextFieldStyle"); -} - -void QtQuickControlsStylesPlugin::initializeEngine(QQmlEngine *engine, const char *uri) -{ - Q_UNUSED(uri) - engine->addPluginPath("qrc:/Base"); -} - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/styles/private/private.pro b/src/styles/private/private.pro new file mode 100644 index 000000000..9a5bcd1ed --- /dev/null +++ b/src/styles/private/private.pro @@ -0,0 +1,3 @@ +TARGETPATH = QtQuick/Controls/Styles/Private + +load(qml_module) diff --git a/src/styles/private/qmldir b/src/styles/private/qmldir new file mode 100644 index 000000000..4d1885d5e --- /dev/null +++ b/src/styles/private/qmldir @@ -0,0 +1,7 @@ +module QtQuick.Controls.Styles.Private + +GroupBoxStyle 1.0 ../Base/GroupBoxStyle.qml +SpinBoxStyle 1.0 ../Base/SpinBoxStyle.qml +ToolBarStyle 1.0 ../Base/ToolBarStyle.qml +StatusBarStyle 1.0 ../Base/StatusBarStyle.qml +ToolButtonStyle 1.0 ../Base/ToolButtonStyle.qml diff --git a/src/styles/qmldir b/src/styles/qmldir index 43812858a..5077542a5 100644 --- a/src/styles/qmldir +++ b/src/styles/qmldir @@ -1,2 +1,11 @@ module QtQuick.Controls.Styles -plugin qtquickcontrolsstylesplugin +ButtonStyle 1.0 Base/ButtonStyle.qml +CheckBoxStyle 1.0 Base/CheckBoxStyle.qml +ComboBoxStyle 1.0 Base/ComboBoxStyle.qml +ProgressBarStyle 1.0 Base/ProgressBarStyle.qml +RadioButtonStyle 1.0 Base/RadioButtonStyle.qml +ScrollViewStyle 1.0 Base/ScrollViewStyle.qml +SliderStyle 1.0 Base/SliderStyle.qml +TabViewStyle 1.0 Base/TabViewStyle.qml +TableViewStyle 1.0 Base/TableViewStyle.qml +TextFieldStyle 1.0 Base/TextFieldStyle.qml diff --git a/src/styles/resources.qrc b/src/styles/resources.qrc deleted file mode 100644 index 3eef2631c..000000000 --- a/src/styles/resources.qrc +++ /dev/null @@ -1,61 +0,0 @@ -<RCC> - <qresource prefix="/Base"> - <file alias="images/arrow-down.png">Base/images/arrow-down.png</file> - <file alias="images/arrow-down@2x.png">Base/images/arrow-down@2x.png</file> - <file alias="images/arrow-left.png">Base/images/arrow-left.png</file> - <file alias="images/arrow-left@2x.png">Base/images/arrow-left@2x.png</file> - <file alias="images/arrow-right.png">Base/images/arrow-right.png</file> - <file alias="images/arrow-right@2x.png">Base/images/arrow-right@2x.png</file> - <file alias="images/arrow-up.png">Base/images/arrow-up.png</file> - <file alias="images/arrow-up@2x.png">Base/images/arrow-up@2x.png</file> - <file alias="images/button_down.png">Base/images/button_down.png</file> - <file alias="images/button.png">Base/images/button.png</file> - <file alias="images/editbox.png">Base/images/editbox.png</file> - <file alias="images/focusframe.png">Base/images/focusframe.png</file> - <file alias="images/groupbox.png">Base/images/groupbox.png</file> - <file alias="images/header.png">Base/images/header.png</file> - <file alias="images/progress-indeterminate.png">Base/images/progress-indeterminate.png</file> - <file alias="images/scrollbar-handle-horizontal.png">Base/images/scrollbar-handle-horizontal.png</file> - <file alias="images/scrollbar-handle-vertical.png">Base/images/scrollbar-handle-vertical.png</file> - <file alias="images/tab_selected.png">Base/images/tab_selected.png</file> - <file alias="images/tab.png">Base/images/tab.png</file> - <file alias="ButtonStyle.qml">Base/ButtonStyle.qml</file> - <file alias="CheckBoxStyle.qml">Base/CheckBoxStyle.qml</file> - <file alias="ComboBoxStyle.qml">Base/ComboBoxStyle.qml</file> - <file alias="FocusFrameStyle.qml">Base/FocusFrameStyle.qml</file> - <file alias="GroupBoxStyle.qml">Base/GroupBoxStyle.qml</file> - <file alias="MenuBarStyle.qml">Base/MenuBarStyle.qml</file> - <file alias="MenuStyle.qml">Base/MenuStyle.qml</file> - <file alias="ProgressBarStyle.qml">Base/ProgressBarStyle.qml</file> - <file alias="RadioButtonStyle.qml">Base/RadioButtonStyle.qml</file> - <file alias="ScrollViewStyle.qml">Base/ScrollViewStyle.qml</file> - <file alias="SliderStyle.qml">Base/SliderStyle.qml</file> - <file alias="SpinBoxStyle.qml">Base/SpinBoxStyle.qml</file> - <file alias="StatusBarStyle.qml">Base/StatusBarStyle.qml</file> - <file alias="TableViewStyle.qml">Base/TableViewStyle.qml</file> - <file alias="TabViewStyle.qml">Base/TabViewStyle.qml</file> - <file alias="TextFieldStyle.qml">Base/TextFieldStyle.qml</file> - <file alias="ToolBarStyle.qml">Base/ToolBarStyle.qml</file> - <file alias="ToolButtonStyle.qml">Base/ToolButtonStyle.qml</file> - </qresource> - <qresource prefix="/Desktop"> - <file alias="ButtonStyle.qml">Desktop/ButtonStyle.qml</file> - <file alias="CheckBoxStyle.qml">Desktop/CheckBoxStyle.qml</file> - <file alias="ComboBoxStyle.qml">Desktop/ComboBoxStyle.qml</file> - <file alias="FocusFrameStyle.qml">Desktop/FocusFrameStyle.qml</file> - <file alias="GroupBoxStyle.qml">Desktop/GroupBoxStyle.qml</file> - <file alias="MenuBarStyle.qml">Desktop/MenuBarStyle.qml</file> - <file alias="MenuStyle.qml">Desktop/MenuStyle.qml</file> - <file alias="ProgressBarStyle.qml">Desktop/ProgressBarStyle.qml</file> - <file alias="RadioButtonStyle.qml">Desktop/RadioButtonStyle.qml</file> - <file alias="ScrollViewStyle.qml">Desktop/ScrollViewStyle.qml</file> - <file alias="SliderStyle.qml">Desktop/SliderStyle.qml</file> - <file alias="SpinBoxStyle.qml">Desktop/SpinBoxStyle.qml</file> - <file alias="StatusBarStyle.qml">Desktop/StatusBarStyle.qml</file> - <file alias="TableViewStyle.qml">Desktop/TableViewStyle.qml</file> - <file alias="TabViewStyle.qml">Desktop/TabViewStyle.qml</file> - <file alias="TextFieldStyle.qml">Desktop/TextFieldStyle.qml</file> - <file alias="ToolBarStyle.qml">Desktop/ToolBarStyle.qml</file> - <file alias="ToolButtonStyle.qml">Desktop/ToolButtonStyle.qml</file> - </qresource> -</RCC> diff --git a/src/styles/styles.pro b/src/styles/styles.pro index 0e016ae0b..158c1dd13 100644 --- a/src/styles/styles.pro +++ b/src/styles/styles.pro @@ -1,12 +1,9 @@ -TARGET = qtquickcontrolsstylesplugin TARGETPATH = QtQuick/Controls/Styles -QT += qml quick gui-private core-private - QMAKE_DOCS = $$PWD/doc/qtquickcontrolsstyles.qdocconf # Base -OTHER_FILES = \ +QML_FILES = \ Base/ButtonStyle.qml \ Base/CheckBoxStyle.qml \ Base/ComboBoxStyle.qml \ @@ -27,7 +24,7 @@ OTHER_FILES = \ Base/ToolButtonStyle.qml # Desktop -OTHER_FILES += \ +QML_FILES += \ Desktop/ButtonStyle.qml \ Desktop/CheckBoxStyle.qml \ Desktop/ComboBoxStyle.qml \ @@ -48,7 +45,7 @@ OTHER_FILES += \ Desktop/ToolButtonStyle.qml # Images -OTHER_FILES += \ +QML_FILES += \ Base/images/button.png \ Base/images/button_down.png \ Base/images/tab.png \ @@ -69,11 +66,4 @@ OTHER_FILES += \ Base/images/arrow-right.png \ Base/images/arrow-right@2x.png -SOURCES += \ - $$PWD/plugin.cpp - -RESOURCES += \ - $$PWD/resources.qrc - -CONFIG += no_cxx_module -load(qml_plugin) +load(qml_module) diff --git a/tests/auto/controls/data/tst_groupbox.qml b/tests/auto/controls/data/tst_groupbox.qml index 39f76a1e8..6753868c2 100644 --- a/tests/auto/controls/data/tst_groupbox.qml +++ b/tests/auto/controls/data/tst_groupbox.qml @@ -91,7 +91,7 @@ TestCase { function test_dynamicSize() { - var groupbox = Qt.createQmlObject('import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0 ; GroupBox {style:GroupBoxStyle{}}', container, '') + var groupbox = Qt.createQmlObject('import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0 ; GroupBox {style:GroupBoxStyle{}}', container, '') compare(groupbox.width, 16) compare(groupbox.height, 16) diff --git a/tests/auto/controls/data/tst_styles.qml b/tests/auto/controls/data/tst_styles.qml index f6b53b722..233c4a2eb 100644 --- a/tests/auto/controls/data/tst_styles.qml +++ b/tests/auto/controls/data/tst_styles.qml @@ -62,7 +62,7 @@ Item { function test_createToolButtonStyle() { var control = Qt.createQmlObject( - 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0; \ + 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0; \ Rectangle { width: 50; height: 50; property Component style: ToolButtonStyle {}}' , container, '') } @@ -111,21 +111,21 @@ Item { function test_createSpinBoxStyle() { var control = Qt.createQmlObject( - 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0; \ + 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0; \ Rectangle { width: 50; height: 50; property Component style: SpinBoxStyle {}}' , container, '') } function test_createToolBarStyle() { var control = Qt.createQmlObject( - 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0; \ + 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0; \ Rectangle { width: 50; height: 50; property Component style: ToolBarStyle {}}' , container, '') } function test_createStatusBarStyle() { var control = Qt.createQmlObject( - 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0; \ + 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0; \ Rectangle { width: 50; height: 50; property Component style: StatusBarStyle {}}' , container, '') } @@ -146,7 +146,7 @@ Item { function test_createGroupBoxStyle() { var control = Qt.createQmlObject( - 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Private 1.0; \ + 'import QtQuick 2.1; import QtQuick.Controls 1.0; import QtQuick.Controls.Styles.Private 1.0; \ Rectangle { width: 50; height: 50; property Component style: GroupBoxStyle {}}' , container, '') } diff --git a/tests/manual/testbench/content/Components.qml b/tests/manual/testbench/content/Components.qml index 23527ccdb..b497230d6 100644 --- a/tests/manual/testbench/content/Components.qml +++ b/tests/manual/testbench/content/Components.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 -import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles.Private 1.0 Item { property Component button: Button { text: "Push me"} -- GitLab