summaryrefslogtreecommitdiffstats
path: root/src/designer/src/designer
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-04-29 10:41:07 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-04-30 10:37:04 +0200
commit5ac442521c252c6294a04de012243436e3ce2411 (patch)
tree76be899389079384d273d782e730d46fda28fad0 /src/designer/src/designer
parente633ec59893e2f4a25330be8a9ece4a943cfcef9 (diff)
Qt Designer: Add command line option for AA_DisableHighDpiScaling
Pick-to: 5.15 Fixes: QTBUG-83858 Change-Id: Ib0663aa7c98c8f0ae47907f87665c564e5b96186 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/designer')
-rw-r--r--src/designer/src/designer/main.cpp18
-rw-r--r--src/designer/src/designer/qdesigner.cpp4
2 files changed, 20 insertions, 2 deletions
diff --git a/src/designer/src/designer/main.cpp b/src/designer/src/designer/main.cpp
index e5e31ca16..cd428bd4f 100644
--- a/src/designer/src/designer/main.cpp
+++ b/src/designer/src/designer/main.cpp
@@ -34,12 +34,26 @@
QT_USE_NAMESPACE
+static bool isOptionSet(int argc, char *argv[], const char *option)
+{
+ for (int i = 1; i < argc; ++i) {
+ if (qstrcmp(argv[i], option) == 0)
+ return true;
+ }
+ return false;
+}
+
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(designer);
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+ // Attributes to be set before QApplication is constructed.
+ if (isOptionSet(argc, argv, "--no-scaling")) {
+ QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
+ } else {
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+ }
// required for QWebEngineView
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp
index 4344b1c07..75ab2b01b 100644
--- a/src/designer/src/designer/qdesigner.cpp
+++ b/src/designer/src/designer/qdesigner.cpp
@@ -188,6 +188,10 @@ static inline QDesigner::ParseArgumentsResult
const QCommandLineOption internalDynamicPropertyOption(QStringLiteral("enableinternaldynamicproperties"),
QStringLiteral("Enable internal dynamic properties"));
parser.addOption(internalDynamicPropertyOption);
+ const QCommandLineOption noScalingOption(QStringLiteral("no-scaling"),
+ QStringLiteral("Disable High DPI scaling"));
+ parser.addOption(noScalingOption);
+
parser.addPositionalArgument(QStringLiteral("files"),
QStringLiteral("The UI files to open."));