aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-28 15:46:51 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-29 15:24:37 +0000
commit8d622ea022298b5296962475aec486a38e8c0d03 (patch)
tree03d999386b0b452593ecbfbf58e7141c6d64035c /src
parenteb61b50ffc8e3f6640de14b4b256f2ed858100a1 (diff)
QQuickStyleSelector: merge select() overloads
Only one is used. Cleanup the API a bit by merging the two. Change-Id: I90d72e754442aef45e9d1bc3f86004cad511a726 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/qquickstyleselector.cpp28
-rw-r--r--src/controls/qquickstyleselector_p.h2
2 files changed, 11 insertions, 19 deletions
diff --git a/src/controls/qquickstyleselector.cpp b/src/controls/qquickstyleselector.cpp
index 49b2aa17..85b54045 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, allSelectors());
+ url.setPath(selectedPath.remove(0, 1));
+ } else {
+ url = QUrl::fromLocalFile(d->select(url.toLocalFile(), allSelectors()));
+ }
}
- return ret;
+ return url.toString();
}
static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
diff --git a/src/controls/qquickstyleselector_p.h b/src/controls/qquickstyleselector_p.h
index 64319098..17204c32 100644
--- a/src/controls/qquickstyleselector_p.h
+++ b/src/controls/qquickstyleselector_p.h
@@ -70,8 +70,6 @@ public:
QUrl baseUrl() const;
private:
- QUrl select(const QUrl &filePath) const;
-
Q_DECLARE_PRIVATE(QQuickStyleSelector)
QScopedPointer<QQuickStyleSelectorPrivate> d_ptr;
};