diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 4 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 12e5dbd66c..66f1b1dfce 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -128,6 +128,8 @@ Qt::MouseButtons QGuiApplicationPrivate::tabletState = Qt::NoButton; QWindow *QGuiApplicationPrivate::tabletPressTarget = 0; QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; +QString QGuiApplicationPrivate::styleOverride; + Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; bool QGuiApplicationPrivate::highDpiScalingUpdated = false; @@ -1288,6 +1290,7 @@ void QGuiApplicationPrivate::init() session_key = QString::fromWCharArray(guidstr); # endif #endif + QString s; int j = argc ? 1 : 0; for (int i=1; i<argc; i++) { if (argv[i] && *argv[i] != '-') { @@ -1330,9 +1333,16 @@ void QGuiApplicationPrivate::init() #endif } else if (arg == "-testability") { loadTestability = true; + } else if (arg.indexOf("-style=", 0) != -1) { + s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); + } else if (arg == "-style" && i < argc-1) { + s = QString::fromLocal8Bit(argv[++i]).toLower(); } else { argv[j++] = argv[i]; } + + if (!s.isEmpty()) + styleOverride = s; } if (j < argc) { diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 7d8deab507..4d5797a8fa 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -221,6 +221,7 @@ public: static QFont *app_font; + static QString styleOverride; static QStyleHints *styleHints; static bool obey_desktop_settings; QInputMethod *inputMethod; diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index ea3b75c81c..8757715c0d 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -484,7 +484,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co { QPlatformScreen *currentScreen = screen(); QPlatformScreen *fallback = currentScreen; - QPoint center = newGeometry.center(); + //QRect::center can return a value outside the rectangle if it's empty + const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center(); + if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) { Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { if (screen->geometry().contains(center)) |