diff options
Diffstat (limited to 'src/controls/Private/qquickcontrolsettings.cpp')
| -rw-r--r-- | src/controls/Private/qquickcontrolsettings.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index ca57f3941..b73a7d43a 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -57,6 +57,8 @@ static QString defaultStyleName() return QLatin1String("Android"); #elif defined(Q_OS_IOS) return QLatin1String("iOS"); +#elif defined(Q_OS_WINRT) + return QLatin1String("WinRT"); #endif return QLatin1String("Base"); } @@ -71,7 +73,7 @@ static QString styleImportName() static bool fromResource(const QString &path) { - return path.startsWith("qrc:"); + return path.startsWith(":/"); } bool QQuickControlSettings::hasTouchScreen() const @@ -111,9 +113,11 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName) path = dir.absolutePath(); break; } + if (found) + break; } if (!found) - path = "qrc:/QtQuick/Controls/Styles"; + path = ":/QtQuick/Controls/Styles"; } else { path = info.absolutePath(); } @@ -126,8 +130,6 @@ QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine) m_path = styleImportPath(engine, m_name); QString path = styleFilePath(); - if (fromResource(path)) - path = path.remove(0, 3); // remove qrc from the path QDir dir(path); if (!dir.exists()) { @@ -158,12 +160,17 @@ QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine) connect(this, SIGNAL(stylePathChanged()), SIGNAL(styleChanged())); } -QString QQuickControlSettings::style() const +QUrl QQuickControlSettings::style() const { - if (fromResource(styleFilePath())) - return styleFilePath(); - else - return QUrl::fromLocalFile(styleFilePath()).toString(); + QUrl result; + QString path = styleFilePath(); + if (fromResource(path)) { + result.setScheme("qrc"); + path.remove(0, 1); // remove ':' prefix + result.setPath(path); + } else + result = QUrl::fromLocalFile(path); + return result; } QString QQuickControlSettings::styleName() const |
