summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 10:51:33 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 10:51:34 +0100
commit3061dc4abdfbd1a536918935d380872de6655521 (patch)
treeff440ed0c7d5816cc7e2874f73fdabfb0bce493f /src/gui
parent25b2b682d616dd52c3515f443e3d25fc0224f3a2 (diff)
parent9b8570c4e9359eb8b45b39c28aa9d8c140f3fc44 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformintegration.cpp14
-rw-r--r--src/gui/kernel/qplatformintegration.h1
-rw-r--r--src/gui/kernel/qstylehints.cpp3
-rw-r--r--src/gui/kernel/qwindow.cpp13
-rw-r--r--src/gui/painting/qpainter.cpp7
5 files changed, 27 insertions, 11 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 08a3b63ee4..26aaf931b3 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -364,6 +364,20 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 0;
}
+Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const
+{
+ // Leave popup-windows as is
+ if (flags & Qt::Popup & ~Qt::Window)
+ return Qt::WindowNoState;
+
+ if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool())
+ return Qt::WindowFullScreen;
+ else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
+ return Qt::WindowMaximized;
+
+ return Qt::WindowNoState;
+}
+
Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
{
return QGuiApplication::keyboardModifiers();
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d397270c10..580fc15233 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -152,6 +152,7 @@ public:
};
virtual QVariant styleHint(StyleHint hint) const;
+ virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const;
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
virtual QList<int> possibleKeys(const QKeyEvent *) const;
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 04ea9c27d5..68eb724454 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -176,6 +176,9 @@ int QStyleHints::cursorFlashTime() const
Returns \c true if the platform defaults to windows being fullscreen,
otherwise \c false.
+ \note The platform may still choose to show certain windows non-fullscreen,
+ such as popups or dialogs. This method only returns the default behavior.
+
\sa QWindow::show()
*/
bool QStyleHints::showIsFullScreen() const
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 4a40dd7e29..2e1d8f9976 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1651,18 +1651,17 @@ QObject *QWindow::focusObject() const
/*!
Shows the window.
- This equivalent to calling showFullScreen() or showNormal(), depending
- on whether the platform defaults to windows being fullscreen or not, and
- whether the window is a popup.
+ This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
+ depending on the platform's default behavior for the window type and flags.
- \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
+ \sa showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
*/
void QWindow::show()
{
- bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window;
- if (!isPopup && qApp->styleHints()->showIsFullScreen())
+ Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags);
+ if (defaultState == Qt::WindowFullScreen)
showFullScreen();
- else if (!isPopup && !(d_func()->windowFlags & Qt::Dialog & ~Qt::Window) && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
+ else if (defaultState == Qt::WindowMaximized)
showMaximized();
else
showNormal();
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 4c02abdfd5..424ed554a2 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -146,17 +146,16 @@ static inline uint line_emulation(uint emulation)
}
#ifndef QT_NO_DEBUG
-static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false)
+static bool qt_painter_thread_test(int devType, const char *what)
{
switch (devType) {
case QInternal::Image:
case QInternal::Printer:
case QInternal::Picture:
// can be drawn onto these devices safely from any thread
- if (extraCondition)
- break;
+ break;
default:
- if (!extraCondition && QThread::currentThread() != qApp->thread()) {
+ if (QThread::currentThread() != qApp->thread()) {
qWarning("QPainter: It is not safe to use %s outside the GUI thread", what);
return false;
}