diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-02 10:25:02 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-02 10:25:02 +0200 |
commit | dc1d95819365202e2745faffe31e13d928742c4c (patch) | |
tree | ee45832495cc20d26143fc3ec4f74c3212b0742e /src/controls/Private | |
parent | 52672d6811eeda364c10fa4d81c2b352e8b1d2e8 (diff) | |
parent | 22fab1502f562bccb3c16dde0288aa867e3b094a (diff) | |
download | qtquickcontrols-dc1d95819365202e2745faffe31e13d928742c4c.tar.gz |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
.qmake.conf
Change-Id: Iab80dd0c2bea54171971fd7a9538000908ed90d5
Diffstat (limited to 'src/controls/Private')
-rw-r--r-- | src/controls/Private/ScrollViewHelper.qml | 2 | ||||
-rw-r--r-- | src/controls/Private/qquickabstractstyle.cpp | 1 | ||||
-rw-r--r-- | src/controls/Private/qquickcontrolsettings.cpp | 43 | ||||
-rw-r--r-- | src/controls/Private/qquickcontrolsettings_p.h | 1 | ||||
-rw-r--r-- | src/controls/Private/qquickrangemodel.cpp | 16 |
5 files changed, 42 insertions, 21 deletions
diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml index 4841eace..066bc6cd 100644 --- a/src/controls/Private/ScrollViewHelper.qml +++ b/src/controls/Private/ScrollViewHelper.qml @@ -73,10 +73,12 @@ Item { function doLayout() { if (!recursionGuard) { recursionGuard = true + blockUpdates = true; scrollHelper.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 scrollHelper.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 scrollHelper.availableWidth = viewport.width scrollHelper.availableHeight = viewport.height + blockUpdates = false; recursionGuard = false } } diff --git a/src/controls/Private/qquickabstractstyle.cpp b/src/controls/Private/qquickabstractstyle.cpp index 065f7171..cd283959 100644 --- a/src/controls/Private/qquickabstractstyle.cpp +++ b/src/controls/Private/qquickabstractstyle.cpp @@ -44,6 +44,7 @@ QT_BEGIN_NAMESPACE /*! \qmltype AbstractStyle \instantiates QQuickAbstractStyle1 + \inqmlmodule QtQuick.Controls.Styles \qmlabstract \internal */ diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index dfab577e..a2fb824c 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -42,6 +42,7 @@ #include <qcoreapplication.h> #include <qdebug.h> #include <qqmlengine.h> +#include <qfileinfo.h> #include <qlibrary.h> #include <qdir.h> #include <QTouchDevice> @@ -154,16 +155,21 @@ static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleN QString path; #ifndef QT_STATIC bool found = false; - const auto importPathList = engine->importPathList(); - for (const QString &import : importPathList) { - QDir dir(import + QStringLiteral("/QtQuick/Controls/Styles")); - if (dir.exists(styleName)) { - found = true; - path = dir.absolutePath(); - break; + const auto importPathList = engine->importPathList(); // ideally we'd call QQmlImportDatabase::importPathList(Local) here, but it's not exported + for (QString import : importPathList) { + bool localPath = QFileInfo(import).isAbsolute(); + if (import.startsWith(QLatin1String("qrc:/"), Qt::CaseInsensitive)) { + import = QLatin1Char(':') + import.mid(4); + localPath = true; + } + if (localPath) { + 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"; @@ -194,6 +200,7 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName) } QQuickControlSettings1::QQuickControlSettings1(QQmlEngine *engine) + : m_engine(engine) { // First, register all style paths in the default style location. QDir dir; @@ -223,10 +230,14 @@ QQuickControlSettings1::QQuickControlSettings1(QQmlEngine *engine) if (m_styleMap.contains(m_name)) { m_path = m_styleMap.value(m_name).m_styleDirPath; } else { - QString unknownStyle = m_name; - m_name = defaultStyle; m_path = m_styleMap.value(defaultStyle).m_styleDirPath; - qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath(); + // Maybe the requested style is not next to the default style, but elsewhere in the import path + findStyle(engine, m_name); + if (!m_styleMap.contains(m_name)) { + QString unknownStyle = m_name; + m_name = defaultStyle; + qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath(); + } } // Can't really do anything about this failing here, so don't bother checking... @@ -278,7 +289,8 @@ void QQuickControlSettings1::findStyle(QQmlEngine *engine, const QString &styleN QDir dir; dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); dir.setPath(path); - dir.cd(styleName); + if (!dir.cd(styleName)) + return; StyleData styleData; @@ -327,6 +339,11 @@ void QQuickControlSettings1::setStyleName(const QString &name) QString oldName = m_name; m_name = name; + if (!m_styleMap.contains(name)) { + // Maybe this style is not next to the default style, but elsewhere in the import path + findStyle(m_engine, name); + } + // Don't change the style if it can't be resolved. if (!resolveCurrentStylePath()) m_name = oldName; diff --git a/src/controls/Private/qquickcontrolsettings_p.h b/src/controls/Private/qquickcontrolsettings_p.h index aa3e4b2d..bfa44f2f 100644 --- a/src/controls/Private/qquickcontrolsettings_p.h +++ b/src/controls/Private/qquickcontrolsettings_p.h @@ -106,6 +106,7 @@ private: QString m_name; QString m_path; QHash<QString, StyleData> m_styleMap; + QQmlEngine *m_engine; }; QT_END_NAMESPACE diff --git a/src/controls/Private/qquickrangemodel.cpp b/src/controls/Private/qquickrangemodel.cpp index 4a685bf3..d881e3c8 100644 --- a/src/controls/Private/qquickrangemodel.cpp +++ b/src/controls/Private/qquickrangemodel.cpp @@ -266,7 +266,7 @@ void QQuickRangeModel1::setRange(qreal min, qreal max) } /*! - \property QQuickRangeModel::minimumValue + \property QQuickRangeModel1::minimumValue \brief the minimum value that \l value can assume This property's default value is 0 @@ -285,7 +285,7 @@ qreal QQuickRangeModel1::minimum() const } /*! - \property QQuickRangeModel::maximumValue + \property QQuickRangeModel1::maximumValue \brief the maximum value that \l value can assume This property's default value is 99 @@ -306,7 +306,7 @@ qreal QQuickRangeModel1::maximum() const } /*! - \property QQuickRangeModel::stepSize + \property QQuickRangeModel1::stepSize \brief the value that is added to the \l value and \l position property Example: If a user sets a range of [0,100] and stepSize @@ -350,7 +350,7 @@ qreal QQuickRangeModel1::positionForValue(qreal value) const } /*! - \property QQuickRangeModel::position + \property QQuickRangeModel1::position \brief the current position of the model Represents a valid external position, based on the \l positionAtMinimum, @@ -385,7 +385,7 @@ void QQuickRangeModel1::setPosition(qreal newPosition) } /*! - \property QQuickRangeModel::positionAtMinimum + \property QQuickRangeModel1::positionAtMinimum \brief the minimum value that \l position can assume This property's default value is 0 @@ -404,7 +404,7 @@ qreal QQuickRangeModel1::positionAtMinimum() const } /*! - \property QQuickRangeModel::positionAtMaximum + \property QQuickRangeModel1::positionAtMaximum \brief the maximum value that \l position can assume This property's default value is 0 @@ -437,7 +437,7 @@ qreal QQuickRangeModel1::valueForPosition(qreal position) const } /*! - \property QQuickRangeModel::value + \property QQuickRangeModel1::value \brief the current value of the model Represents a valid external value, based on the \l minimumValue, @@ -472,7 +472,7 @@ void QQuickRangeModel1::setValue(qreal newValue) } /*! - \property QQuickRangeModel::inverted + \property QQuickRangeModel1::inverted \brief the model is inverted or not The model can be represented with an inverted behavior, e.g. when \l value assumes |