diff options
165 files changed, 801 insertions, 1024 deletions
diff --git a/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml b/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml index b41f7846..598fce56 100644 --- a/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml +++ b/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 CircularGaugeStyle { tickmarkInset: toPixels(0.04) diff --git a/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml b/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml index 5caa4204..0c3d9320 100644 --- a/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml +++ b/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml @@ -39,8 +39,8 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 DashboardGaugeStyle { id: fuelGaugeStyle diff --git a/examples/quick/extras/dashboard/qml/TachometerStyle.qml b/examples/quick/extras/dashboard/qml/TachometerStyle.qml index 43abbf53..a0f7b6b9 100644 --- a/examples/quick/extras/dashboard/qml/TachometerStyle.qml +++ b/examples/quick/extras/dashboard/qml/TachometerStyle.qml @@ -39,8 +39,8 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 DashboardGaugeStyle { id: tachometerStyle diff --git a/examples/quick/extras/dashboard/qml/TurnIndicator.qml b/examples/quick/extras/dashboard/qml/TurnIndicator.qml index 4978592f..cf9c41db 100644 --- a/examples/quick/extras/dashboard/qml/TurnIndicator.qml +++ b/examples/quick/extras/dashboard/qml/TurnIndicator.qml @@ -39,7 +39,6 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 Item { // This enum is actually keyboard-related, but it serves its purpose diff --git a/examples/quick/extras/dashboard/qml/dashboard.qml b/examples/quick/extras/dashboard/qml/dashboard.qml index e7488209..756d96a5 100644 --- a/examples/quick/extras/dashboard/qml/dashboard.qml +++ b/examples/quick/extras/dashboard/qml/dashboard.qml @@ -40,10 +40,9 @@ import QtQuick 2.2 import QtQuick.Window 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 Window { id: root diff --git a/examples/quick/extras/flat/Content.qml b/examples/quick/extras/flat/Content.qml index e197cd72..2969f730 100644 --- a/examples/quick/extras/flat/Content.qml +++ b/examples/quick/extras/flat/Content.qml @@ -40,10 +40,9 @@ import QtQuick 2.4 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.XmlListModel 2.0 Item { diff --git a/examples/quick/extras/flat/main.qml b/examples/quick/extras/flat/main.qml index e26997d6..aec94c36 100644 --- a/examples/quick/extras/flat/main.qml +++ b/examples/quick/extras/flat/main.qml @@ -40,10 +40,9 @@ import QtQuick 2.4 import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 ApplicationWindow { diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml index abf54193..9993a97a 100644 --- a/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml +++ b/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 CircularGaugeStyle { id: root diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml index acba4bdc..b7f1b241 100644 --- a/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml +++ b/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 CircularGaugeStyle { labelStepSize: 20 diff --git a/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml index d25765f3..8e1f34ea 100644 --- a/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml +++ b/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 CircularGaugeStyle { id: root diff --git a/examples/quick/extras/gallery/qml/CircularGaugeView.qml b/examples/quick/extras/gallery/qml/CircularGaugeView.qml index f89f1d24..cd03ebbe 100644 --- a/examples/quick/extras/gallery/qml/CircularGaugeView.qml +++ b/examples/quick/extras/gallery/qml/CircularGaugeView.qml @@ -40,7 +40,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 ControlView { id: controlView diff --git a/examples/quick/extras/gallery/qml/ControlLabel.qml b/examples/quick/extras/gallery/qml/ControlLabel.qml index 5dba9172..6fdcec11 100644 --- a/examples/quick/extras/gallery/qml/ControlLabel.qml +++ b/examples/quick/extras/gallery/qml/ControlLabel.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Text { font.pixelSize: Math.max(textSingleton.font.pixelSize, Math.min(32, root.toPixels(0.045))) diff --git a/examples/quick/extras/gallery/qml/PieMenuControlView.qml b/examples/quick/extras/gallery/qml/PieMenuControlView.qml index a138c178..bbaa8637 100644 --- a/examples/quick/extras/gallery/qml/PieMenuControlView.qml +++ b/examples/quick/extras/gallery/qml/PieMenuControlView.qml @@ -41,7 +41,7 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: view diff --git a/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml index 7667e813..98e04298 100644 --- a/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml +++ b/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 PieMenuStyle { backgroundColor: "#222" diff --git a/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml index 19941116..02a189d6 100644 --- a/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml +++ b/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 PieMenuStyle { } diff --git a/examples/quick/extras/gallery/qml/StylePicker.qml b/examples/quick/extras/gallery/qml/StylePicker.qml index 1fcfa55e..f1d2cad2 100644 --- a/examples/quick/extras/gallery/qml/StylePicker.qml +++ b/examples/quick/extras/gallery/qml/StylePicker.qml @@ -39,10 +39,9 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 ListView { id: stylePicker diff --git a/examples/quick/extras/gallery/qml/gallery.qml b/examples/quick/extras/gallery/qml/gallery.qml index fe870063..d6b46dc1 100644 --- a/examples/quick/extras/gallery/qml/gallery.qml +++ b/examples/quick/extras/gallery/qml/gallery.qml @@ -40,11 +40,10 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Dialogs 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Layouts 1.0 import QtQuick.Window 2.1 diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index 51e08316..542cfe4e 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -145,7 +145,7 @@ Window { /*! The style Component for the window. \sa {Qt Quick Controls Styles QML Types} */ - property Component style: Qt.createComponent(Settings.style + "/ApplicationWindowStyle.qml", root) + property Component style: Settings.styleComponent(Settings.style, "ApplicationWindowStyle.qml", root) /*! \internal */ property alias __style: styleLoader.item diff --git a/src/controls/BusyIndicator.qml b/src/controls/BusyIndicator.qml index 4922ecd0..fbd6d665 100644 --- a/src/controls/BusyIndicator.qml +++ b/src/controls/BusyIndicator.qml @@ -78,5 +78,5 @@ Control { Accessible.role: Accessible.Indicator Accessible.name: "busy" - style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", indicator) + style: Settings.styleComponent(Settings.style, "BusyIndicatorStyle.qml", indicator) } diff --git a/src/controls/Button.qml b/src/controls/Button.qml index 00ccfa4e..6daf595c 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -88,7 +88,7 @@ BasicButton { Accessible.name: text - style: Qt.createComponent(Settings.style + "/ButtonStyle.qml", button) + style: Settings.styleComponent(Settings.style, "ButtonStyle.qml", button) Binding { target: menu diff --git a/src/controls/Calendar.qml b/src/controls/Calendar.qml index ba40893a..f6a779db 100644 --- a/src/controls/Calendar.qml +++ b/src/controls/Calendar.qml @@ -218,7 +218,7 @@ Control { visibleDate: new Date(visibleYear, visibleMonth, 1) } - style: Qt.createComponent(Settings.style + "/CalendarStyle.qml", calendar) + style: Settings.styleComponent(Settings.style, "CalendarStyle.qml", calendar) /*! \qmlsignal Calendar::hovered(date date) diff --git a/src/controls/CheckBox.qml b/src/controls/CheckBox.qml index 0d27c1ac..b5df8846 100644 --- a/src/controls/CheckBox.qml +++ b/src/controls/CheckBox.qml @@ -139,7 +139,7 @@ AbstractCheckable { */ property bool __ignoreCheckedState: false - style: Qt.createComponent(Settings.style + "/CheckBoxStyle.qml", checkBox) + style: Settings.styleComponent(Settings.style, "CheckBoxStyle.qml", checkBox) activeFocusOnTab: true diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index f0067822..81d56030 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -332,7 +332,7 @@ Control { /*! \internal */ property var __popup: popup - style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox) + style: Settings.styleComponent(Settings.style, "ComboBoxStyle.qml", comboBox) activeFocusOnTab: true diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index f51ac757..99d520fe 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -154,7 +154,7 @@ FocusScope { readonly property alias contentItem: container /*! \internal */ - property Component style: Qt.createComponent(Settings.style + "/GroupBoxStyle.qml", groupbox) + property Component style: Settings.styleComponent(Settings.style, "GroupBoxStyle.qml", groupbox) /*! \internal */ property alias __checkbox: check diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml index 2ab229ab..17b27977 100644 --- a/src/controls/Menu.qml +++ b/src/controls/Menu.qml @@ -132,7 +132,7 @@ MenuPrivate { Component.onCompleted: { if (!style) { __usingDefaultStyle = true - style = Qt.binding(function() { return Qt.createComponent(Settings.style + "/MenuStyle.qml", root) }) + style = Qt.binding(function() { return Settings.styleComponent(Settings.style, "MenuStyle.qml", root) }) } } diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 5f444dac..0c0a2004 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -77,7 +77,7 @@ import QtQuick.Controls.Private 1.0 MenuBarPrivate { id: root - property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root) + property Component style: Settings.styleComponent(Settings.style, "MenuBarStyle.qml", root) /*! \internal */ property QtObject __style: styleLoader.item diff --git a/src/controls/Private/FocusFrame.qml b/src/controls/Private/FocusFrame.qml index d1205708..66090038 100644 --- a/src/controls/Private/FocusFrame.qml +++ b/src/controls/Private/FocusFrame.qml @@ -59,6 +59,6 @@ Item { id: loader z: 2 anchors.fill: parent - sourceComponent: Qt.createComponent(Settings.style + "/FocusFrameStyle.qml", root) + sourceComponent: Settings.styleComponent(Settings.style, "FocusFrameStyle.qml", root) } } diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index 017a0714..c000a658 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -106,6 +106,57 @@ bool QQuickControlSettings::hoverEnabled() const return !isMobile() || !hasTouchScreen(); } +QString QQuickControlSettings::makeStyleComponentPath(const QString &controlStyleName, const QString &styleDirPath) +{ + return styleDirPath + QStringLiteral("/") + controlStyleName; +} + +QUrl QQuickControlSettings::makeStyleComponentUrl(const QString &controlStyleName, QString styleDirPath) +{ + QString styleFilePath = makeStyleComponentPath(controlStyleName, styleDirPath); + + if (styleDirPath.startsWith(QStringLiteral(":/"))) + return QUrl(QStringLiteral("qrc") + styleFilePath); + + return QUrl::fromLocalFile(styleFilePath); +} + +QQmlComponent *QQuickControlSettings::styleComponent(const QUrl &styleDirUrl, const QString &controlStyleName, QObject *control) +{ + Q_UNUSED(styleDirUrl); // required for hack that forces this function to be re-called from within QML when style changes + + // QUrl doesn't consider qrc-based URLs as local files, so bypass it here. + QString styleFilePath = makeStyleComponentPath(controlStyleName, m_styleMap.value(m_name).m_styleDirPath); + QUrl styleFileUrl; + if (QFile::exists(styleFilePath)) { + styleFileUrl = makeStyleComponentUrl(controlStyleName, m_styleMap.value(m_name).m_styleDirPath); + } else { + // It's OK for a style to pick and choose which controls it wants to provide style files for. + styleFileUrl = makeStyleComponentUrl(controlStyleName, m_styleMap.value(QStringLiteral("Base")).m_styleDirPath); + } + + return new QQmlComponent(qmlEngine(control), styleFileUrl); +} + +static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleName) +{ + QString path; + bool found = false; + foreach (const QString &import, engine->importPathList()) { + QDir dir(import + QStringLiteral("/QtQuick/Controls/Styles")); + if (dir.exists(styleName)) { + found = true; + path = dir.absolutePath(); + break; + } + if (found) + break; + } + if (!found) + path = ":/QtQuick/Controls/Styles"; + return path; +} + static QString styleImportPath(QQmlEngine *engine, const QString &styleName) { QString path = qgetenv("QT_QUICK_CONTROLS_STYLE"); @@ -113,19 +164,7 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName) if (fromResource(path)) { path = info.path(); } else 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) - break; - } - if (!found) - path = ":/QtQuick/Controls/Styles"; + path = relativeStyleImportPath(engine, styleName); } else { path = info.absolutePath(); } @@ -134,40 +173,109 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName) QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine) { + // First, register all style paths in the default style location. + QDir dir; + const QString defaultStyle = defaultStyleName(); + dir.setPath(relativeStyleImportPath(engine, defaultStyle)); + dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); + foreach (const QString &styleDirectory, dir.entryList()) { + findStyle(engine, styleDirectory); + } + m_name = styleImportName(); - m_path = styleImportPath(engine, m_name); - QString path = styleFilePath(); + // If the style name is a path.. + const QString styleNameFromEnvVar = qgetenv("QT_QUICK_CONTROLS_STYLE"); + if (QFile::exists(styleNameFromEnvVar)) { + StyleData styleData; + styleData.m_styleDirPath = styleNameFromEnvVar; + m_styleMap[m_name] = styleData; + } - QDir dir(path); - if (!dir.exists()) { + // Then check if the style the user wanted is known to us. Otherwise, use the fallback style. + if (m_styleMap.contains(m_name)) { + m_path = m_styleMap.value(m_name).m_styleDirPath; + } else { QString unknownStyle = m_name; - m_name = defaultStyleName(); - m_path = styleImportPath(engine, m_name); + m_name = defaultStyle; + m_path = m_styleMap.value(defaultStyle).m_styleDirPath; qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath(); - } else { - typedef bool (*StyleInitFunc)(); - typedef const char *(*StylePathFunc)(); - - foreach (const QString &fileName, dir.entryList()) { - if (QLibrary::isLibrary(fileName)) { - QLibrary lib(dir.absoluteFilePath(fileName)); - StyleInitFunc initFunc = (StyleInitFunc) lib.resolve("qt_quick_controls_style_init"); - if (initFunc) - initFunc(); - StylePathFunc pathFunc = (StylePathFunc) lib.resolve("qt_quick_controls_style_path"); - if (pathFunc) - m_path = QString::fromLocal8Bit(pathFunc()); - if (initFunc || pathFunc) - break; - } - } } + // Can't really do anything about this failing here, so don't bother checking... + resolveCurrentStylePath(); + connect(this, SIGNAL(styleNameChanged()), SIGNAL(styleChanged())); connect(this, SIGNAL(stylePathChanged()), SIGNAL(styleChanged())); } +bool QQuickControlSettings::resolveCurrentStylePath() +{ + if (!m_styleMap.contains(m_name)) { + qWarning() << "WARNING: Cannot find style" << m_name; + return false; + } + + StyleData styleData = m_styleMap.value(m_name); + + if (styleData.m_stylePluginPath.isEmpty()) + return true; // It's not a plugin; don't have to do anything. + + typedef bool (*StyleInitFunc)(); + typedef const char *(*StylePathFunc)(); + + QLibrary lib(styleData.m_stylePluginPath); + if (!lib.load()) { + qWarning().nospace() << "WARNING: Cannot load plugin " << styleData.m_stylePluginPath + << " for style " << m_name << ": " << lib.errorString(); + return false; + } + + // Check for the existence of this first, as we don't want to init if this doesn't exist. + StylePathFunc pathFunc = (StylePathFunc) lib.resolve("qt_quick_controls_style_path"); + if (!pathFunc) { + qWarning() << "WARNING: Style" << m_name << "is a plugin but does not expose qt_quick_controls_style_path"; + return false; + } + + StyleInitFunc initFunc = (StyleInitFunc) lib.resolve("qt_quick_controls_style_init"); + if (initFunc) + initFunc(); + + styleData.m_styleDirPath = QString::fromLocal8Bit(pathFunc()); + m_styleMap[m_name] = styleData; + return true; +} + +void QQuickControlSettings::findStyle(QQmlEngine *engine, const QString &styleName) +{ + QString path = styleImportPath(engine, styleName); + QDir dir; + dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); + dir.setPath(path); + dir.cd(styleName); + + StyleData styleData; + + foreach (const QString &fileName, dir.entryList()) { + // This assumes that there is only one library in the style directory, + // which should be a safe assumption. If at some point it's determined + // not to be safe, we'll have to resolve the init and path functions + // here, to be sure that it is the correct library. + if (QLibrary::isLibrary(fileName)) { + styleData.m_stylePluginPath = dir.absoluteFilePath(fileName); + break; + } + } + + // If there's no plugin for the style, then the style's files are + // contained in this directory (which contains a qmldir file instead). + if (styleData.m_stylePluginPath.isEmpty()) + styleData.m_styleDirPath = dir.absolutePath(); + + m_styleMap[styleName] = styleData; +} + QUrl QQuickControlSettings::style() const { QUrl result; @@ -189,8 +297,14 @@ QString QQuickControlSettings::styleName() const void QQuickControlSettings::setStyleName(const QString &name) { if (m_name != name) { + QString oldName = m_name; m_name = name; - emit styleNameChanged(); + + // Don't change the style if it can't be resolved. + if (!resolveCurrentStylePath()) + m_name = oldName; + else + emit styleNameChanged(); } } @@ -209,7 +323,7 @@ void QQuickControlSettings::setStylePath(const QString &path) QString QQuickControlSettings::styleFilePath() const { - return m_path + QLatin1Char('/') + m_name; + return m_path; } extern Q_GUI_EXPORT int qt_defaultDpiX(); diff --git a/src/controls/Private/qquickcontrolsettings_p.h b/src/controls/Private/qquickcontrolsettings_p.h index ed21101d..1b99fd3e 100644 --- a/src/controls/Private/qquickcontrolsettings_p.h +++ b/src/controls/Private/qquickcontrolsettings_p.h @@ -39,6 +39,9 @@ #include <QtCore/qurl.h> #include <QtCore/qobject.h> +#include <QtCore/qstring.h> +#include <QtCore/qhash.h> +#include <QtQml/qqmlcomponent.h> QT_BEGIN_NAMESPACE @@ -74,6 +77,9 @@ public: bool isMobile() const; bool hoverEnabled() const; + Q_INVOKABLE QQmlComponent *styleComponent(const QUrl &styleDirUrl, + const QString &controlStyleName, QObject *control); + signals: void styleChanged(); void styleNameChanged(); @@ -81,9 +87,22 @@ signals: private: QString styleFilePath() const; + void findStyle(QQmlEngine *engine, const QString &styleName); + bool resolveCurrentStylePath(); + QString makeStyleComponentPath(const QString &controlStyleName, const QString &styleDirPath); + QUrl makeStyleComponentUrl(const QString &controlStyleName, QString styleDirPath); + + struct StyleData + { + // Path to the style's plugin or qmldir file. + QString m_stylePluginPath; + // Path to the directory containing the style's files. + QString m_styleDirPath; + }; QString m_name; QString m_path; + QHash<QString, StyleData> m_styleMap; }; QT_END_NAMESPACE diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index 7bc3bec5..681cb135 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -114,7 +114,7 @@ Control { readonly property alias hovered: hoverArea.containsMouse /*! \internal */ - style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar) + style: Settings.styleComponent(Settings.style, "ProgressBarStyle.qml", progressbar) /*! \internal */ property bool __initialized: false diff --git a/src/controls/RadioButton.qml b/src/controls/RadioButton.qml index d24a5d44..b03028a1 100644 --- a/src/controls/RadioButton.qml +++ b/src/controls/RadioButton.qml @@ -90,7 +90,7 @@ AbstractCheckable { \codeline Qt.createComponent("path/to/style.qml", radioButtonId); */ - style: Qt.createComponent(Settings.style + "/RadioButtonStyle.qml", radioButton) + style: Settings.styleComponent(Settings.style, "RadioButtonStyle.qml", radioButton) __cycleStatesHandler: function() { checked = !checked; } } diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 05f33b84..c82bb7e5 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -180,7 +180,7 @@ FocusScope { \sa {Qt Quick Controls Styles QML Types} */ - property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root) + property Component style: Settings.styleComponent(Settings.style, "ScrollViewStyle.qml", root) /*! \internal */ property Style __style: styleLoader.item diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 8bce7e8f..437749eb 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -189,7 +189,7 @@ Control { range.decreaseSingleStep() } - style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider) + style: Settings.styleComponent(Settings.style, "SliderStyle.qml", slider) Keys.onRightPressed: if (__horizontal) range.increaseSingleStep() Keys.onLeftPressed: if (__horizontal) range.decreaseSingleStep() diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 95ce2b47..96d8d0a2 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -208,7 +208,7 @@ Control { */ property Component menu: input.editMenu.defaultMenu - style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox) + style: Settings.styleComponent(Settings.style, "SpinBoxStyle.qml", spinbox) /*! \internal */ function __increment() { diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 4f0dd374..74df9439 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -82,7 +82,7 @@ FocusScope { + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0) /*! \internal */ - property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar) + property Component style: Settings.styleComponent(Settings.style, "StatusBarStyle.qml", statusbar) /*! \internal */ property alias __style: styleLoader.item diff --git a/src/extras/Styles/Base/CircularButtonStyle.qml b/src/controls/Styles/Base/CircularButtonStyle.qml index 9e29a534..e4576226 100644 --- a/src/extras/Styles/Base/CircularButtonStyle.qml +++ b/src/controls/Styles/Base/CircularButtonStyle.qml @@ -35,8 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 import QtQuick.Extras.Private 1.0 ButtonStyle { diff --git a/src/extras/Styles/Base/CircularGaugeStyle.qml b/src/controls/Styles/Base/CircularGaugeStyle.qml index 2030f775..99b0091b 100644 --- a/src/extras/Styles/Base/CircularGaugeStyle.qml +++ b/src/controls/Styles/Base/CircularGaugeStyle.qml @@ -36,17 +36,17 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype CircularGaugeStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for CircularGauge. You can create a custom circular gauge by replacing the following delegates: @@ -96,8 +96,6 @@ Style { id: circularGaugeStyle /*! - \since 1.3 - The \l CircularGauge that this style is attached to. */ readonly property CircularGauge control: __control @@ -241,8 +239,6 @@ Style { readonly property int labelCount: control.__panel.circularTickmarkLabel.labelCount /*! - \since QtQuick.Extras 1.2 - Returns \a value as an angle in degrees. This function is useful for custom drawing or positioning of items in diff --git a/src/extras/Styles/Base/CircularTickmarkLabelStyle.qml b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml index 010e9245..010e9245 100644 --- a/src/extras/Styles/Base/CircularTickmarkLabelStyle.qml +++ b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml diff --git a/src/extras/Styles/Base/CommonStyleHelper.qml b/src/controls/Styles/Base/CommonStyleHelper.qml index 4263a743..4263a743 100644 --- a/src/extras/Styles/Base/CommonStyleHelper.qml +++ b/src/controls/Styles/Base/CommonStyleHelper.qml diff --git a/src/extras/Styles/Base/DelayButtonStyle.qml b/src/controls/Styles/Base/DelayButtonStyle.qml index e416550b..447932b7 100644 --- a/src/extras/Styles/Base/DelayButtonStyle.qml +++ b/src/controls/Styles/Base/DelayButtonStyle.qml @@ -36,16 +36,15 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private.CppUtils 1.1 /*! \qmltype DelayButtonStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for DelayButton. You can create a custom DelayButton by replacing the following delegates: @@ -59,8 +58,6 @@ CircularButtonStyle { id: delayButtonStyle /*! - \since 1.3 - The \l DelayButton that this style is attached to. */ readonly property DelayButton control: __control diff --git a/src/extras/Styles/Base/DialStyle.qml b/src/controls/Styles/Base/DialStyle.qml index 3523f500..dc4f370d 100644 --- a/src/extras/Styles/Base/DialStyle.qml +++ b/src/controls/Styles/Base/DialStyle.qml @@ -35,18 +35,18 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 /*! \qmltype DialStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for Dial. You can create a custom dial by replacing the following delegates: @@ -59,15 +59,11 @@ Style { id: dialStyle /*! - \since 1.3 - The \l Dial that this style is attached to. */ readonly property Dial control: __control /*! - \since QtQuick.Extras 1.1 - The distance from the center of the dial to the outer edge of the dial. This property is useful for determining the size of the various @@ -77,16 +73,12 @@ Style { readonly property real outerRadius: Math.min(control.height, control.width) / 2 /*! - \since 1.2 - The distance in pixels from the outside of the dial (outerRadius) to the center of the handle. */ property real handleInset: (__tickmarkRadius * 4) + ((__handleRadius * 2) * 0.55) /*! - \since QtQuick.Extras 1.1 - The interval at which tickmarks are displayed. For example, if this property is set to \c 10, @@ -97,8 +89,6 @@ Style { property real tickmarkStepSize: 1 /*! - \since QtQuick.Extras 1.1 - The distance in pixels from the outside of the dial (outerRadius) at which the outermost point of the tickmark line is drawn. */ @@ -106,8 +96,6 @@ Style { /*! - \since QtQuick.Extras 1.1 - The amount of tickmarks displayed by the dial, calculated from \l tickmarkStepSize and the control's \l {Dial::minimumValue}{minimumValue} and @@ -118,8 +106,6 @@ Style { readonly property int tickmarkCount: control.__panel.circularTickmarkLabel.tickmarkCount /*! - \since QtQuick.Extras 1.1 - The amount of minor tickmarks between each tickmark. \sa tickmarkCount @@ -127,24 +113,18 @@ Style { property int minorTickmarkCount: 0 /*! - \since QtQuick.Extras 1.1 - The distance in pixels from the outside of the dial (outerRadius) at which the outermost point of the minor tickmark line is drawn. */ property real minorTickmarkInset: 0 /*! - \since QtQuick.Extras 1.1 - The distance in pixels from the outside of the dial (outerRadius) at which the center of the value marker text is drawn. */ property real labelInset: 0 /*! - \since QtQuick.Extras 1.1 - The interval at which tickmark labels are displayed. For example, if this property is set to \c 10 (the default), @@ -155,8 +135,6 @@ Style { property real labelStepSize: tickmarkStepSize /*! - \since QtQuick.Extras 1.1 - The amount of tickmark labels displayed by the dial, calculated from \l labelStepSize and the control's \l {Dial::minimumValue}{minimumValue} and @@ -167,8 +145,6 @@ Style { readonly property int labelCount: control.__panel.circularTickmarkLabel.labelCount /*! - \since QtQuick.Extras 1.2 - Returns \a value as an angle in degrees. This function is useful for custom drawing or positioning of items in @@ -240,8 +216,6 @@ Style { } /*! - \since 1.2 - The handle of the dial. The handle is automatically positioned within the dial, based on the @@ -262,8 +236,6 @@ Style { } /*! - \since QtQuick.Extras 1.1 - This component defines each individual tickmark. The position of each tickmark is already set; only the \l {Item::implicitWidth}{implicitWidth} and @@ -289,8 +261,6 @@ Style { } /*! - \since QtQuick.Extras 1.1 - This component defines each individual minor tickmark. The position of each minor tickmark is already set; only the \l {Item::implicitWidth}{implicitWidth} and @@ -310,8 +280,6 @@ Style { property Component minorTickmark /*! - \since QtQuick.Extras 1.1 - This defines the text of each tickmark label on the dial. Each instance of this component has access to the following properties: diff --git a/src/extras/Styles/Base/GaugeStyle.qml b/src/controls/Styles/Base/GaugeStyle.qml index 49ea6f29..35da65d5 100644 --- a/src/extras/Styles/Base/GaugeStyle.qml +++ b/src/controls/Styles/Base/GaugeStyle.qml @@ -35,17 +35,17 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype GaugeStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for Gauge. You can create a custom gauge by replacing the following delegates: @@ -60,9 +60,9 @@ import QtQuick.Extras.Private 1.0 \code import QtQuick 2.2 - import QtQuick.Controls 1.1 - import QtQuick.Extras 1.3 - import QtQuick.Extras.Styles 1.3 + import QtQuick.Controls 1.4 + import QtQuick.Controls.Styles 1.4 + import QtQuick.Extras 1.4 Rectangle { width: 80 @@ -107,15 +107,11 @@ Style { id: gaugeStyle /*! - \since 1.3 - The \l Gauge that this style is attached to. */ readonly property Gauge control: __control /*! - \since QtQuick.Extras.Styles 1.3 - This property holds the value displayed by the gauge as a position in pixels. diff --git a/src/extras/Styles/Base/HandleStyle.qml b/src/controls/Styles/Base/HandleStyle.qml index 38588417..fd89ecac 100644 --- a/src/extras/Styles/Base/HandleStyle.qml +++ b/src/controls/Styles/Base/HandleStyle.qml @@ -36,7 +36,7 @@ import QtQuick 2.2 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Style { id: handleStyle diff --git a/src/extras/Styles/Base/HandleStyleHelper.qml b/src/controls/Styles/Base/HandleStyleHelper.qml index 61ad3bb3..61ad3bb3 100644 --- a/src/extras/Styles/Base/HandleStyleHelper.qml +++ b/src/controls/Styles/Base/HandleStyleHelper.qml diff --git a/src/extras/Styles/Base/PieMenuStyle.qml b/src/controls/Styles/Base/PieMenuStyle.qml index c7cd1dda..916a0c9e 100644 --- a/src/extras/Styles/Base/PieMenuStyle.qml +++ b/src/controls/Styles/Base/PieMenuStyle.qml @@ -36,18 +36,18 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 /*! \qmltype PieMenuStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for PieMenu. PieMenuStyle is a style for PieMenu that draws each section of the menu as a @@ -105,8 +105,6 @@ Style { id: pieMenuStyle /*! - \since 1.3 - The \l PieMenu that this style is attached to. */ readonly property PieMenu control: __control @@ -224,8 +222,6 @@ Style { property Component cancel: null /*! - \since QtQuick.Extras 1.1 - The component that displays the text of the currently selected menu item, or the title if there is no current item. @@ -260,7 +256,6 @@ Style { \li \c true if this menu item is under the mouse. \row \li \c {readonly property bool} \b styleData.pressed \li \c true if the mouse is pressed down on this menu item. - (since QtQuick.Extras 1.3) \endtable */ property Component menuItem: Item { diff --git a/src/extras/Styles/Base/StatusIndicatorStyle.qml b/src/controls/Styles/Base/StatusIndicatorStyle.qml index ddfd1b45..62ed1038 100644 --- a/src/extras/Styles/Base/StatusIndicatorStyle.qml +++ b/src/controls/Styles/Base/StatusIndicatorStyle.qml @@ -37,13 +37,13 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 /*! \qmltype StatusIndicatorStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.1 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for StatusIndicatorStyle. You can create a custom status indicator by defining the \l indicator @@ -54,15 +54,11 @@ Style { id: pieMenuStyle /*! - \since 1.3 - The \l StatusIndicator that this style is attached to. */ readonly property StatusIndicator control: __control /*! - \since 1.3 - The color that instances of \l {QtQuick.Extras::}{StatusIndicator} will have. The \l {QtQuick.Extras::StatusIndicator::}{color} diff --git a/src/extras/Styles/Base/ToggleButtonStyle.qml b/src/controls/Styles/Base/ToggleButtonStyle.qml index 507c0314..de06d72b 100644 --- a/src/extras/Styles/Base/ToggleButtonStyle.qml +++ b/src/controls/Styles/Base/ToggleButtonStyle.qml @@ -36,17 +36,16 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 /*! \qmltype ToggleButtonStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.0 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for ToggleButton. You can create a custom toggle button by replacing the same delegates that @@ -57,8 +56,6 @@ CircularButtonStyle { id: circularButtonStyle /*! - \since 1.3 - The \l ToggleButton that this style is attached to. */ readonly property ToggleButton control: __control diff --git a/src/extras/Styles/Base/TumblerStyle.qml b/src/controls/Styles/Base/TumblerStyle.qml index 3ebcb7a2..2661837e 100644 --- a/src/extras/Styles/Base/TumblerStyle.qml +++ b/src/controls/Styles/Base/TumblerStyle.qml @@ -36,17 +36,17 @@ import QtQuick 2.0 import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype TumblerStyle - \inqmlmodule QtQuick.Extras.Styles - \since QtQuick.Extras.Styles 1.2 - \ingroup extrasstyles + \inqmlmodule QtQuick.Controls.Styles + \since 5.5 + \ingroup controlsstyling \brief Provides custom styling for Tumbler. \note TumblerStyle requires Qt 5.3.2 or later. @@ -71,8 +71,6 @@ Style { padding.bottom: __padding /*! - \since 1.3 - The \l Tumbler that this style is attached to. */ readonly property Tumbler control: __control diff --git a/src/extras/Styles/Base/images/knob.png b/src/controls/Styles/Base/images/knob.png Binary files differindex ecac4d09..ecac4d09 100644 --- a/src/extras/Styles/Base/images/knob.png +++ b/src/controls/Styles/Base/images/knob.png diff --git a/src/extras/Styles/Base/images/needle.png b/src/controls/Styles/Base/images/needle.png Binary files differindex 8237e516..8237e516 100644 --- a/src/extras/Styles/Base/images/needle.png +++ b/src/controls/Styles/Base/images/needle.png diff --git a/src/controls/Styles/qmldir b/src/controls/Styles/qmldir index 582a7898..4b2f9844 100644 --- a/src/controls/Styles/qmldir +++ b/src/controls/Styles/qmldir @@ -20,4 +20,19 @@ TextAreaStyle 1.1 Base/TextAreaStyle.qml TextFieldStyle 1.0 Base/TextFieldStyle.qml ToolBarStyle 1.0 Base/ToolBarStyle.qml StatusBarStyle 1.0 Base/StatusBarStyle.qml + +CircularGaugeStyle 1.0 Base/CircularGaugeStyle.qml +CircularButtonStyle 1.0 Base/CircularButtonStyle.qml +CircularTickmarkLabelStyle 1.0 Base/CircularTickmarkLabelStyle.qml +CommonStyleHelper 1.0 Base/CommonStyleHelper.qml +DelayButtonStyle 1.0 Base/DelayButtonStyle.qml +DialStyle 1.1 Base/DialStyle.qml +GaugeStyle 1.0 Base/GaugeStyle.qml +HandleStyle 1.0 Base/HandleStyle.qml +HandleStyleHelper 1.0 Base/HandleStyleHelper.qml +PieMenuStyle 1.3 Base/PieMenuStyle.qml +StatusIndicatorStyle 1.1 Base/StatusIndicatorStyle.qml +ToggleButtonStyle 1.0 Base/ToggleButtonStyle.qml +TumblerStyle 1.2 Base/TumblerStyle.qml + designersupported diff --git a/src/controls/Styles/styles.pri b/src/controls/Styles/styles.pri index f91a9d1a..eaad43ea 100644 --- a/src/controls/Styles/styles.pri +++ b/src/controls/Styles/styles.pri @@ -27,6 +27,22 @@ STYLES_QML_FILES = \ $$PWD/Base/ToolBarStyle.qml \ $$PWD/Base/ToolButtonStyle.qml +# Extras +STYLES_QML_FILES += \ + $$PWD/Base/CircularGaugeStyle.qml \ + $$PWD/Base/CircularButtonStyle.qml \ + $$PWD/Base/CircularTickmarkLabelStyle.qml \ + $$PWD/Base/CommonStyleHelper.qml \ + $$PWD/Base/DelayButtonStyle.qml \ + $$PWD/Base/DialStyle.qml \ + $$PWD/Base/GaugeStyle.qml \ + $$PWD/Base/HandleStyle.qml \ + $$PWD/Base/HandleStyleHelper.qml \ + $$PWD/Base/PieMenuStyle.qml \ + $$PWD/Base/StatusIndicatorStyle.qml \ + $$PWD/Base/ToggleButtonStyle.qml \ + $$PWD/Base/TumblerStyle.qml + # Desktop !no_desktop { STYLES_QML_FILES += \ @@ -88,7 +104,9 @@ STYLES_QML_FILES += \ $$PWD/Base/images/spinner_medium.png \ $$PWD/Base/images/spinner_large.png \ $$PWD/Base/images/check.png \ - $$PWD/Base/images/check@2x.png + $$PWD/Base/images/check@2x.png \ + $$PWD/Base/images/knob.png \ + $$PWD/Base/images/needle.png STYLES_QML_FILES += $$PWD/qmldir diff --git a/src/controls/Switch.qml b/src/controls/Switch.qml index abfb79b0..d416b7f3 100644 --- a/src/controls/Switch.qml +++ b/src/controls/Switch.qml @@ -159,5 +159,5 @@ Control { \codeline Qt.createComponent("path/to/style.qml", switchId); */ - style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", root) + style: Settings.styleComponent(Settings.style, "SwitchStyle.qml", root) } diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index ebab068a..ea8bf4bd 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -176,7 +176,7 @@ FocusScope { property ListModel __tabs: ListModel { } /*! \internal */ - property Component style: Qt.createComponent(Settings.style + "/TabViewStyle.qml", root) + property Component style: Settings.styleComponent(Settings.style, "TabViewStyle.qml", root) /*! \internal */ property var __styleItem: loader.item diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 198ec3c7..e4357739 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -281,7 +281,7 @@ BasicTableView { onModelChanged: selection.clear() - style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root) + style: Settings.styleComponent(Settings.style, "TableViewStyle.qml", root) Accessible.role: Accessible.Table diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 0199cc81..c141f9e2 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -695,7 +695,7 @@ ScrollView { Accessible.role: Accessible.EditableText - style: Qt.createComponent(Settings.style + "/TextAreaStyle.qml", area) + style: Settings.styleComponent(Settings.style, "TextAreaStyle.qml", area) /*! \qmlproperty TextDocument TextArea::textDocument diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 078fee2d..db42cfb7 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -611,7 +611,7 @@ Control { /*! \internal */ property alias __baselineOffset: textInput.baselineOffset - style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput) + style: Settings.styleComponent(Settings.style, "TextFieldStyle.qml", textInput) activeFocusOnTab: true diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index 796d25dd..48f62f16 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -100,7 +100,7 @@ FocusScope { + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0) /*! \internal */ - property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar) + property Component style: Settings.styleComponent(Settings.style, "ToolBarStyle.qml", toolbar) /*! \internal */ property alias __style: styleLoader.item diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index e98f7ffd..a9904e11 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -80,5 +80,5 @@ import QtQuick.Controls.Private 1.0 Button { id: button - style: Qt.createComponent(Settings.style + "/ToolButtonStyle.qml", button) + style: Settings.styleComponent(Settings.style, "ToolButtonStyle.qml", button) } diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml index 8aaf3bbf..f1175b72 100644 --- a/src/controls/TreeView.qml +++ b/src/controls/TreeView.qml @@ -252,7 +252,7 @@ BasicTableView { modelAdaptor.expand(index) } - style: Qt.createComponent(Settings.style + "/TreeViewStyle.qml", root) + style: Settings.styleComponent(Settings.style, "TreeViewStyle.qml", root) // Internal stuff. Do not look diff --git a/src/controls/controls.pro b/src/controls/controls.pro index 151ccb4b..7261b5c6 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -43,6 +43,8 @@ QML_FILES += $$CONTROLS_QML_FILES SOURCES += $$PWD/plugin.cpp HEADERS += $$PWD/plugin.h +OTHER_FILES += doc/src/* + include(plugin.pri) include(Private/private.pri) include(Styles/styles.pri) diff --git a/src/extras/doc/images/circulargauge-angles.png b/src/controls/doc/images/circulargauge-angles.png Binary files differindex fb93bcaa..fb93bcaa 100644 --- a/src/extras/doc/images/circulargauge-angles.png +++ b/src/controls/doc/images/circulargauge-angles.png diff --git a/src/extras/doc/images/circulargauge-needle-example-2.png b/src/controls/doc/images/circulargauge-needle-example-2.png Binary files differindex a2b5f322..a2b5f322 100644 --- a/src/extras/doc/images/circulargauge-needle-example-2.png +++ b/src/controls/doc/images/circulargauge-needle-example-2.png diff --git a/src/extras/doc/images/circulargauge-needle.png b/src/controls/doc/images/circulargauge-needle.png Binary files differindex b2780b41..b2780b41 100644 --- a/src/extras/doc/images/circulargauge-needle.png +++ b/src/controls/doc/images/circulargauge-needle.png diff --git a/src/extras/doc/images/circulargauge-reversed.png b/src/controls/doc/images/circulargauge-reversed.png Binary files differindex aeadfbcc..aeadfbcc 100644 --- a/src/extras/doc/images/circulargauge-reversed.png +++ b/src/controls/doc/images/circulargauge-reversed.png diff --git a/src/extras/doc/images/circulargauge-tickmark-indices-values.png b/src/controls/doc/images/circulargauge-tickmark-indices-values.png Binary files differindex d117f483..d117f483 100644 --- a/src/extras/doc/images/circulargauge-tickmark-indices-values.png +++ b/src/controls/doc/images/circulargauge-tickmark-indices-values.png diff --git a/src/extras/doc/images/gauge-minorTickmark-example.png b/src/controls/doc/images/gauge-minorTickmark-example.png Binary files differindex 591120d6..591120d6 100644 --- a/src/extras/doc/images/gauge-minorTickmark-example.png +++ b/src/controls/doc/images/gauge-minorTickmark-example.png diff --git a/src/extras/doc/images/gauge-temperature.png b/src/controls/doc/images/gauge-temperature.png Binary files differindex 95fc1679..95fc1679 100644 --- a/src/extras/doc/images/gauge-temperature.png +++ b/src/controls/doc/images/gauge-temperature.png diff --git a/src/extras/doc/images/gauge-tickmark-example.png b/src/controls/doc/images/gauge-tickmark-example.png Binary files differindex c46fb8a5..c46fb8a5 100644 --- a/src/extras/doc/images/gauge-tickmark-example.png +++ b/src/controls/doc/images/gauge-tickmark-example.png diff --git a/src/extras/doc/images/piemenu-menuitem-example.png b/src/controls/doc/images/piemenu-menuitem-example.png Binary files differindex 57a2f956..57a2f956 100644 --- a/src/extras/doc/images/piemenu-menuitem-example.png +++ b/src/controls/doc/images/piemenu-menuitem-example.png diff --git a/src/extras/doc/images/styling-circulargauge-background-example.png b/src/controls/doc/images/styling-circulargauge-background-example.png Binary files differindex e816c6f6..e816c6f6 100644 --- a/src/extras/doc/images/styling-circulargauge-background-example.png +++ b/src/controls/doc/images/styling-circulargauge-background-example.png diff --git a/src/extras/doc/images/styling-circulargauge-knob-example.png b/src/controls/doc/images/styling-circulargauge-knob-example.png Binary files differindex 793a36c2..793a36c2 100644 --- a/src/extras/doc/images/styling-circulargauge-knob-example.png +++ b/src/controls/doc/images/styling-circulargauge-knob-example.png diff --git a/src/extras/doc/images/styling-circulargauge-minorTickmark-example.png b/src/controls/doc/images/styling-circulargauge-minorTickmark-example.png Binary files differindex f3f2d8d7..f3f2d8d7 100644 --- a/src/extras/doc/images/styling-circulargauge-minorTickmark-example.png +++ b/src/controls/doc/images/styling-circulargauge-minorTickmark-example.png diff --git a/src/extras/doc/images/styling-circulargauge-needle-example.png b/src/controls/doc/images/styling-circulargauge-needle-example.png Binary files differindex 08049fc9..08049fc9 100644 --- a/src/extras/doc/images/styling-circulargauge-needle-example.png +++ b/src/controls/doc/images/styling-circulargauge-needle-example.png diff --git a/src/extras/doc/images/styling-circulargauge-tickmark-example.png b/src/controls/doc/images/styling-circulargauge-tickmark-example.png Binary files differindex 01c71cd1..01c71cd1 100644 --- a/src/extras/doc/images/styling-circulargauge-tickmark-example.png +++ b/src/controls/doc/images/styling-circulargauge-tickmark-example.png diff --git a/src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.png b/src/controls/doc/images/styling-circulargauge-tickmarkLabel-example.png Binary files differindex 7520827e..7520827e 100644 --- a/src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.png +++ b/src/controls/doc/images/styling-circulargauge-tickmarkLabel-example.png diff --git a/src/extras/doc/images/styling-gauge-font-size.png b/src/controls/doc/images/styling-gauge-font-size.png Binary files differindex 97d7ebb2..97d7ebb2 100644 --- a/src/extras/doc/images/styling-gauge-font-size.png +++ b/src/controls/doc/images/styling-gauge-font-size.png diff --git a/src/extras/doc/images/styling-gauge-foreground.png b/src/controls/doc/images/styling-gauge-foreground.png Binary files differindex 5a4f65b9..5a4f65b9 100644 --- a/src/extras/doc/images/styling-gauge-foreground.png +++ b/src/controls/doc/images/styling-gauge-foreground.png diff --git a/src/extras/doc/images/styling-gauge-minorTickmark.png b/src/controls/doc/images/styling-gauge-minorTickmark.png Binary files differindex 34e36192..34e36192 100644 --- a/src/extras/doc/images/styling-gauge-minorTickmark.png +++ b/src/controls/doc/images/styling-gauge-minorTickmark.png diff --git a/src/extras/doc/images/styling-gauge-tickmark.png b/src/controls/doc/images/styling-gauge-tickmark.png Binary files differindex 1cd4fb8b..1cd4fb8b 100644 --- a/src/extras/doc/images/styling-gauge-tickmark.png +++ b/src/controls/doc/images/styling-gauge-tickmark.png diff --git a/src/extras/doc/images/styling-gauge-valueBar.png b/src/controls/doc/images/styling-gauge-valueBar.png Binary files differindex 581b8240..581b8240 100644 --- a/src/extras/doc/images/styling-gauge-valueBar.png +++ b/src/controls/doc/images/styling-gauge-valueBar.png diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index 6b4b14c7..8d41247e 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -28,12 +28,13 @@ qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.title = Qt Quick Cont qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.indexTitle = Qt Quick Controls Styles Structure qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.type = manual -depends = qtqml qtquick qtgui qtwidgets qtdoc qtquicklayouts qtquickdialogs qtcore +depends = qtcore qtdoc qtgui qtwidgets qtqml qtquick qtquicklayouts qtquickdialogs qtquickextras # Specify the install path under QT_INSTALL_EXAMPLES # Examples will be installed under quick/controls - 'controls' subdirectory # is given as part of \example commands -exampledirs += ../../../examples/quick/controls +exampledirs += ../../../examples/quick/controls \ + snippets examplesinstallpath = quick/controls headerdirs += ../ \ @@ -54,7 +55,8 @@ sources += ../Private/AbstractCheckable.qml \ ../Private/qquickabstractstyle.h \ ../Private/qquickabstractstyle.cpp -imagedirs += images +imagedirs += images \ + ../../extras/doc/images navigation.landingpage = "Qt Quick Controls" navigation.qmltypespage = "Qt Quick Controls QML Types" diff --git a/src/extras/doc/snippets/circulargauge-background-range.qml b/src/controls/doc/snippets/circulargauge-background-range.qml index 619fc465..f218e916 100644 --- a/src/extras/doc/snippets/circulargauge-background-range.qml +++ b/src/controls/doc/snippets/circulargauge-background-range.qml @@ -27,9 +27,9 @@ //! [range] import QtQuick 2.0 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 Rectangle { diff --git a/src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml b/src/controls/doc/snippets/circulargauge-tickmark-indices-values.qml index 33781baa..d3afd6f4 100644 --- a/src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml +++ b/src/controls/doc/snippets/circulargauge-tickmark-indices-values.qml @@ -27,8 +27,8 @@ //! [tickmarks] import QtQuick 2.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 Rectangle { width: 400 diff --git a/src/extras/doc/snippets/styling-gauge.qml b/src/controls/doc/snippets/styling-gauge.qml index 48cb95ed..e999832b 100644 --- a/src/extras/doc/snippets/styling-gauge.qml +++ b/src/controls/doc/snippets/styling-gauge.qml @@ -27,9 +27,9 @@ //! [all] import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 Rectangle { width: 100 diff --git a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc index d9c813e4..59951190 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc @@ -48,6 +48,11 @@ \internal */ +/*! + \group stylingtutorials + \title Styling Tutorials +*/ + /*! \page qtquickcontrolsstyles-index.html @@ -66,12 +71,48 @@ import QtQuick.Controls.Styles 1.4 \endcode + \section1 Styles + + \section2 Base Style + + The Base Style is the default style used when none is specified. It is also + used as a fallback when the specified style cannot be found. + + \image tumbler.png + \caption The Base Style Tumbler. + + \section2 Flat Style + + The Flat Style is designed for touch devices. + + \image tumbler-flat-style.png + \caption The Flat Style Tumbler. + + \section2 Selecting Styles + + You can apply a different style to the controls by setting the + \e QT_QUICK_CONTROLS_STYLE environment variable to the name of the style. + For example, to use the Flat style, you can do the following: + + \code + QT_QUICK_CONTROLS_STYLE=Flat ./app + \endcode + + This can also be done in C++, using qputenv(): + + \code + qputenv("QT_QUICK_CONTROLS_STYLE", "Flat"); + \endcode + \section1 Styling Views \annotatedlist viewsstyling \section1 Styling Controls \annotatedlist controlsstyling + \section1 Styling Tutorials + \annotatedlist stylingtutorials + \section1 Related information \list diff --git a/src/extras/doc/src/styling-circulargauge.qdoc b/src/controls/doc/src/styling-circulargauge.qdoc index 9cf94087..e0260db4 100644 --- a/src/extras/doc/src/styling-circulargauge.qdoc +++ b/src/controls/doc/src/styling-circulargauge.qdoc @@ -29,12 +29,12 @@ \page styling-circulargauge.html \title Styling CircularGauge \brief Tutorial for styling CircularGauge. - \ingroup extrasstyling + \ingroup stylingtutorials \target styling-circulargauge-needle \section2 The Needle Component - The \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{needle} + The \l {QtQuick.Controls.Styles::CircularGaugeStyle::}{needle} component is rotated around the gauge to represent the current value. Starting from the default style, we'll add a very basic white needle: @@ -43,11 +43,11 @@ \image styling-circulargauge-needle-example.png - As mentioned in the documentation for \l {QtQuick.Extras.Styles::} + As mentioned in the documentation for \l {QtQuick.Controls.Styles::} {CircularGaugeStyle}, \c implicitWidth and \c implicitHeight properties need to be set. This is so that the needle can be positioned properly. We always scale items by the - \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{outerRadius} + \l {QtQuick.Controls.Styles::CircularGaugeStyle::}{outerRadius} property of the style, ensuring the control resizes gracefully. We offset the needle vertically so that its back sits beyond the knob. @@ -56,7 +56,7 @@ \section2 The Foreground Component We've now changed the needle, but the default knob is still there; let's - replace it. The \l {QtQuick.Extras.Styles::CircularGaugeStyle::} + replace it. The \l {QtQuick.Controls.Styles::CircularGaugeStyle::} {foreground} component defines the default knob, so we can specify our own by overriding it (note that we could also set it to \c null if we didn't want a foreground): @@ -130,7 +130,7 @@ Next, we do the drawing of the range using Canvas. We draw an arc between \c 80 and \c 100, using the - \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{valueToAngle()} + \l {QtQuick.Controls.Styles::CircularGaugeStyle::}{valueToAngle()} function provided by CircularGaugeStyle. Note that we subtract \c 90 degrees before converting to radians, as our origin is north and Canvas' is east. diff --git a/src/extras/doc/src/styling-gauge.qdoc b/src/controls/doc/src/styling-gauge.qdoc index accdd425..195cc4c8 100644 --- a/src/extras/doc/src/styling-gauge.qdoc +++ b/src/controls/doc/src/styling-gauge.qdoc @@ -29,7 +29,7 @@ \page styling-gauge.html \title Styling Gauge \brief Tutorial for styling the Gauge control. - \ingroup extrasstyling + \ingroup stylingtutorials As GaugeStyle's documentation adequately covers common use cases, this tutorial will cover a different scenario: one where the gauge's tickmarks @@ -38,7 +38,7 @@ \target styling-gauge-valueBar \section2 The Value Bar Component - The \l {QtQuick.Extras.Styles::GaugeStyle::}{valueBar} + The \l {QtQuick.Controls.Styles::GaugeStyle::}{valueBar} component is resized according to the gauge's value; if the value is low, the bar will be small, and vice versa. @@ -55,7 +55,7 @@ \target styling-gauge-foreground \section2 The Foreground Component - The \l {QtQuick.Extras.Styles::GaugeStyle::}{foreground} + The \l {QtQuick.Controls.Styles::GaugeStyle::}{foreground} component covers the full width and height of the value bar, even when the value bar is not at its highest. By default, the foreground component provides a "sheen". We'll choose to discard this, and leave it empty @@ -68,7 +68,7 @@ \target styling-gauge-tickmark \section2 The Tickmark Component - The \l {QtQuick.Extras.Styles::GaugeStyle::}{tickmark} + The \l {QtQuick.Controls.Styles::GaugeStyle::}{tickmark} component sits to the left or right of the value bar, depending on the control's \l {Gauge::tickmarkAlignment}{tickmarkAlignment}. In order to have the tickmarks cover the width of the value bar instead, we need to do @@ -103,7 +103,7 @@ \target styling-gauge-minorTickmark \section2 The Minor Tickmark Component - The \l {QtQuick.Extras.Styles::GaugeStyle::}{minorTickmark} + The \l {QtQuick.Controls.Styles::GaugeStyle::}{minorTickmark} component is almost identical to its larger counterpart, except that its width does not affect the layout of the gauge's components. We'll do similar adjustments to the ones in the previous section - the only diff --git a/src/extras/CircularGauge.qml b/src/extras/CircularGauge.qml index 7a91f8bf..426d6e49 100644 --- a/src/extras/CircularGauge.qml +++ b/src/extras/CircularGauge.qml @@ -36,15 +36,15 @@ import QtQuick 2.2 // Workaround for QTBUG-37751; we need this import for RangeModel, although we shouldn't. -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 import QtQuick.Extras.Private 1.0 -import QtQuick.Extras.Styles 1.3 /*! \qmltype CircularGauge \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-non-interactive \brief A gauge that displays a value within a range along an arc. @@ -58,9 +58,9 @@ import QtQuick.Extras.Styles 1.3 The minimum and maximum values displayable by the gauge can be set with the \l minimumValue and \l maximumValue properties. The angle at which these values are displayed can be set with the - \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{minimumValueAngle} and - \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{maximumValueAngle} properties of - \l {QtQuick.Extras.Styles::}{CircularGaugeStyle}. + \l {QtQuick.Controls.Styles::CircularGaugeStyle::}{minimumValueAngle} and + \l {QtQuick.Controls.Styles::CircularGaugeStyle::}{maximumValueAngle} properties of + \l {QtQuick.Controls.Styles::}{CircularGaugeStyle}. Example: \code @@ -89,13 +89,13 @@ import QtQuick.Extras.Styles 1.3 \endcode You can create a custom appearance for a CircularGauge by assigning a - \l {QtQuick.Extras.Styles::}{CircularGaugeStyle}. + \l {QtQuick.Controls.Styles::}{CircularGaugeStyle}. */ Control { id: circularGauge - style: Qt.createComponent(StyleSettings.style + "/CircularGaugeStyle.qml", circularGauge) + style: Settings.styleComponent(Settings.style, "CircularGaugeStyle.qml", circularGauge) /*! \qmlproperty real CircularGauge::minimumValue @@ -131,20 +131,18 @@ Control { property alias stepSize: range.stepSize /*! - \since 1.2 - This property determines whether or not the gauge displays tickmarks, minor tickmarks, and labels. For more fine-grained control over what is displayed, the following style components of - \l {QtQuick.Extras.Styles::}{CircularGaugeStyle} can be + \l {QtQuick.Controls.Styles::}{CircularGaugeStyle} can be used: \list - \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::tickmark}{tickmark} - \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::minorTickmark}{minorTickmark} - \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::tickmarkLabel}{tickmarkLabel} + \li \l {QtQuick.Controls.Styles::CircularGaugeStyle::tickmark}{tickmark} + \li \l {QtQuick.Controls.Styles::CircularGaugeStyle::minorTickmark}{minorTickmark} + \li \l {QtQuick.Controls.Styles::CircularGaugeStyle::tickmarkLabel}{tickmarkLabel} \endlist */ property bool tickmarksVisible: true diff --git a/src/extras/DelayButton.qml b/src/extras/DelayButton.qml index 7218d457..f855e90e 100644 --- a/src/extras/DelayButton.qml +++ b/src/extras/DelayButton.qml @@ -35,16 +35,15 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls.Private 1.0 /*! \qmltype DelayButton \inherits QtQuickControls::Button \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-interactive \brief A checkable button that triggers an action when held in long enough. @@ -68,13 +67,13 @@ import QtQuick.Extras.Private 1.0 A DelayButton after being activated You can create a custom appearance for a DelayButton by assigning a - \l {QtQuick.Extras.Styles::}{DelayButtonStyle}. + \l {QtQuick.Controls.Styles::}{DelayButtonStyle}. */ Button { id: root - style: Qt.createComponent(StyleSettings.style + "/DelayButtonStyle.qml", root) + style: Settings.styleComponent(Settings.style, "DelayButtonStyle.qml", root) /*! \qmlproperty real DelayButton::progress diff --git a/src/extras/Dial.qml b/src/extras/Dial.qml index aa1dc4d6..4454c90d 100644 --- a/src/extras/Dial.qml +++ b/src/extras/Dial.qml @@ -35,16 +35,16 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype Dial \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-interactive \brief A circular dial that is rotated to set a value. @@ -57,18 +57,18 @@ import QtQuick.Extras.Private 1.0 Like CircularGauge, Dial can display tickmarks to give an indication of the current value. When a suitable stepSize is combined with - \l {QtQuick.Extras.Styles::DialStyle::}{tickmarkStepSize}, + \l {QtQuick.Controls.Styles::DialStyle::}{tickmarkStepSize}, the dial "snaps" to each tickmark. You can create a custom appearance for a Dial by assigning a - \l {QtQuick.Extras.Styles::}{DialStyle}. + \l {QtQuick.Controls.Styles::}{DialStyle}. */ Control { id: dial activeFocusOnTab: true - style: Qt.createComponent(StyleSettings.style + "/DialStyle.qml", dial) + style: Settings.styleComponent(Settings.style, "DialStyle.qml", dial) /*! \qmlproperty real Dial::value @@ -144,19 +144,17 @@ Control { readonly property alias pressed: mouseArea.pressed /*! - \since QtQuick.Extras 1.1 - This property determines whether or not the dial displays tickmarks, minor tickmarks, and labels. For more fine-grained control over what is displayed, the following style components of - \l {QtQuick.Extras.Styles::}{DialStyle} can be used: + \l {QtQuick.Controls.Styles::}{DialStyle} can be used: \list - \li \l {QtQuick.Extras.Styles::DialStyle::tickmark}{tickmark} - \li \l {QtQuick.Extras.Styles::DialStyle::minorTickmark}{minorTickmark} - \li \l {QtQuick.Extras.Styles::DialStyle::tickmarkLabel}{tickmarkLabel} + \li \l {QtQuick.Controls.Styles::DialStyle::tickmark}{tickmark} + \li \l {QtQuick.Controls.Styles::DialStyle::minorTickmark}{minorTickmark} + \li \l {QtQuick.Controls.Styles::DialStyle::tickmarkLabel}{tickmarkLabel} \endlist The default value is \c true. diff --git a/src/extras/Gauge.qml b/src/extras/Gauge.qml index 1a845ee3..f5a0071e 100644 --- a/src/extras/Gauge.qml +++ b/src/extras/Gauge.qml @@ -35,16 +35,16 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype Gauge \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-non-interactive \brief A straight gauge that displays a value within a range. @@ -70,13 +70,13 @@ import QtQuick.Extras.Private 1.0 \endcode You can create a custom appearance for a Gauge by assigning a - \l {QtQuick.Extras.Styles::}{GaugeStyle}. + \l {QtQuick.Controls.Styles::}{GaugeStyle}. */ Control { id: gauge - style: Qt.createComponent(StyleSettings.style + "/GaugeStyle.qml", gauge) + style: Settings.styleComponent(Settings.style, "GaugeStyle.qml", gauge) /*! This property holds the smallest value displayed by the gauge. @@ -172,11 +172,9 @@ Control { property alias font: hiddenText.font /*! - \since QtQuick.Extras 1.3 - This property accepts a function that formats the given \a value for display in - \l {QtQuick.Extras.Styles::GaugeStyle}{tickmarkLabel}. + \l {QtQuick.Controls.Styles::GaugeStyle}{tickmarkLabel}. For example, to provide a custom format that displays all values with 3 decimal places: diff --git a/src/extras/PieMenu.qml b/src/extras/PieMenu.qml index 94b6d414..d667a9a8 100644 --- a/src/extras/PieMenu.qml +++ b/src/extras/PieMenu.qml @@ -35,17 +35,17 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 as CppUtils -import QtQuick.Extras.Styles 1.3 /*! \qmltype PieMenu \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-interactive \brief A popup menu that displays several menu items along an arc. @@ -147,19 +147,19 @@ import QtQuick.Extras.Styles 1.3 You can hide individual menu items by setting their visible property to \c false. Hiding items does not affect the - \l {QtQuick.Extras.Styles::PieMenuStyle::}{startAngle} or - \l {QtQuick.Extras.Styles::PieMenuStyle::}{endAngle}; the + \l {QtQuick.Controls.Styles::PieMenuStyle::}{startAngle} or + \l {QtQuick.Controls.Styles::PieMenuStyle::}{endAngle}; the remaining items will grow to consume the available space. You can create a custom appearance for a PieMenu by assigning a - \l {QtQuick.Extras.Styles::}{PieMenuStyle}. + \l {QtQuick.Controls.Styles::}{PieMenuStyle}. */ Control { id: pieMenu visible: false - style: Qt.createComponent(StyleSettings.style + "/PieMenuStyle.qml", pieMenu) + style: Settings.styleComponent(Settings.style, "PieMenuStyle.qml", pieMenu) /*! This property reflects the angle (in radians) created by the imaginary @@ -276,8 +276,6 @@ Control { readonly property alias currentItem: protectedScope.currentItem /*! - \since QtQuick.Extras 1.1 - This property defines the text that is shown above the menu when there is no current menu item (currentIndex is \c -1). @@ -286,8 +284,6 @@ Control { property string title: "" /*! - \since QtQuick.Extras 1.2 - The item which the menu must stay within. A typical use case for PieMenu involves: @@ -332,8 +328,6 @@ Control { } /*! - \since QtQuick.Extras 1.1 - \qmlmethod void addItem(string text) Adds an item to the end of the menu items. @@ -347,8 +341,6 @@ Control { } /*! - \since QtQuick.Extras 1.1 - \qmlmethod void insertItem(int before, string text) Inserts a MenuItem with \a text before the index at \a before. @@ -372,8 +364,6 @@ Control { } /*! - \since QtQuick.Extras 1.1 - \qmlmethod void removeItem(item) Removes \a item from the menu. diff --git a/src/extras/Private/CircularButton.qml b/src/extras/Private/CircularButton.qml index b2baf5a2..5c7f2b7e 100644 --- a/src/extras/Private/CircularButton.qml +++ b/src/extras/Private/CircularButton.qml @@ -35,15 +35,15 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 -import QtQuick.Extras.Styles 1.3 /*! \internal */ Button { id: button - style: Qt.createComponent(StyleSettings.style + "/CircularButtonStyle.qml", button) + style: Settings.styleComponent(Settings.style, "CircularButtonStyle.qml", button) } diff --git a/src/extras/Private/CircularButtonStyleHelper.qml b/src/extras/Private/CircularButtonStyleHelper.qml index fedd3a37..77bdc9ef 100644 --- a/src/extras/Private/CircularButtonStyleHelper.qml +++ b/src/extras/Private/CircularButtonStyleHelper.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 QtObject { diff --git a/src/extras/Private/CircularTickmarkLabel.qml b/src/extras/Private/CircularTickmarkLabel.qml index 05554878..0e45f7b9 100644 --- a/src/extras/Private/CircularTickmarkLabel.qml +++ b/src/extras/Private/CircularTickmarkLabel.qml @@ -38,12 +38,12 @@ import QtQuick 2.2 // Workaround for QTBUG-37751; we need this import for RangeModel, although we shouldn't. import QtQuick.Controls 1.1 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 Control { id: label - style: Qt.createComponent(StyleSettings.style + "/CircularTickmarkLabelStyle.qml", label) + style: Settings.styleComponent(Settings.style, "CircularTickmarkLabelStyle.qml", label) property alias minimumValue: range.minimumValue diff --git a/src/extras/Private/Handle.qml b/src/extras/Private/Handle.qml index 12e2804d..31b4543f 100644 --- a/src/extras/Private/Handle.qml +++ b/src/extras/Private/Handle.qml @@ -36,8 +36,8 @@ import QtQuick 2.0 import QtGraphicalEffects 1.0 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras.Styles 1.3 import QtQuick.Extras.Private 1.1 import QtQuick.Extras.Private.CppUtils 1.0 @@ -46,7 +46,7 @@ Control { x: handleArea.centerOfHandle.x - width / 2 y: handleArea.centerOfHandle.y - height / 2 - style: Qt.createComponent(StyleSettings.style + "/HandleStyle.qml", root) + style: Settings.styleComponent(Settings.style, "HandleStyle.qml", root) /*! The angle of the handle along the circumference of \l rotationRadius in diff --git a/src/extras/Private/PieMenuIcon.qml b/src/extras/Private/PieMenuIcon.qml index f54e035f..17304c94 100644 --- a/src/extras/Private/PieMenuIcon.qml +++ b/src/extras/Private/PieMenuIcon.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.3 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 diff --git a/src/extras/Private/private.pri b/src/extras/Private/private.pri index 4f394412..0e4f7a12 100644 --- a/src/extras/Private/private.pri +++ b/src/extras/Private/private.pri @@ -4,14 +4,12 @@ HEADERS += \ $$PWD/qquickcircularprogressbar_p.h \ $$PWD/qquickflatprogressbar_p.h \ $$PWD/qquickmousethief_p.h \ - $$PWD/qquickstylesettings_p.h \ $$PWD/qquickmathutils_p.h SOURCES += \ $$PWD/qquickcircularprogressbar.cpp \ $$PWD/qquickflatprogressbar.cpp \ $$PWD/qquickmousethief.cpp \ - $$PWD/qquickstylesettings.cpp \ $$PWD/qquickmathutils.cpp OTHER_FILES += \ diff --git a/src/extras/Private/qquickstylesettings.cpp b/src/extras/Private/qquickstylesettings.cpp deleted file mode 100644 index 0936e55e..00000000 --- a/src/extras/Private/qquickstylesettings.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Extras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickstylesettings_p.h" -#include <qqmlengine.h> -#include <qfileinfo.h> -#include <qdebug.h> -#include <qdir.h> - -QT_BEGIN_NAMESPACE - -static QString defaultStyleName() -{ - return QLatin1String("Base"); -} - -static QString styleImportName() -{ - QString name = qgetenv("QT_QUICK_CONTROLS_STYLE"); - if (name.isEmpty()) - name = defaultStyleName(); - return QFileInfo(name).fileName(); -} - -static bool isResource(const QString &path) -{ - return path.startsWith(":/"); -} - -static QString styleImportPath(QQmlEngine *engine, const QString &styleName) -{ - static const char * const stylePaths[] = { "/QtQuick/Extras/Styles", "/QtQuick/Controls/Styles" }; - QString path = qgetenv("QT_QUICK_CONTROLS_STYLE"); - QFileInfo info(path); - if (isResource(path)) { - path = info.path(); - } else if (info.isRelative()) { - bool found = false; - QStringList importPaths = engine->importPathList(); - importPaths.prepend(QStringLiteral(":/ExtrasImports/")); - - foreach (const QString &import, importPaths) { - for (unsigned i = 0; i < sizeof(stylePaths) / sizeof(stylePaths[0]); i++) { - QDir dir(import + QLatin1String(stylePaths[i])); - if (dir.exists(styleName)) { - found = true; - path = dir.absolutePath(); - break; - } - } - if (found) - break; - } - if (!found) - path = QLatin1String(":/ExtrasImports/QtQuick/Extras/Styles"); - } else { - path = info.absolutePath(); - } - return path; -} - -QQuickStyleSettings::QQuickStyleSettings(QQmlEngine *engine) -{ - m_name = styleImportName(); - m_path = styleImportPath(engine, m_name); - - QString path = styleFilePath(); - - if (!QDir(path).exists()) { - QString unknownStyle = m_name; - m_name = defaultStyleName(); - 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())); -} - -QUrl QQuickStyleSettings::style() const -{ - QUrl result; - QString path = styleFilePath(); - if (isResource(path)) { - result.setScheme("qrc"); - path.remove(0, 1); // remove ':' prefix - result.setPath(path); - } else - result = QUrl::fromLocalFile(path); - return result; -} - -QString QQuickStyleSettings::styleName() const -{ - return m_name; -} - -void QQuickStyleSettings::setStyleName(const QString &name) -{ - if (m_name != name) { - m_name = name; - emit styleNameChanged(); - } -} - -QString QQuickStyleSettings::stylePath() const -{ - return m_path; -} - -void QQuickStyleSettings::setStylePath(const QString &path) -{ - if (m_path != path) { - m_path = path; - emit stylePathChanged(); - } -} - -QString QQuickStyleSettings::styleFilePath() const -{ - return m_path + QLatin1Char('/') + m_name; -} - -QT_END_NAMESPACE diff --git a/src/extras/StatusIndicator.qml b/src/extras/StatusIndicator.qml index 8be50737..a49df496 100644 --- a/src/extras/StatusIndicator.qml +++ b/src/extras/StatusIndicator.qml @@ -35,15 +35,15 @@ ****************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 /*! \qmltype StatusIndicator \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.1 + \since 5.5 \ingroup extras \ingroup extras-non-interactive \brief An indicator that displays active or inactive states. @@ -65,7 +65,7 @@ import QtQuick.Extras.Private 1.0 \li \code import QtQuick 2.2 - import QtQuick.Extras 1.3 + import QtQuick.Extras 1.4 Rectangle { width: 100 @@ -82,13 +82,13 @@ import QtQuick.Extras.Private 1.0 \endtable You can create a custom appearance for a StatusIndicator by assigning a - \l {QtQuick.Extras.Styles::}{StatusIndicatorStyle}. + \l {QtQuick.Controls.Styles::}{StatusIndicatorStyle}. */ Control { id: statusIndicator - style: Qt.createComponent(StyleSettings.style + "/StatusIndicatorStyle.qml", statusIndicator) + style: Settings.styleComponent(Settings.style, "StatusIndicatorStyle.qml", statusIndicator) /*! This property specifies whether the indicator is active or inactive. @@ -100,8 +100,6 @@ Control { property alias on: statusIndicator.active /*! - \since QtQuick.Extras 1.2 - This property specifies whether the indicator is active or inactive. The default value is \c false (inactive). diff --git a/src/extras/Styles/Base/Base.pro b/src/extras/Styles/Base/Base.pro deleted file mode 100644 index fcb6ad95..00000000 --- a/src/extras/Styles/Base/Base.pro +++ /dev/null @@ -1,34 +0,0 @@ -TARGET = qtquickextrasstylesplugin -TARGETPATH = QtQuick/Extras/Styles - -QT += qml - -HEADERS += \ - basestyleplugin.h -SOURCES += \ - basestyleplugin.cpp - -BASE_STYLE = \ - $$PWD/CircularGaugeStyle.qml \ - $$PWD/CircularButtonStyle.qml \ - $$PWD/CircularTickmarkLabelStyle.qml \ - $$PWD/CommonStyleHelper.qml \ - $$PWD/DelayButtonStyle.qml \ - $$PWD/DialStyle.qml \ - $$PWD/GaugeStyle.qml \ - $$PWD/HandleStyle.qml \ - $$PWD/HandleStyleHelper.qml \ - $$PWD/PieMenuStyle.qml \ - $$PWD/StatusIndicatorStyle.qml \ - $$PWD/ToggleButtonStyle.qml \ - $$PWD/TumblerStyle.qml - -BASE_STYLE += \ - $$PWD/images/knob.png \ - $$PWD/images/needle.png - -RESOURCES += \ - basestyle.qrc - -CONFIG += no_cxx_module -load(qml_plugin) diff --git a/src/extras/Styles/Base/basestyle.qrc b/src/extras/Styles/Base/basestyle.qrc deleted file mode 100644 index 2bcf0328..00000000 --- a/src/extras/Styles/Base/basestyle.qrc +++ /dev/null @@ -1,19 +0,0 @@ -<RCC> - <qresource prefix="/ExtrasImports/QtQuick/Extras/Styles/Base"> - <file>TumblerStyle.qml</file> - <file>ToggleButtonStyle.qml</file> - <file>StatusIndicatorStyle.qml</file> - <file>PieMenuStyle.qml</file> - <file>HandleStyleHelper.qml</file> - <file>HandleStyle.qml</file> - <file>GaugeStyle.qml</file> - <file>DialStyle.qml</file> - <file>DelayButtonStyle.qml</file> - <file>CommonStyleHelper.qml</file> - <file>CircularTickmarkLabelStyle.qml</file> - <file>CircularGaugeStyle.qml</file> - <file>CircularButtonStyle.qml</file> - <file>images/needle.png</file> - <file>images/knob.png</file> - </qresource> -</RCC> diff --git a/src/extras/Styles/Base/basestyleplugin.cpp b/src/extras/Styles/Base/basestyleplugin.cpp deleted file mode 100644 index ef894910..00000000 --- a/src/extras/Styles/Base/basestyleplugin.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Extras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "basestyleplugin.h" - -QT_BEGIN_NAMESPACE - -QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) : - QQmlExtensionPlugin(parent) -{ -} - -void QtQuickExtrasStylesPlugin::registerTypes(const char *uri) -{ - Q_INIT_RESOURCE(basestyle); - const QString prefix = "qrc:/ExtrasImports/QtQuick/Extras/Styles"; - // register version 1.0 - qmlRegisterType(QUrl(prefix + "/Base/CircularButtonStyle.qml"), uri, 1, 0, "CircularButtonStyle"); - qmlRegisterType(QUrl(prefix + "/Base/CircularGaugeStyle.qml"), uri, 1, 0, "CircularGaugeStyle"); - qmlRegisterType(QUrl(prefix + "/Base/CircularTickmarkLabelStyle.qml"), uri, 1, 0, "CircularTickmarkLabelStyle"); - qmlRegisterType(QUrl(prefix + "/Base/CommonStyleHelper.qml"), uri, 1, 0, "CommonStyleHelper"); - qmlRegisterType(QUrl(prefix + "/Base/DelayButtonStyle.qml"), uri, 1, 0, "DelayButtonStyle"); - qmlRegisterType(QUrl(prefix + "/Base/DialStyle.qml"), uri, 1, 0, "DialStyle"); - qmlRegisterType(QUrl(prefix + "/Base/GaugeStyle.qml"), uri, 1, 0, "GaugeStyle"); - qmlRegisterType(QUrl(prefix + "/Base/HandleStyleHelper.qml"), uri, 1, 0, "HandleStyleHelper"); - qmlRegisterType(QUrl(prefix + "/Base/HandleStyle.qml"), uri, 1, 0, "HandleStyle"); - qmlRegisterType(QUrl(prefix + "/Base/PieMenuStyle.qml"), uri, 1, 0, "PieMenuStyle"); - qmlRegisterType(QUrl(prefix + "/Base/ToggleButtonStyle.qml"), uri, 1, 0, "ToggleButtonStyle"); - // register version 1.1 - qmlRegisterType(QUrl(prefix + "/Base/DialStyle.qml"), uri, 1, 1, "DialStyle"); - qmlRegisterType(QUrl(prefix + "/Base/StatusIndicatorStyle.qml"), uri, 1, 1, "StatusIndicatorStyle"); - // register version 1.2 - qmlRegisterType(QUrl(prefix + "/Base/TumblerStyle.qml"), uri, 1, 2, "TumblerStyle"); - // register version 1.3 - qmlRegisterType(QUrl(prefix + "/Base/PieMenuStyle.qml"), uri, 1, 3, "PieMenuStyle"); -} - -QT_END_NAMESPACE diff --git a/src/extras/Styles/Base/qmldir b/src/extras/Styles/Base/qmldir deleted file mode 100644 index 509cd05c..00000000 --- a/src/extras/Styles/Base/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtQuick.Extras.Styles -plugin qtquickextrasstylesplugin -classname QtQuickExtrasStylesPlugin -depends QtGraphicalEffects 1.0 diff --git a/src/extras/Styles/Flat/ApplicationWindowStyle.qml b/src/extras/Styles/Flat/ApplicationWindowStyle.qml index 8ae620b0..248e39d4 100644 --- a/src/extras/Styles/Flat/ApplicationWindowStyle.qml +++ b/src/extras/Styles/Flat/ApplicationWindowStyle.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.3 as Base +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 Base.ApplicationWindowStyle { diff --git a/src/extras/Styles/Flat/CalendarStyle.qml b/src/extras/Styles/Flat/CalendarStyle.qml index b41e3c8e..7c42507a 100644 --- a/src/extras/Styles/Flat/CalendarStyle.qml +++ b/src/extras/Styles/Flat/CalendarStyle.qml @@ -39,7 +39,7 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 diff --git a/src/extras/Styles/Flat/CircularButtonStyle.qml b/src/extras/Styles/Flat/CircularButtonStyle.qml index 774870e6..def48daa 100644 --- a/src/extras/Styles/Flat/CircularButtonStyle.qml +++ b/src/extras/Styles/Flat/CircularButtonStyle.qml @@ -33,6 +33,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick.Extras.Styles 1.3 as Base +import QtQuick.Controls.Styles 1.4 as Base Base.CircularButtonStyle { } diff --git a/src/extras/Styles/Flat/CircularGaugeStyle.qml b/src/extras/Styles/Flat/CircularGaugeStyle.qml index d18cdea5..cd6d7f1b 100644 --- a/src/extras/Styles/Flat/CircularGaugeStyle.qml +++ b/src/extras/Styles/Flat/CircularGaugeStyle.qml @@ -35,10 +35,10 @@ ****************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.1 -import QtQuick.Extras.Styles 1.3 as Base Base.CircularGaugeStyle { id: circularGaugeStyle diff --git a/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml index 8127608b..4e6649e7 100644 --- a/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml +++ b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml @@ -34,6 +34,6 @@ ** ****************************************************************************/ -import QtQuick.Extras.Styles 1.3 as Base +import QtQuick.Controls.Styles 1.4 as Base Base.CircularTickmarkLabelStyle {} diff --git a/src/extras/Styles/Flat/DelayButtonStyle.qml b/src/extras/Styles/Flat/DelayButtonStyle.qml index 2e438497..619cc19b 100644 --- a/src/extras/Styles/Flat/DelayButtonStyle.qml +++ b/src/extras/Styles/Flat/DelayButtonStyle.qml @@ -35,10 +35,10 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras.Styles 1.1 as Base import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.1 diff --git a/src/extras/Styles/Flat/DialStyle.qml b/src/extras/Styles/Flat/DialStyle.qml index 3e841d9b..ebc53f0a 100644 --- a/src/extras/Styles/Flat/DialStyle.qml +++ b/src/extras/Styles/Flat/DialStyle.qml @@ -35,11 +35,11 @@ ****************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.1 -import QtQuick.Extras.Styles 1.3 as Base Base.DialStyle { id: dialStyle diff --git a/src/extras/Styles/Flat/GaugeStyle.qml b/src/extras/Styles/Flat/GaugeStyle.qml index d5bf986b..8378571b 100644 --- a/src/extras/Styles/Flat/GaugeStyle.qml +++ b/src/extras/Styles/Flat/GaugeStyle.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 -import QtQuick.Extras.Styles 1.3 as Base import QtQuick.Extras.Private 1.0 Base.GaugeStyle { diff --git a/src/extras/Styles/Flat/PieMenuStyle.qml b/src/extras/Styles/Flat/PieMenuStyle.qml index 9b314610..10d3fa28 100644 --- a/src/extras/Styles/Flat/PieMenuStyle.qml +++ b/src/extras/Styles/Flat/PieMenuStyle.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.3 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 -import QtQuick.Extras.Styles 1.3 as Base import QtQuick.Extras.Private 1.0 Base.PieMenuStyle { diff --git a/src/extras/Styles/Flat/ProgressBarStyle.qml b/src/extras/Styles/Flat/ProgressBarStyle.qml index f0b5bdd4..bf2b0ef6 100644 --- a/src/extras/Styles/Flat/ProgressBarStyle.qml +++ b/src/extras/Styles/Flat/ProgressBarStyle.qml @@ -39,7 +39,7 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private.CppUtils 1.1 Base.ProgressBarStyle { diff --git a/src/extras/Styles/Flat/RadioButtonStyle.qml b/src/extras/Styles/Flat/RadioButtonStyle.qml index 779e8636..5061697d 100644 --- a/src/extras/Styles/Flat/RadioButtonStyle.qml +++ b/src/extras/Styles/Flat/RadioButtonStyle.qml @@ -38,7 +38,7 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Base.RadioButtonStyle { spacing: Math.round(8 * FlatStyle.scaleFactor) diff --git a/src/extras/Styles/Flat/SliderStyle.qml b/src/extras/Styles/Flat/SliderStyle.qml index 191612c5..779ac1b6 100644 --- a/src/extras/Styles/Flat/SliderStyle.qml +++ b/src/extras/Styles/Flat/SliderStyle.qml @@ -39,7 +39,7 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 Base.SliderStyle { diff --git a/src/extras/Styles/Flat/StatusIndicatorStyle.qml b/src/extras/Styles/Flat/StatusIndicatorStyle.qml index fb527665..1c1c6bea 100644 --- a/src/extras/Styles/Flat/StatusIndicatorStyle.qml +++ b/src/extras/Styles/Flat/StatusIndicatorStyle.qml @@ -35,10 +35,10 @@ ****************************************************************************/ import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 -import QtQuick.Extras.Styles 1.3 as Base import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 diff --git a/src/extras/Styles/Flat/ToggleButtonStyle.qml b/src/extras/Styles/Flat/ToggleButtonStyle.qml index 5cbb0a5d..8c5315af 100644 --- a/src/extras/Styles/Flat/ToggleButtonStyle.qml +++ b/src/extras/Styles/Flat/ToggleButtonStyle.qml @@ -35,12 +35,12 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Styles.Flat 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 -import QtQuick.Extras.Styles 1.3 as Base Base.ToggleButtonStyle { label: Label { diff --git a/src/extras/Styles/Flat/TumblerStyle.qml b/src/extras/Styles/Flat/TumblerStyle.qml index cede9fee..3be7f6a0 100644 --- a/src/extras/Styles/Flat/TumblerStyle.qml +++ b/src/extras/Styles/Flat/TumblerStyle.qml @@ -35,10 +35,10 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 as Base import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Styles.Flat 1.0 -import QtQuick.Extras.Styles 1.3 as Base Base.TumblerStyle { id: tumblerStyle diff --git a/src/extras/Styles/Flat/flatstyleplugin.cpp b/src/extras/Styles/Flat/flatstyleplugin.cpp index e3bffd5c..db464c38 100644 --- a/src/extras/Styles/Flat/flatstyleplugin.cpp +++ b/src/extras/Styles/Flat/flatstyleplugin.cpp @@ -56,7 +56,7 @@ extern "C" { Q_DECL_EXPORT const char* qt_quick_controls_style_path() { - return "qrc:/ExtrasImports/QtQuick/Controls/Styles/"; + return ":/ExtrasImports/QtQuick/Controls/Styles/Flat"; } } diff --git a/src/extras/Styles/styles.pro b/src/extras/Styles/styles.pro index 8f05bcd0..5e1a1633 100644 --- a/src/extras/Styles/styles.pro +++ b/src/extras/Styles/styles.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += Base \ +SUBDIRS += \ Flat diff --git a/src/extras/ToggleButton.qml b/src/extras/ToggleButton.qml index 8e0d313e..ca08e36f 100644 --- a/src/extras/ToggleButton.qml +++ b/src/extras/ToggleButton.qml @@ -35,15 +35,14 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls.Private 1.0 /*! \qmltype ToggleButton \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.0 + \since 5.5 \ingroup extras \ingroup extras-interactive \brief A push button that toggles between two states. @@ -59,11 +58,11 @@ import QtQuick.Extras.Private 1.0 placing color-coded indicators around the button. You can create a custom appearance for a ToggleButton by assigning a - \l {QtQuick.Extras.Styles::}{ToggleButtonStyle}. + \l {QtQuick.Controls.Styles::}{ToggleButtonStyle}. */ Button { id: button checkable: true - style: Qt.createComponent(StyleSettings.style + "/ToggleButtonStyle.qml", button) + style: Settings.styleComponent(Settings.style, "ToggleButtonStyle.qml", button) } diff --git a/src/extras/Tumbler.qml b/src/extras/Tumbler.qml index cdf21c4d..561515b2 100644 --- a/src/extras/Tumbler.qml +++ b/src/extras/Tumbler.qml @@ -35,17 +35,17 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Private 1.0 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 -import QtQuick.Extras.Styles 1.3 import QtQuick.Layouts 1.0 /*! \qmltype Tumbler \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.2 + \since 5.5 \ingroup extras \ingroup extras-interactive \brief A control that can have several spinnable wheels, each with items @@ -53,7 +53,7 @@ import QtQuick.Layouts 1.0 \image tumbler.png A Tumbler - \note Tumbler requires Qt 5.3.2 or later. + \note Tumbler requires Qt 5.5.0 or later. The Tumbler control is used with one or more TumblerColumn items, which define the content of each column: @@ -67,7 +67,7 @@ import QtQuick.Layouts 1.0 model: [0, 1, 2, 3, 4] } TumblerColumn { - model: ["A", "B", "C", "D", "E] + model: ["A", "B", "C", "D", "E"] } } \endcode @@ -122,13 +122,13 @@ import QtQuick.Layouts 1.0 \section1 Limitations For technical reasons, the model count must be equal to or greater than - \l {QtQuick.Extras.Styles::TumblerStyle}{visibleItemCount} + \l {QtQuick.Controls.Styles::TumblerStyle}{visibleItemCount} plus one. The - \l {QtQuick.Extras.Styles::TumblerStyle::}{visibleItemCount} + \l {QtQuick.Controls.Styles::TumblerStyle::}{visibleItemCount} must also be an odd number. You can create a custom appearance for a Tumbler by assigning a - \l {QtQuick.Extras.Styles::}{TumblerStyle}. To style + \l {QtQuick.Controls.Styles::}{TumblerStyle}. To style individual columns, use the \l {TumblerColumn::delegate}{delegate} and \l {TumblerColumn::highlight}{highlight} properties of TumblerColumn. */ @@ -136,7 +136,7 @@ import QtQuick.Layouts 1.0 Control { id: tumbler - style: Qt.createComponent(StyleSettings.style + "/TumblerStyle.qml", tumbler) + style: Settings.styleComponent(Settings.style, "TumblerStyle.qml", tumbler) ListModel { id: columnModel diff --git a/src/extras/TumblerColumn.qml b/src/extras/TumblerColumn.qml index 95bcae85..481f0869 100644 --- a/src/extras/TumblerColumn.qml +++ b/src/extras/TumblerColumn.qml @@ -35,17 +35,17 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 import QtQuick.Controls.Private 1.0 /*! \qmltype TumblerColumn \inqmlmodule QtQuick.Extras - \since QtQuick.Extras 1.2 + \since 5.5 \ingroup extras \brief A column within a tumbler. - \note TumblerColumn requires Qt 5.3.2 or later. + \note TumblerColumn requires Qt 5.5.0 or later. TumblerColumn represents a column within a tumbler, providing the interface to define the items and width of each column. @@ -64,7 +64,7 @@ import QtQuick.Controls.Private 1.0 \endcode You can create a custom appearance for a Tumbler by assigning a - \l {QtQuick.Extras.Styles::}{TumblerStyle}. + \l {QtQuick.Controls.Styles::}{TumblerStyle}. */ QtObject { @@ -116,8 +116,8 @@ QtObject { If set, this delegate will be used to display items in this column, instead of the - \l {QtQuick.Extras.Styles::TumblerStyle::delegate}{delegate} - property in \l {QtQuick.Extras.Styles::}{TumblerStyle}. + \l {QtQuick.Controls.Styles::TumblerStyle::delegate}{delegate} + property in \l {QtQuick.Controls.Styles::}{TumblerStyle}. The \l {Item::implicitHeight}{implicitHeight} property must be set, and it must be the same for each delegate. @@ -129,8 +129,8 @@ QtObject { If set, this highlight will be used to display the highlight in this column, instead of the - \l {QtQuick.Extras.Styles::TumblerStyle::highlight}{highlight} - property in \l {QtQuick.Extras.Styles::}{TumblerStyle}. + \l {QtQuick.Controls.Styles::TumblerStyle::highlight}{highlight} + property in \l {QtQuick.Controls.Styles::}{TumblerStyle}. */ property Component highlight @@ -139,8 +139,8 @@ QtObject { If set, this component will be used to display the foreground in this column, instead of the - \l {QtQuick.Extras.Styles::TumblerStyle::columnForeground}{columnForeground} - property in \l {QtQuick.Extras.Styles::}{TumblerStyle}. + \l {QtQuick.Controls.Styles::TumblerStyle::columnForeground}{columnForeground} + property in \l {QtQuick.Controls.Styles::}{TumblerStyle}. */ property Component columnForeground diff --git a/src/extras/doc/compat/qtquickextras.qdocconf b/src/extras/doc/compat/qtquickextras.qdocconf deleted file mode 100644 index d36fd909..00000000 --- a/src/extras/doc/compat/qtquickextras.qdocconf +++ /dev/null @@ -1,5 +0,0 @@ -include(../qtquickextras-compat.qdocconf) - -# Workaround for qdoc not parsing relative include paths correctly -exampledirs += ../../../../examples -imagedirs += ../images diff --git a/src/extras/doc/qtquickextras-compat.qdocconf b/src/extras/doc/qtquickextras-compat.qdocconf deleted file mode 100644 index ad171f47..00000000 --- a/src/extras/doc/qtquickextras-compat.qdocconf +++ /dev/null @@ -1,17 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-defines.qdocconf) -include($QT_INSTALL_DOCS/global/qt-cpp-ignore.qdocconf) - -naturallanguage = en_US -outputencoding = UTF-8 -sourceencoding = UTF-8 - -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css" -examples.imageextensions = "*.png *.jpg *.gif" - -headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx" -sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc" - -#include the external websites -sourcedirs += externalsites - -include(qtquickextras-project.qdocconf) diff --git a/src/extras/doc/qtquickextras-project.qdocconf b/src/extras/doc/qtquickextras-project.qdocconf deleted file mode 100644 index 0e0104c1..00000000 --- a/src/extras/doc/qtquickextras-project.qdocconf +++ /dev/null @@ -1,59 +0,0 @@ -include($QT_INSTALL_DOCS/global/macros.qdocconf) -include($QT_INSTALL_DOCS/global/compat.qdocconf) -#include($QT_INSTALL_DOCS/global/manifest-meta.qdocconf) -include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) - -project = QtQuickExtras -description = Qt Quick Extras Reference Documentation -url = http://doc.qt.digia.com/QtQuickExtras/ -version = 1.3 - -qhp.projects = QtQuickExtras - -qhp.QtQuickExtras.file = qtquickextras.qhp -qhp.QtQuickExtras.namespace = org.qt-project.qtquickextras.1.3 -qhp.QtQuickExtras.virtualFolder = qtquickextras -qhp.QtQuickExtras.indexTitle = Qt Quick Extras -qhp.QtQuickExtras.indexRoot = -#qhp.QtQuickExtras.extraFiles = style/qtquickextras.css - -qhp.QtQuickExtras.filterAttributes = qtquickextras 1.3 qtrefdoc -qhp.QtQuickExtras.customFilters.Qt.name = QtQuickExtras 1.3 -qhp.QtQuickExtras.customFilters.Qt.filterAttributes = qtquickextras 1.3 - -qhp.QtQuickExtras.subprojects = qtquickextrasstyles - -qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.title = Controls QML Types -qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.indexTitle = Qt Quick Controls QML Types -qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.selectors = fake:qmlclass # cannot choose qmltypes from a specific group QTBUG-32985 -qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.sortPages = true - -qhp.QtQuickExtras.subprojects.qtquickextrasstyles.title = Qt Quick Extras Styles Structure -qhp.QtQuickExtras.subprojects.qtquickextrasstyles.indexTitle = Qt Quick Extras Styles Structure -qhp.QtQuickExtras.subprojects.qtquickextrasstyles.type = manual - -# QTBUG-35596: If you're using a shadow build of Qt >= 5.3.1, then uncomment the following line and comment out indexes += ... -#depends = qtqml qtquick qtdoc qtquickcontrols -indexes += $QT_INSTALL_DOCS/qtqml/qtqml.index \ - $QT_INSTALL_DOCS/qtquick/qtquick.index \ - $QT_INSTALL_DOCS/qtdoc/qtdoc.index \ - $QT_INSTALL_DOCS/qtquickcontrols/qtquickcontrols.index - -# Specify the install path under QT_INSTALL_EXAMPLES -# Examples will be installed under quick/extras - -# 'extras' subdirectory is given as part of \example commands -exampledirs += ../../../examples/quick \ - snippets -examplesinstallpath = quick - -headerdirs += ../ - -sourcedirs += ../ - -#sources += ../Private/<stuff> \ - -imagedirs += images - -navigation.landingpage = "Qt Quick Extras" -navigation.qmltypespage = "Qt Quick Extras QML Types" -buildversion = "Qt Quick Extras 1.3" diff --git a/src/extras/doc/qtquickextras.qdocconf b/src/extras/doc/qtquickextras.qdocconf index 10117442..f65630f9 100644 --- a/src/extras/doc/qtquickextras.qdocconf +++ b/src/extras/doc/qtquickextras.qdocconf @@ -1,4 +1,45 @@ -include($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf) -include($QT_INSTALL_DOCS/global/fileextensions.qdocconf) +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickExtras +description = Qt Quick Extras Reference Documentation +version = $QT_VERSION + +qhp.projects = QtQuickExtras + +qhp.QtQuickExtras.file = qtquickextras.qhp +qhp.QtQuickExtras.namespace = org.qt-project.qtquickextras.$QT_VERSION_TAG +qhp.QtQuickExtras.virtualFolder = qtquickextras +qhp.QtQuickExtras.indexTitle = Qt Quick Extras +qhp.QtQuickExtras.indexRoot = + +qhp.QtQuickExtras.filterAttributes = qtquickextras $QT_VERSION qtrefdoc +qhp.QtQuickExtras.customFilters.Qt.name = QtQuickExtras $QT_VERSION +qhp.QtQuickExtras.customFilters.Qt.filterAttributes = qtquickextras $QT_VERSION + +qhp.QtQuickExtras.subprojects = qtquickextrasqmltypes qtquickextrasexamples +qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.title = Extras QML Types +qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.indexTitle = Qt Quick Extras QML Types +qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.selectors = qmlclass +qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.sortPages = true + +qhp.QtQuickExtras.subprojects.qtquickextrasexamples.title = Extras Examples +qhp.QtQuickExtras.subprojects.qtquickextrasexamples.indexTitle = Qt Quick Extras Examples +qhp.QtQuickExtras.subprojects.qtquickextrasexamples.selectors = fake:example +qhp.QtQuickExtras.subprojects.qtquickextrasexamples.sortPages = true + +depends = qtqml qtquick qtdoc qtquickcontrols + +exampledirs += ../../../examples/quick/extras +examplesinstallpath = quick/extras + +headerdirs += ../ + +sourcedirs += ../ + +#sources += ../Private/<stuff> \ + +imagedirs += images + +navigation.landingpage = "Qt Quick Extras" +navigation.qmltypespage = "Qt Quick Extras QML Types" -include(qtquickextras-project.qdocconf) diff --git a/src/extras/doc/src/qtquickextras-index.qdoc b/src/extras/doc/src/qtquickextras-index.qdoc index 18e40711..63966614 100644 --- a/src/extras/doc/src/qtquickextras-index.qdoc +++ b/src/extras/doc/src/qtquickextras-index.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \page index.html + \page qtquickextras-index.html \title Qt Quick Extras \brief The Qt Quick Extras module provides a set of UI controls for Qt @@ -51,6 +51,6 @@ \li \l{Qt Quick Extras Overview} \li \l{Qt Quick Extras QML Types}{Qt Quick Extras QML Types} \li \l{Qt Quick Extras Examples} - \li \l{Qt Quick Extras Styles} + \li \l{Qt Quick Controls Styles} \endlist */ diff --git a/src/extras/doc/src/qtquickextras-overview.qdoc b/src/extras/doc/src/qtquickextras-overview.qdoc index 63732c50..5d5edf7c 100644 --- a/src/extras/doc/src/qtquickextras-overview.qdoc +++ b/src/extras/doc/src/qtquickextras-overview.qdoc @@ -64,7 +64,7 @@ import statement in your \c {.qml} file. \code - import QtQuick.Extras 1.3 + import QtQuick.Extras 1.4 \endcode \section1 Interactive controls @@ -81,7 +81,7 @@ \code import QtQuick 2.2 - import QtQuick.Extras 1.3 + import QtQuick.Extras 1.4 Rectangle { DelayButton { diff --git a/src/extras/doc/src/qtquickextras.qdoc b/src/extras/doc/src/qtquickextras.qdoc index 835b14fd..39f81f06 100644 --- a/src/extras/doc/src/qtquickextras.qdoc +++ b/src/extras/doc/src/qtquickextras.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \qmlmodule QtQuick.Extras 1.3 + \qmlmodule QtQuick.Extras 1.4 \title Qt Quick Extras QML Types \ingroup qmlmodules \brief Provides QML types for user interfaces. @@ -36,13 +36,13 @@ \l{Qt Quick} and \l{Qt Quick Controls}. Controls can be styled using the - \l{Qt Quick Extras Styles QML Types}{Styles QML Types}. + \l{Qt Quick Controls Styles QML Types}{Styles QML Types}. The QML types can be imported into your application using the following import statement in your .qml file. \code - import QtQuick.Extras 1.3 + import QtQuick.Extras 1.4 \endcode */ diff --git a/src/extras/doc/src/qtquickextrasstyles-index.qdoc b/src/extras/doc/src/qtquickextrasstyles-index.qdoc deleted file mode 100644 index 6af24bb7..00000000 --- a/src/extras/doc/src/qtquickextrasstyles-index.qdoc +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \group extrasstyling - \title Styling Extras Controls -*/ - -/*! - \page qtquickextrasstyles-index.html - \title Qt Quick Extras Styles - \brief The Qt Quick Extras Styles submodule provides custom - styles for Qt Quick Extras. - - The Qt Quick Extras Styles module allows custom styling for - \l {Qt Quick Extras}. - - The submodule requires \l{Qt Quick} 2.2. - - \section1 Getting started - - The QML types can be imported into your application using the following - import statement in your \c {.qml} file. - - \code - import QtQuick.Extras.Styles 1.3 - \endcode - - \section1 Styles - - \section2 Base Style - - The Base Style is the default style used when none is specified. It is also - used as a fallback when the specified style cannot be found. - - \image tumbler.png - \caption The Base Style Tumbler. - - \section2 Flat Style - - The Flat Style is designed for touch devices. It was introduced in Qt Quick - Extras Controls 1.3 and requires Qt 5.4. - - \image tumbler-flat-style.png - \caption The Flat Style Tumbler. - - \section2 Selecting Styles - - Qt Quick Extras follow Qt Quick Controls' styling system. You - can apply a different style to the controls by setting the - \e QT_QUICK_CONTROLS_STYLE environment variable to the name of the style. - For example, to use the Flat style, you can do the following: - - \code - QT_QUICK_CONTROLS_STYLE=Flat ./app - \endcode - - This can also be done in C++, using qputenv(): - - \code - qputenv("QT_QUICK_CONTROLS_STYLE", "Flat"); - \endcode - - \section1 Control Styles - \annotatedlist extrasstyles - - \section1 Styling Tutorials - \annotatedlist extrasstyling - - \section1 Related information - - \list - \li \l{Qt Quick} - \li \l{Qt Quick Extras} - \li \l{Qt Quick Extras Styles QML Types} - \endlist -*/ - -/*! - \page qtquickextrasstyles-structure.html - \title Qt Quick Extras Styles Structure - \list - \li \l{Qt Quick Extras Styles} - \list - \li \l{Qt Quick Extras Styles QML Types}{Styles QMl Types} - \endlist - \endlist -*/ - -/*! - \qmlmodule QtQuick.Extras.Styles 1.0 - \title Qt Quick Extras Styles QML Types - \ingroup qmlmodules - \brief Provides QML types for Qt Quick Extras styles. - - The \l{Qt Quick Extras} module provides a set of QML types for - handling styles. - - Some of the controls allow custom styling similar to widget style sheets. - A styling object is usually a collection of properties that control behavior - and simple delegates that can be replaced with custom QML snippets. - - \code - import QtQuick.Extras.Styles 1.3 - \endcode -*/ diff --git a/src/extras/extras.pro b/src/extras/extras.pro index cc2d2958..2ebd8f81 100644 --- a/src/extras/extras.pro +++ b/src/extras/extras.pro @@ -1,6 +1,6 @@ TARGET = qtquickextrasplugin TARGETPATH = QtQuick/Extras -IMPORT_VERSION = 1.3 +IMPORT_VERSION = 1.4 QT += qml diff --git a/src/extras/plugin.cpp b/src/extras/plugin.cpp index 7ac942bd..87455eb1 100644 --- a/src/extras/plugin.cpp +++ b/src/extras/plugin.cpp @@ -43,7 +43,6 @@ #include "Private/qquickcircularprogressbar_p.h" #include "Private/qquickflatprogressbar_p.h" #include "Private/qquickmousethief_p.h" -#include "Private/qquickstylesettings_p.h" #include "Private/qquickmathutils_p.h" QT_BEGIN_NAMESPACE @@ -83,7 +82,7 @@ void QtQuickExtrasPlugin::registerTypes(const char *uri) // register 1.3 qmlRegisterUncreatableType<QQuickTriggerMode>(uri, 1, 3, "TriggerMode", QLatin1String("Do not create objects of type TriggerMode")); // register 1.4 - qmlRegisterType<QQuickPicture>(uri, 1, /*TODO: 4*/3, "Picture"); + qmlRegisterType<QQuickPicture>(uri, 1, 4, "Picture"); } void QtQuickExtrasPlugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -93,7 +92,6 @@ void QtQuickExtrasPlugin::initializeEngine(QQmlEngine *engine, const char *uri) qmlRegisterType<QQuickMouseThief>("QtQuick.Extras.Private.CppUtils", 1, 0, "MouseThief"); qmlRegisterType<QQuickCircularProgressBar>("QtQuick.Extras.Private.CppUtils", 1, 1, "CircularProgressBar"); qmlRegisterType<QQuickFlatProgressBar>("QtQuick.Extras.Private.CppUtils", 1, 1, "FlatProgressBar"); - qmlRegisterSingletonType<QQuickStyleSettings>("QtQuick.Extras.Private", 1, 0, "StyleSettings", registerSettingsModule); qmlRegisterSingletonType<QQuickMathUtils>("QtQuick.Extras.Private.CppUtils", 1, 0, "MathUtils", registerMathUtilsSingleton); const QString prefix = "qrc:///ExtrasImports/QtQuick/Extras"; @@ -106,11 +104,4 @@ void QtQuickExtrasPlugin::initializeEngine(QQmlEngine *engine, const char *uri) qmlRegisterSingletonType(QUrl(prefix + "/Private/TextSingleton.qml"), private_uri, 1, 0, "TextSingleton"); } -QObject *QtQuickExtrasPlugin::registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine) -{ - Q_UNUSED(engine); - Q_UNUSED(jsEngine); - return new QQuickStyleSettings(engine); -} - QT_END_NAMESPACE diff --git a/src/extras/plugin.h b/src/extras/plugin.h index c613739f..08eae1c1 100644 --- a/src/extras/plugin.h +++ b/src/extras/plugin.h @@ -52,8 +52,6 @@ public: void registerTypes(const char *uri); void initializeEngine(QQmlEngine *engine, const char *uri); -private: - static QObject *registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine); }; QT_END_NAMESPACE diff --git a/src/extras/qmldir b/src/extras/qmldir index 8cf21310..030a7c2c 100644 --- a/src/extras/qmldir +++ b/src/extras/qmldir @@ -2,3 +2,5 @@ module QtQuick.Extras plugin qtquickextrasplugin classname QtQuickExtrasPlugin #typeinfo plugins.qmltypes + +depends QtGraphicalEffects 1.0 diff --git a/src/extras/qquickpicture.cpp b/src/extras/qquickpicture.cpp index fd8846a2..21747ee4 100644 --- a/src/extras/qquickpicture.cpp +++ b/src/extras/qquickpicture.cpp @@ -45,12 +45,25 @@ \since QtQuick.Extras 1.4 \ingroup extras \ingroup extras-non-interactive - \brief An indicator that displays a colorized ISO 7000 icon + \brief An indicator that displays a colorized QPicture icon Picture displays icons in a scalable vector format. It can also colorize the icons via the \l color property. The icon to display is set with the \l source property. + + For example, if you have access to the ISO 7000 icons that come with Qt + Enterprise, you can specify the following URL: + + \code + "qrc:/iso-icons/iso_grs_7000_4_0001.dat" + \endcode + + Due to the + \l {http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=65977} + {large selection of icons} available in this package, it is advisable to + use Qt Creator's Qt Quick Designer tool to browse and select icons, as this + property will then be set automatically. */ QQuickPicture::QQuickPicture(QQuickItem *parent) @@ -85,23 +98,7 @@ void QQuickPicture::paint(QPainter *painter) \qmlproperty url Picture::source This property specifies the URL of the icon to use. The URL must point to a - local file that contains \l QPicture data. - - For example, if you have the \l <NewControlName> from \l - <NewEnterpriseControlsName>, you can specify the following URL: - - \code - "qrc:/iso-icons/iso_grs_7000_4_0001.dat" - \endcode - - Due to the - \l {http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=65977} - {large selection of icons} available in this package, it is advisable to - use Qt Creator's Qt Quick Designer tool to browse and select icons, as this - property will then be set automatically. - - If you have your own picture that you'd like to display, you can set the - following URL: + local file that contains \l QPicture data. For example: \code "mypicture.dat" diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 86de357d..3cdd46fd 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs SUBDIRS += testplugin controls activeFocusOnTab applicationwindow dialogs \ - extras paint qquicktreemodeladaptor + extras paint qquicktreemodeladaptor customcontrolsstyle controls.depends = testplugin diff --git a/src/extras/Private/qquickstylesettings_p.h b/tests/auto/customcontrolsstyle/Style/ButtonStyle.qml index 3cb157a8..4b755686 100644 --- a/src/extras/Private/qquickstylesettings_p.h +++ b/tests/auto/customcontrolsstyle/Style/ButtonStyle.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Extras module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** Commercial License Usage @@ -34,46 +34,14 @@ ** ****************************************************************************/ -#ifndef STYLESETTINGS_P_H -#define STYLESETTINGS_P_H - -#include <QtCore/qurl.h> -#include <QtCore/qobject.h> - -QT_BEGIN_NAMESPACE - -class QQmlEngine; - -class QQuickStyleSettings : public QObject -{ - Q_OBJECT - 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) - -public: - QQuickStyleSettings(QQmlEngine *engine); - - QUrl style() const; - - QString styleName() const; - void setStyleName(const QString &name); - - QString stylePath() const; - void setStylePath(const QString &path); - -signals: - void styleChanged(); - void styleNameChanged(); - void stylePathChanged(); - -private: - QString styleFilePath() const; - - QString m_name; - QString m_path; -}; - -QT_END_NAMESPACE - -#endif // STYLESETTINGS_P_H +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +ButtonStyle { + background: Rectangle { + implicitWidth: 200 + implicitHeight: 50 + color: "red" + } +} diff --git a/tests/auto/customcontrolsstyle/customcontrolsstyle.pro b/tests/auto/customcontrolsstyle/customcontrolsstyle.pro new file mode 100644 index 00000000..d3bcae47 --- /dev/null +++ b/tests/auto/customcontrolsstyle/customcontrolsstyle.pro @@ -0,0 +1,18 @@ +CONFIG += testcase +TARGET = tst_customcontrolsstyle +SOURCES += tst_customcontrolsstyle.cpp + +include (../shared/util.pri) + +osx:CONFIG -= app_bundle + +CONFIG += parallel_test +QT += core-private qml-private quick-private testlib + +TESTDATA = data/* + +OTHER_FILES += \ + data/TestComponent.qml + +RESOURCES += \ + style.qrc diff --git a/src/extras/Styles/Base/basestyleplugin.h b/tests/auto/customcontrolsstyle/data/TestComponent.qml index 4f1fb6d1..e32a3308 100644 --- a/src/extras/Styles/Base/basestyleplugin.h +++ b/tests/auto/customcontrolsstyle/data/TestComponent.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Extras module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** Commercial License Usage @@ -34,25 +34,24 @@ ** ****************************************************************************/ -#ifndef STYLES_PLUGIN_H -#define STYLES_PLUGIN_H +import QtTest 1.0 +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Window 2.0 -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QtQml/qqmlengine.h> +Window { + visible: true + width: 400 + height: 400 -QT_BEGIN_NAMESPACE + Button { + id: button + } -class QtQuickExtrasStylesPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") -public: - explicit QtQuickExtrasStylesPlugin(QObject *parent = 0); + function buttonStyleComponent() { + return Settings.styleComponent(Settings.style, "Button.qml", button); + } - void registerTypes(const char *uri); -}; - -QT_END_NAMESPACE - -#endif // STYLES_PLUGIN_H + property string styleName: Settings.styleName +} diff --git a/tests/auto/customcontrolsstyle/style.qrc b/tests/auto/customcontrolsstyle/style.qrc new file mode 100644 index 00000000..37cfbbd7 --- /dev/null +++ b/tests/auto/customcontrolsstyle/style.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>Style/ButtonStyle.qml</file> + </qresource> +</RCC> diff --git a/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp new file mode 100644 index 00000000..a4a7b24f --- /dev/null +++ b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QTest> +#include <QRegularExpression> +#include <QQmlEngine> +#include <QQmlComponent> +#include <QQuickItem> +#include <QQuickWindow> +#include <QStringListModel> +#include "../shared/util.h" + +class tst_customcontrolsstyle : public QQmlDataTest +{ + Q_OBJECT + +public: + tst_customcontrolsstyle() {} + +private slots: + void initTestCase(); + + void style_data(); + void style(); +}; + +void tst_customcontrolsstyle::initTestCase() +{ + QQmlDataTest::initTestCase(); +} + +void tst_customcontrolsstyle::style_data() +{ + QTest::addColumn<QString>("specifiedStyle"); + QTest::addColumn<QString>("expectedStyleName"); + + QTest::newRow("NonExistentStyle") << QString::fromLatin1("NonExistentStyle") << QString::fromLatin1("Base"); + QTest::newRow("CustomFileSystemStyle") << directory() + QString::fromLatin1("/Style") << QString::fromLatin1("Style"); + QTest::newRow("CustomQrcStyle") << QString::fromLatin1(":/Style") << QString::fromLatin1("Style"); +} + +void tst_customcontrolsstyle::style() +{ + QFETCH(QString, specifiedStyle); + QFETCH(QString, expectedStyleName); + + qputenv("QT_QUICK_CONTROLS_STYLE", specifiedStyle.toLocal8Bit()); + + const bool expectBase = expectedStyleName == QLatin1String("Base"); + + if (specifiedStyle != expectedStyleName && expectBase) { + QString regexStr = QString::fromLatin1("WARNING: Cannot find style \"%1\" - fallback: .*%2").arg(specifiedStyle).arg("Base"); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(regexStr)); + } + + QQmlEngine engine; + + QQmlComponent component(&engine, testFileUrl("TestComponent.qml")); + QTRY_COMPARE(component.status(), QQmlComponent::Ready); + + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + + QCOMPARE(object->property("styleName").toString(), expectedStyleName); + + QVariant returnedValue; + QMetaObject::invokeMethod(object.data(), "buttonStyleComponent", Q_RETURN_ARG(QVariant, returnedValue)); + + QVERIFY(returnedValue.isValid()); + QVERIFY(returnedValue.canConvert<QQmlComponent*>()); + QVERIFY(returnedValue.value<QQmlComponent*>()); + + QQuickWindow *window = qobject_cast<QQuickWindow*>(object.data()); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + if (!expectBase) { + QImage windowImage = window->grabWindow(); + QCOMPARE(windowImage.pixel(0, 0), QColor(Qt::red).rgb()); + } +} + +QTEST_MAIN(tst_customcontrolsstyle) + +#include "tst_customcontrolsstyle.moc" diff --git a/tests/auto/extras/data/PieMenu3Items.qml b/tests/auto/extras/data/PieMenu3Items.qml index f9349e63..8e8396eb 100644 --- a/tests/auto/extras/data/PieMenu3Items.qml +++ b/tests/auto/extras/data/PieMenu3Items.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml b/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml index ffbfa20a..c2c0dce4 100644 --- a/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml +++ b/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenu3ItemsLongPress.qml b/tests/auto/extras/data/PieMenu3ItemsLongPress.qml index fddc5460..5503c8d4 100644 --- a/tests/auto/extras/data/PieMenu3ItemsLongPress.qml +++ b/tests/auto/extras/data/PieMenu3ItemsLongPress.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenuBoundingItem.qml b/tests/auto/extras/data/PieMenuBoundingItem.qml index 3daf0f19..cb6f1e89 100644 --- a/tests/auto/extras/data/PieMenuBoundingItem.qml +++ b/tests/auto/extras/data/PieMenuBoundingItem.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml b/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml index 2df592ab..b1095158 100644 --- a/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml +++ b/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/auto/extras/data/PieMenuVisibleButNoParent.qml b/tests/auto/extras/data/PieMenuVisibleButNoParent.qml index 582e168a..609539e7 100644 --- a/tests/auto/extras/data/PieMenuVisibleButNoParent.qml +++ b/tests/auto/extras/data/PieMenuVisibleButNoParent.qml @@ -1,5 +1,5 @@ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { width: 400 diff --git a/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml b/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml index aa9cc18c..55ba328c 100644 --- a/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml +++ b/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml @@ -1,5 +1,5 @@ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { width: 400 diff --git a/tests/auto/extras/data/TumblerDatePicker.qml b/tests/auto/extras/data/TumblerDatePicker.qml index 9872fc00..9a5ad480 100644 --- a/tests/auto/extras/data/TumblerDatePicker.qml +++ b/tests/auto/extras/data/TumblerDatePicker.qml @@ -1,6 +1,6 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Tumbler { id: tumbler diff --git a/tests/auto/extras/data/tst_circulargauge.qml b/tests/auto/extras/data/tst_circulargauge.qml index 16c0815f..1fb47982 100644 --- a/tests/auto/extras/data/tst_circulargauge.qml +++ b/tests/auto/extras/data/tst_circulargauge.qml @@ -46,7 +46,7 @@ TestCase { height: 400 function test_instance() { - var gauge = Qt.createQmlObject('import QtQuick.Extras 1.3; CircularGauge { }', testcase, ''); + var gauge = Qt.createQmlObject('import QtQuick.Extras 1.4; CircularGauge { }', testcase, ''); verify (gauge, "CircularGauge: failed to create an instance") verify(gauge.__style) gauge.destroy() @@ -73,7 +73,7 @@ TestCase { } function test_tickmarksVisible() { - var gauge = Qt.createQmlObject("import QtQuick.Extras 1.3; CircularGauge { }", testcase, ""); + var gauge = Qt.createQmlObject("import QtQuick.Extras 1.4; CircularGauge { }", testcase, ""); verify(gauge, "CircularGauge: failed to create an instance"); gauge.__style.tickmark = tickmark; diff --git a/tests/auto/extras/data/tst_circulartickmarklabel.qml b/tests/auto/extras/data/tst_circulartickmarklabel.qml index 2521cbe9..731e15d1 100644 --- a/tests/auto/extras/data/tst_circulartickmarklabel.qml +++ b/tests/auto/extras/data/tst_circulartickmarklabel.qml @@ -49,7 +49,7 @@ TestCase { property var label: null function init() { - label = Qt.createQmlObject("import QtQuick.Extras 1.3; import QtQuick.Extras.Private 1.0; CircularTickmarkLabel {}", testcase, ""); + label = Qt.createQmlObject("import QtQuick.Extras 1.4; import QtQuick.Extras.Private 1.0; CircularTickmarkLabel {}", testcase, ""); verify(label, "CircularTickmarkLabel: failed to create an instance"); verify(label.__style); } diff --git a/tests/auto/extras/data/tst_common.qml b/tests/auto/extras/data/tst_common.qml index 1a7fe990..f0c3e428 100644 --- a/tests/auto/extras/data/tst_common.qml +++ b/tests/auto/extras/data/tst_common.qml @@ -53,11 +53,11 @@ TestCase { { tag: "DelayButton" }, { tag: "Dial" }, { tag: "Gauge" }, - { tag: "PieMenu", qml: "import QtQuick.Controls 1.1; import QtQuick.Extras 1.3;" + { tag: "PieMenu", qml: "import QtQuick.Controls 1.1; import QtQuick.Extras 1.4;" + "PieMenu { visible: true; MenuItem { text: 'foo' } }"}, { tag: "StatusIndicator" }, { tag: "ToggleButton" }, - { tag: "Tumbler", qml: "import QtQuick.Extras 1.3; Tumbler { TumblerColumn { model: 10 } }" } + { tag: "Tumbler", qml: "import QtQuick.Extras 1.4; Tumbler { TumblerColumn { model: 10 } }" } ]; } @@ -66,7 +66,7 @@ TestCase { } function test_resize(data) { - var qml = data.qml ? data.qml : "import QtQuick.Extras 1.3; " + data.tag + " { }"; + var qml = data.qml ? data.qml : "import QtQuick.Extras 1.4; " + data.tag + " { }"; control = Qt.createQmlObject(qml, testCase, ""); var resizeAnimation = Qt.createQmlObject("import QtQuick 2.2; NumberAnimation {}", testCase, ""); diff --git a/tests/auto/extras/data/tst_delaybutton.qml b/tests/auto/extras/data/tst_delaybutton.qml index 59e602a1..9fc736c0 100644 --- a/tests/auto/extras/data/tst_delaybutton.qml +++ b/tests/auto/extras/data/tst_delaybutton.qml @@ -46,12 +46,13 @@ TestCase { height: 400 function test_instance() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") verify(button.__style) verify(!button.checked) verify(!button.pressed) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -68,7 +69,7 @@ TestCase { } function test_activation(data) { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") button.delay = data.delay @@ -89,7 +90,8 @@ TestCase { verify(!button.pressed) compare(activationSpy.count, 1) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -98,7 +100,7 @@ TestCase { } function test_progress() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { delay: 1 }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { delay: 1 }', testcase, '') verify (button, "DelayButton: failed to create an instance") progressSpy.target = button @@ -109,7 +111,8 @@ TestCase { tryCompare(button, "progress", 1.0) verify(progressSpy.count > 0) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -126,7 +129,7 @@ TestCase { } function test_checked(data) { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") button.delay = data.delay @@ -164,11 +167,12 @@ TestCase { verify(!button.checked) compare(checkSpy.count, checkCount) - button.destroy() + // QTBUG-44664 +// button.destroy() } function test_programmaticCheck() { - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; DelayButton {}", testcase, ""); + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; DelayButton {}", testcase, ""); verify(button, "DelayButton: failed to create an instance"); checkSpy.clear(); @@ -181,14 +185,16 @@ TestCase { button.checked = false; compare(button.progress, 0); - button.destroy(); + // QTBUG-44664 +// button.destroy(); } function test_largeText() { // Should be no binding loop warnings. - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; DelayButton { " + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; DelayButton { " + "anchors.centerIn: parent; text: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }", testcase, ""); verify(button, "DelayButton: failed to create an instance"); - button.destroy(); + // QTBUG-44664 +// button.destroy(); } } diff --git a/tests/auto/extras/data/tst_dial.qml b/tests/auto/extras/data/tst_dial.qml index 02e6eaa3..3c508184 100644 --- a/tests/auto/extras/data/tst_dial.qml +++ b/tests/auto/extras/data/tst_dial.qml @@ -47,7 +47,7 @@ TestCase { height: 400 function test_instance() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") verify(dial.__style) compare(dial.value, 0.0) @@ -62,7 +62,7 @@ TestCase { } function test_minimumValue() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") dial.minimumValue = 5 dial.maximumValue = 10 @@ -73,7 +73,7 @@ TestCase { } function test_maximumValue() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") dial.minimumValue = 5 dial.maximumValue = 10 @@ -87,7 +87,7 @@ TestCase { var scope = Qt.createQmlObject('import QtQuick 2.2; FocusScope { focus: false }', testcase, '') verify(!scope.activeFocus) - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', scope, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', scope, '') verify (dial, "Dial: failed to create an instance") verify(!dial.activeFocusOnPress) verify(!dial.activeFocus) @@ -119,7 +119,7 @@ TestCase { } function test_pressed() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify (dial, "Dial: failed to create an instance") pressSpy.target = dial @@ -143,7 +143,7 @@ TestCase { } function test_hovered() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify (dial, "Dial: failed to create an instance") hoverSpy.target = dial @@ -175,7 +175,7 @@ TestCase { } function test_dragging(data) { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify(dial, "Dial: failed to create an instance") dial.minimumValue = data.min dial.maximumValue = data.max @@ -211,7 +211,7 @@ TestCase { } function test_outerRadius() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); // Implicit width and height are identical. compare(dial.__style.outerRadius, dial.width / 2); @@ -250,7 +250,7 @@ TestCase { } function test_tickmarksVisible() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); dial.__style.minorTickmarkCount = 4; @@ -291,7 +291,7 @@ TestCase { parentEventSpy.target = focusScope; parentEventSpy.signalName = "receivedKeyPress"; - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", focusScope, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", focusScope, ""); verify(dial, "Dial: failed to create an instance"); compare(dial.activeFocusOnTab, true); compare(dial.value, 0); @@ -343,7 +343,7 @@ TestCase { } function test_dragToSet() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); dial.__style.__dragToSet = false; diff --git a/tests/auto/extras/data/tst_gauge.qml b/tests/auto/extras/data/tst_gauge.qml index 08fdf53f..ba065232 100644 --- a/tests/auto/extras/data/tst_gauge.qml +++ b/tests/auto/extras/data/tst_gauge.qml @@ -36,7 +36,7 @@ import QtTest 1.0 import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 import "TestUtils.js" as TestUtils TestCase { @@ -69,7 +69,7 @@ TestCase { } function init() { - gauge = Qt.createQmlObject("import QtQuick.Extras 1.3; Gauge { }", testcase, ""); + gauge = Qt.createQmlObject("import QtQuick.Extras 1.4; Gauge { }", testcase, ""); verify(gauge, "Gauge: failed to create an instance"); verify(gauge.__style); } diff --git a/tests/auto/extras/data/tst_picture.qml b/tests/auto/extras/data/tst_picture.qml index bfdcc557..5ddc4406 100644 --- a/tests/auto/extras/data/tst_picture.qml +++ b/tests/auto/extras/data/tst_picture.qml @@ -36,7 +36,7 @@ import QtTest 1.0 import QtQuick 2.4 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 TestCase { @@ -69,7 +69,7 @@ TestCase { } function test_instance() { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture { }", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture { }", testCase, ""); verify(picture, "Picture: failed to create an instance"); } @@ -93,7 +93,7 @@ TestCase { } function test_source(data) { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); picture.source = data.tag; picture.width = data.implicitSize.width; @@ -120,14 +120,17 @@ TestCase { } function test_color(data) { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); picture.width = pictureDotDatImplicitSize.width; picture.height = pictureDotDatImplicitSize.height; picture.source = "picture.dat"; picture.color = data.color; - waitForRendering(picture); + // For some reason we need two waits here, otherwise the color detected is *sometimes* white instead of black. + // Also, we use an explicit, shorter timeout, otherwise the default (5000 ms) seems to be exhausted. + waitForRendering(picture, 200); + waitForRendering(picture, 200); var pictureImage = grabImage(picture); @@ -144,7 +147,7 @@ TestCase { } function test_size() { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); compare(picture.implicitWidth, fontMetrics.height * 4); diff --git a/tests/auto/extras/data/tst_piemenu.qml b/tests/auto/extras/data/tst_piemenu.qml index fa109a1a..d90aebab 100644 --- a/tests/auto/extras/data/tst_piemenu.qml +++ b/tests/auto/extras/data/tst_piemenu.qml @@ -37,7 +37,7 @@ import QtTest 1.0 import QtQuick 2.1 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 @@ -94,7 +94,7 @@ Item { } function test_instance() { - var pieMenu = Qt.createQmlObject("import QtQuick.Extras 1.3; PieMenu { }", container, ""); + var pieMenu = Qt.createQmlObject("import QtQuick.Extras 1.4; PieMenu { }", container, ""); verify(pieMenu, "PieMenu: failed to create an instance"); verify(pieMenu.__style); compare(pieMenu.triggerMode, TriggerMode.TriggerOnClick); diff --git a/tests/auto/extras/data/tst_statusindicator.qml b/tests/auto/extras/data/tst_statusindicator.qml index e9fa6ac9..da38f9fc 100644 --- a/tests/auto/extras/data/tst_statusindicator.qml +++ b/tests/auto/extras/data/tst_statusindicator.qml @@ -36,8 +36,9 @@ import QtTest 1.0 import QtQuick 2.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Extras 1.4 TestCase { id: testCase @@ -55,13 +56,13 @@ TestCase { } function test_instance() { - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator, "StatusIndicator: failed to create an instance") verify(indicator.__style); } function test_active_data() { - if (StyleSettings.styleName === "Flat") { + if (Settings.styleName === "Flat") { return [ { tag: "active", active: true, expectedColor: { r: 18, g: 136, b: 203 } }, { tag: "inactive", active: false, expectedColor: { r: 179, g: 179, b: 179 } } @@ -75,13 +76,13 @@ TestCase { } function test_active(data) { - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); compare(indicator.active, false); indicator.active = data.active; // Color is slightly different on some platforms/machines, like Windows. - var lenience = StyleSettings.styleName === "Flat" ? 0 : 2; + var lenience = Settings.styleName === "Flat" ? 0 : 2; waitForRendering(indicator); var image = grabImage(indicator); @@ -91,9 +92,9 @@ TestCase { } function test_color() { - var flatStyle = StyleSettings.styleName === "Flat"; + var flatStyle = Settings.styleName === "Flat"; - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); compare(indicator.color, flatStyle ? "#1288cb" : "#ff0000"); @@ -113,10 +114,10 @@ TestCase { } function test_baseStyleHasOuterShadow() { - if (StyleSettings.styleName !== "Base") + if (Settings.styleName !== "Base") return; - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); // There should be a "shadow" here... diff --git a/tests/auto/extras/data/tst_togglebutton.qml b/tests/auto/extras/data/tst_togglebutton.qml index 46b87f93..b68f6ca3 100644 --- a/tests/auto/extras/data/tst_togglebutton.qml +++ b/tests/auto/extras/data/tst_togglebutton.qml @@ -46,7 +46,7 @@ TestCase { height: 400 function test_instance() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; ToggleButton { }', testcase, ''); + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; ToggleButton { }', testcase, ''); verify (button, "ToggleButton: failed to create an instance") verify(button.__style) verify(button.checkable) @@ -57,7 +57,7 @@ TestCase { function test_largeText() { // Should be no binding loop warnings. - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; ToggleButton { " + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; ToggleButton { " + "anchors.centerIn: parent; text: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }", testcase, ""); verify(button, "ToggleButton: failed to create an instance"); waitForRendering(button); diff --git a/tests/auto/extras/data/tst_tumbler.qml b/tests/auto/extras/data/tst_tumbler.qml index 936269c8..0f1a29fd 100644 --- a/tests/auto/extras/data/tst_tumbler.qml +++ b/tests/auto/extras/data/tst_tumbler.qml @@ -36,9 +36,10 @@ import QtTest 1.0 import QtQuick 2.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Extras 1.4 import "TestUtils.js" as TestUtils Item { @@ -75,7 +76,7 @@ Item { } function init() { - tumbler = Qt.createQmlObject("import QtQuick.Extras 1.3; Tumbler { }", container, ""); + tumbler = Qt.createQmlObject("import QtQuick.Extras 1.4; Tumbler { }", container, ""); verify(tumbler, "Tumbler: failed to create an instance"); } @@ -165,7 +166,7 @@ Item { tumbler.getColumn(0).visible = false; verify(!tumbler.__viewAt(0).visible); - if (StyleSettings.styleName === "Base") + if (Settings.styleName === "Base") verify(!tumbler.__viewAt(0).parent.separator.visible); } @@ -243,7 +244,7 @@ Item { // Somehow it works with the Base style. It could be rewritten to use an // equal amount of items for the model and visibleItemCount, judging from // the snippet in QTBUG-40298. - if (StyleSettings.styleName === "Flat") + if (Settings.styleName === "Flat") skip("Not a valid test case as the model count is less than the visibleItemCount"); tumbler.height = 120; @@ -308,7 +309,7 @@ Item { var pos = Qt.point(columnXCenter(0), tumbler.__style.padding.top); mouseDrag(tumbler, pos.x, pos.y, 0, tumbler.height - tumbler.__style.padding.bottom, Qt.LeftButton, Qt.NoModifier, 300); - tryCompare(tumbler.__viewAt(0), "offset", StyleSettings.styleName === "Flat" ? 6.0 : 4.0); + tryCompare(tumbler.__viewAt(0), "offset", Settings.styleName === "Flat" ? 6.0 : 4.0); tumbler.height += 100; var padding = tumbler.__style.padding; diff --git a/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml b/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml index ff8424f2..6e515334 100644 --- a/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml +++ b/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml b/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml index dd5a19a2..fe0f5424 100644 --- a/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml +++ b/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root |