aboutsummaryrefslogtreecommitdiffstats
path: root/src/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-31 16:05:25 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-31 17:38:37 +0100
commit19b967506deea84a0d56375e5bcca48168a3cfc8 (patch)
treebf488dc01069b7850cceff182c2241ed13db69c6 /src/controls
parent8318deb165047d592523ec0b2fd10510d4953b37 (diff)
parent7fc567eda8a187e365f4c29c6e8f08440bf31218 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/templates/qquickpopup.cpp src/templates/qquickpopup_p_p.h src/templates/qquickspinbox_p.h Change-Id: Ief25ad2d27410f62e90879f60499ed87359406c3
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/qquickstyleselector.cpp41
-rw-r--r--src/controls/qquickstyleselector_p.h5
-rw-r--r--src/controls/qquickstyleselector_p_p.h4
3 files changed, 20 insertions, 30 deletions
diff --git a/src/controls/qquickstyleselector.cpp b/src/controls/qquickstyleselector.cpp
index b169ade2..21354a16 100644
--- a/src/controls/qquickstyleselector.cpp
+++ b/src/controls/qquickstyleselector.cpp
@@ -74,12 +74,6 @@ QQuickStyleSelector::~QQuickStyleSelector()
{
}
-QString QQuickStyleSelector::select(const QString &filePath) const
-{
- Q_D(const QQuickStyleSelector);
- return select(QUrl(d->baseUrl.toString() + filePath)).toString();
-}
-
static bool isLocalScheme(const QString &file)
{
bool local = file == QLatin1String("qrc");
@@ -89,20 +83,20 @@ static bool isLocalScheme(const QString &file)
return local;
}
-QUrl QQuickStyleSelector::select(const QUrl &filePath) const
+QString QQuickStyleSelector::select(const QString &filePath) const
{
Q_D(const QQuickStyleSelector);
- if (!isLocalScheme(filePath.scheme()) && !filePath.isLocalFile())
- return filePath;
- QUrl ret(filePath);
- if (isLocalScheme(filePath.scheme())) {
- QString equivalentPath = QLatin1Char(':') + filePath.path();
- QString selectedPath = d->select(equivalentPath, allSelectors());
- ret.setPath(selectedPath.remove(0, 1));
- } else {
- ret = QUrl::fromLocalFile(d->select(ret.toLocalFile(), allSelectors()));
+ QUrl url(d->baseUrl.toString() + filePath);
+ if (isLocalScheme(url.scheme()) || url.isLocalFile()) {
+ if (isLocalScheme(url.scheme())) {
+ QString equivalentPath = QLatin1Char(':') + url.path();
+ QString selectedPath = d->select(equivalentPath);
+ url.setPath(selectedPath.remove(0, 1));
+ } else {
+ url = QUrl::fromLocalFile(d->select(url.toLocalFile()));
+ }
}
- return ret;
+ return url.toString();
}
static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
@@ -131,7 +125,7 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
return path + fileName;
}
-QString QQuickStyleSelectorPrivate::select(const QString &filePath, const QStringList &allSelectors) const
+QString QQuickStyleSelectorPrivate::select(const QString &filePath) const
{
QFileInfo fi(filePath);
// If file doesn't exist, don't select
@@ -139,7 +133,7 @@ QString QQuickStyleSelectorPrivate::select(const QString &filePath, const QStrin
return filePath;
QString ret = selectionHelper(fi.path().isEmpty() ? QString() : fi.path() + QLatin1Char('/'),
- fi.fileName(), allSelectors);
+ fi.fileName(), allSelectors());
if (!ret.isEmpty())
return ret;
@@ -158,14 +152,13 @@ void QQuickStyleSelector::setStyle(const QString &s)
d->style = s;
}
-QStringList QQuickStyleSelector::allSelectors() const
+QStringList QQuickStyleSelectorPrivate::allSelectors() const
{
- Q_D(const QQuickStyleSelector);
QMutexLocker locker(&sharedDataMutex);
- QQuickStyleSelectorPrivate::updateSelectors();
+ updateSelectors();
QStringList selectors = sharedData->staticSelectors;
- if (!d->style.isEmpty())
- selectors.prepend(d->style);
+ if (!style.isEmpty())
+ selectors.prepend(style);
return selectors;
}
diff --git a/src/controls/qquickstyleselector_p.h b/src/controls/qquickstyleselector_p.h
index 64319098..2ca6ea3a 100644
--- a/src/controls/qquickstyleselector_p.h
+++ b/src/controls/qquickstyleselector_p.h
@@ -47,7 +47,6 @@
//
#include <QtCore/qurl.h>
-#include <QtCore/qstringlist.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_NAMESPACE
@@ -64,14 +63,10 @@ public:
QString style() const;
void setStyle(const QString &s);
- QStringList allSelectors() const;
-
void setBaseUrl(const QUrl &base);
QUrl baseUrl() const;
private:
- QUrl select(const QUrl &filePath) const;
-
Q_DECLARE_PRIVATE(QQuickStyleSelector)
QScopedPointer<QQuickStyleSelectorPrivate> d_ptr;
};
diff --git a/src/controls/qquickstyleselector_p_p.h b/src/controls/qquickstyleselector_p_p.h
index b0de326b..e4df1035 100644
--- a/src/controls/qquickstyleselector_p_p.h
+++ b/src/controls/qquickstyleselector_p_p.h
@@ -49,6 +49,7 @@
#include <QtCore/QString>
#include <QtCore/QUrl>
#include <private/qobject_p.h>
+#include <QtCore/qstringlist.h>
#include "qquickstyleselector_p.h"
@@ -67,7 +68,8 @@ public:
static QStringList platformSelectors();
static void addStatics(const QStringList &); //For loading GUI statics from other Qt modules
QQuickStyleSelectorPrivate();
- QString select(const QString &filePath, const QStringList &allSelectors) const;
+ QString select(const QString &filePath) const;
+ QStringList allSelectors() const;
QString style;
QUrl baseUrl;