summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-27 15:34:10 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-27 15:34:10 +0200
commit518cf3312c101ea1c5ae5199611ebda46a74dadd (patch)
treefe580d423d8938caad9d6705c7ef9da13d2d8e14 /src/corelib/kernel
parent59937de098dd86472e73146bd0c84e980022e24d (diff)
parent65cfac73bd1c09eafadf57a3b7161f52b186c37d (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp26
-rw-r--r--src/corelib/kernel/qmetaobject.h3
2 files changed, 28 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 625790abb8..b70c61e351 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -46,6 +46,7 @@
#include "qcoreevent.h"
#include "qeventloop.h"
#endif
+#include "qmetaobject.h"
#include "qcorecmdlineargs_p.h"
#include <qdatastream.h>
#include <qdebug.h>
@@ -952,6 +953,10 @@ bool QCoreApplication::isSetuidAllowed()
Sets the attribute \a attribute if \a on is true;
otherwise clears the attribute.
+ \note Some application attributes must be set \b before creating a
+ QCoreApplication instance. Refer to the Qt::ApplicationAttribute
+ documentation for more information.
+
\sa testAttribute()
*/
void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
@@ -960,6 +965,27 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
QCoreApplicationPrivate::attribs |= 1 << attribute;
else
QCoreApplicationPrivate::attribs &= ~(1 << attribute);
+ if (Q_UNLIKELY(qApp)) {
+ switch (attribute) {
+ case Qt::AA_EnableHighDpiScaling:
+ case Qt::AA_DisableHighDpiScaling:
+ case Qt::AA_PluginApplication:
+ case Qt::AA_UseDesktopOpenGL:
+ case Qt::AA_UseOpenGLES:
+ case Qt::AA_UseSoftwareOpenGL:
+ case Qt::AA_ShareOpenGLContexts:
+#ifdef QT_BOOTSTRAPPED
+ qWarning("Attribute %d must be set before QCoreApplication is created.",
+ attribute);
+#else
+ qWarning("Attribute Qt::%s must be set before QCoreApplication is created.",
+ QMetaEnum::fromType<Qt::ApplicationAttribute>().valueToKey(attribute));
+#endif
+ break;
+ default:
+ break;
+ }
+ }
}
/*!
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 10b14a7e03..fcd92afd89 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -230,7 +230,8 @@ public:
template<typename T> static QMetaEnum fromType() {
Q_STATIC_ASSERT_X(QtPrivate::IsQEnumHelper<T>::Value,
- "QMetaEnum::fromType only works with enums declared as Q_ENUM or Q_FLAG");
+ "QMetaEnum::fromType only works with enums declared as "
+ "Q_ENUM, Q_ENUM_NS, Q_FLAG or Q_FLAG_NS");
const QMetaObject *metaObject = qt_getEnumMetaObject(T());
const char *name = qt_getEnumName(T());
return metaObject->enumerator(metaObject->indexOfEnumerator(name));