summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2019-09-28 13:26:47 +0300
committerBogDan Vatra <bogdan@kde.org>2019-10-01 18:35:19 +0300
commit6eac099fa98b6dbe5a01ad90e4a1348729b1332b (patch)
tree799679e34641a47ff23d00256e45d94d58af3c1d
parent4f6bb86d24041d565ac3467df93593a150010825 (diff)
downloadqtquickcontrols-6eac099fa98b6dbe5a01ad90e4a1348729b1332b.tar.gz
Android: Always load qml files from resourcesv5.14.0-beta1
The QML files on Android are now available in :/android_rcc_bundle/qml folder, this way we don't need to extract them at very first start up. [ChangeLog][Android] Always load qml files from resources (:/android_rcc_bundle/qml) Change-Id: Ib905e5d5e1577d99bb89e7e0d237fa8b24a1e95f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/controls/Styles/Android/qquickandroidstyle.cpp6
-rw-r--r--src/controls/Styles/Android/qquickandroidstyle_p.h3
-rw-r--r--src/controls/plugin.cpp20
3 files changed, 19 insertions, 10 deletions
diff --git a/src/controls/Styles/Android/qquickandroidstyle.cpp b/src/controls/Styles/Android/qquickandroidstyle.cpp
index 0c57d795..36fe0e82 100644
--- a/src/controls/Styles/Android/qquickandroidstyle.cpp
+++ b/src/controls/Styles/Android/qquickandroidstyle.cpp
@@ -85,11 +85,11 @@ QByteArray QQuickAndroidStyle1::data() const
return m_data;
}
-QString QQuickAndroidStyle1::filePath(const QString &fileName) const
+QUrl QQuickAndroidStyle1::filePath(const QString &fileName) const
{
if (!fileName.isEmpty())
- return m_path + QFileInfo(fileName).fileName();
- return QString();
+ return QUrl::fromLocalFile(m_path + QFileInfo(fileName).fileName());
+ return {};
}
QColor QQuickAndroidStyle1::colorValue(uint value) const
diff --git a/src/controls/Styles/Android/qquickandroidstyle_p.h b/src/controls/Styles/Android/qquickandroidstyle_p.h
index 6911eb8d..856b5753 100644
--- a/src/controls/Styles/Android/qquickandroidstyle_p.h
+++ b/src/controls/Styles/Android/qquickandroidstyle_p.h
@@ -41,6 +41,7 @@
#define QQUICKANDROIDSTYLE_P_H
#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
#include <QtGui/qcolor.h>
QT_BEGIN_NAMESPACE
@@ -57,7 +58,7 @@ public:
QByteArray data() const;
Q_INVOKABLE QColor colorValue(uint value) const;
- Q_INVOKABLE QString filePath(const QString &fileName) const;
+ Q_INVOKABLE QUrl filePath(const QString &fileName) const;
enum Gravity {
NO_GRAVITY = 0x0000,
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index 82eef800..6d34f285 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -239,30 +239,38 @@ void QtQuickControls1Plugin::initializeEngine(QQmlEngine *engine, const char *ur
QString QtQuickControls1Plugin::fileLocation() const
{
-#ifndef QT_STATIC
+#ifdef Q_OS_ANDROID
+ return "qrc:/android_rcc_bundle/qml/QtQuick/Controls";
+#else
+# ifndef QT_STATIC
if (isLoadedFromResource())
return "qrc:/QtQuick/Controls";
return baseUrl().toString();
-#else
+# else
return "qrc:/qt-project.org/imports/QtQuick/Controls";
+# endif
#endif
}
bool QtQuickControls1Plugin::isLoadedFromResource() const
{
-#ifdef QT_STATIC
+#ifdef Q_OS_ANDROID
+ return true;
+#else
+# ifdef QT_STATIC
// When static it is included automatically
// for us.
return false;
-#endif
-#if defined(ALWAYS_LOAD_FROM_RESOURCES)
+# endif
+# if defined(ALWAYS_LOAD_FROM_RESOURCES)
return true;
-#else
+# else
// If one file is missing, it will load all the files from the resource
QFile file(baseUrl().toLocalFile() + "/ApplicationWindow.qml");
if (!file.exists())
return true;
return false;
+# endif
#endif
}