aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlengine.cpp6
-rw-r--r--src/qml/qml/qqmlimport.cpp36
-rw-r--r--src/qml/qml/qqmlprivate.h12
3 files changed, 33 insertions, 21 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index a92162aa74..debf740358 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -491,6 +491,12 @@ The following functions are also on the Qt object.
\li \c application.domain
\li This is the organization domain set on the QCoreApplication instance. This property can be written
to in order to set the organization domain.
+
+ \row
+ \li \c application.supportsMultipleWindows
+ \li This read-only property can be used to determine whether or not the
+ platform supports multiple windows. Some embedded platforms do not support
+ multiple windows, for example.
\endtable
The object also has one signal, aboutToQuit(), which is the same as \l QCoreApplication::aboutToQuit().
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index df4006d3c2..807eb05362 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -63,7 +63,8 @@ static const QLatin1Char Backslash('\\');
static const QLatin1Char Colon(':');
static const QLatin1String Slash_qmldir("/qmldir");
static const QLatin1String String_qmldir("qmldir");
-static const QString dotqml_string(QLatin1String(".qml"));
+static const QString dotqml_string(QStringLiteral(".qml"));
+static const QString dotuidotqml_string(QStringLiteral(".ui.qml"));
static bool designerSupportRequired = false;
namespace {
@@ -657,23 +658,28 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
return (*type_return != 0);
}
} else if (!isLibrary) {
- QString qmlUrl = url + QString::fromRawData(type.constData(), type.length()) + dotqml_string;
-
+ QString qmlUrl;
bool exists = false;
- if (QQmlFile::isBundle(qmlUrl)) {
- exists = QQmlFile::bundleFileExists(qmlUrl, typeLoader->engine());
- } else {
- exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(qmlUrl)).isEmpty();
- if (!exists) {
- QString formUrl = url + QString::fromRawData(type.constData(), type.length()) + QStringLiteral(".ui.qml");
- if (!typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(formUrl)).isEmpty()) {
- exists = true;
- qmlUrl = formUrl;
- }
+ const QString urlsToTry[2] = {
+ url + QString::fromRawData(type.constData(), type.length()) + dotqml_string, // Type -> Type.qml
+ url + QString::fromRawData(type.constData(), type.length()) + dotuidotqml_string // Type -> Type.ui.qml
+ };
+ for (uint i = 0; i < sizeof(urlsToTry) / sizeof(urlsToTry[0]); ++i) {
+ const QString url = urlsToTry[i];
+
+ if (QQmlFile::isBundle(url)) {
+ exists = QQmlFile::bundleFileExists(url, typeLoader->engine());
+ } else {
+ exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(url)).isEmpty();
+ if (!exists)
+ exists = QQmlMetaType::findCachedCompilationUnit(QUrl(url));
+ }
+
+ if (exists) {
+ qmlUrl = url;
+ break;
}
- if (!exists)
- exists = QQmlMetaType::findCachedCompilationUnit(QUrl(qmlUrl));
}
if (exists) {
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 29d2bc6193..dfbf04a50f 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -122,12 +122,12 @@ namespace QQmlPrivate
typedef int yes_type;
typedef char no_type;
- static yes_type check(To *);
- static no_type check(...);
+ static yes_type checkType(To *);
+ static no_type checkType(...);
static inline int cast()
{
- return StaticCastSelectorClass<From, To, sizeof(check(reinterpret_cast<From *>(0)))>::cast();
+ return StaticCastSelectorClass<From, To, sizeof(checkType(reinterpret_cast<From *>(0)))>::cast();
}
};
@@ -145,10 +145,10 @@ namespace QQmlPrivate
typedef char no_type;
template<typename ReturnType>
- static yes_type check(ReturnType *(*)(QObject *));
- static no_type check(...);
+ static yes_type checkType(ReturnType *(*)(QObject *));
+ static no_type checkType(...);
- static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type);
+ static bool const value = sizeof(checkType(&T::qmlAttachedProperties)) == sizeof(yes_type);
};
template <typename T>