summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-02-20 11:50:04 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-02-20 22:08:29 +0100
commitdcb710dd87ab15c3af803133ff2449902dbec036 (patch)
tree1f3ed87165f05e45260ff45fb15d5df96d684abb /src/widgets/widgets
parent4606ea53958df33fffba680dd75c8b1733ca9f40 (diff)
parente47c2744e6cefa42fc70320e07d534742934f737 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: mkspecs/features/unix/separate_debug_info.prf src/gui/kernel/qwindow_p.h src/plugins/platforms/cocoa/qcocoacursor.mm tests/auto/tools/moc/tst_moc.cpp Change-Id: Ieb57834c00f961a747ffe51e6eb9fc9612cebccf
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qdockwidget.cpp14
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp31
2 files changed, 27 insertions, 18 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index c5694d9d8c..a2e363f991 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1000,6 +1000,14 @@ void QDockWidgetPrivate::plug(const QRect &rect)
setWindowState(false, false, rect);
}
+static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled)
+{
+ if (const QWindow *window = w->windowHandle())
+ if (QPlatformWindow *platformWindow = window->handle())
+ if (platformWindow->frameStrutEventsEnabled() != enabled)
+ platformWindow->setFrameStrutEventsEnabled(enabled);
+}
+
void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect)
{
Q_Q(QDockWidget);
@@ -1053,9 +1061,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
}
if (floating && nativeDeco)
- if (const QWindow *window = q->windowHandle())
- if (QPlatformWindow *platformWindow = window->handle())
- platformWindow->setFrameStrutEventsEnabled(true);
+ setFrameStrutEventsEnabled(q, true);
resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco);
}
@@ -1391,6 +1397,8 @@ bool QDockWidget::event(QEvent *event)
emit visibilityChanged(false);
break;
case QEvent::Show:
+ if (static_cast<QDockWidgetLayout *>(QDockWidget::layout())->nativeWindowDeco(isFloating()))
+ setFrameStrutEventsEnabled(this, true);
d->toggleViewAction->setChecked(true);
emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
break;
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index a3219e69d7..7ea2369ba5 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -160,7 +160,7 @@
#include <QMainWindow>
#include <QScrollBar>
#include <QDebug>
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
#include <private/qmacstyle_mac_p.h>
#endif
#include <QMdiArea>
@@ -296,7 +296,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
Q_ASSERT(widget);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
// Native Mac windows don't show tool tip.
if (qobject_cast<QMacStyle *>(widget->style()))
return;
@@ -1071,7 +1071,7 @@ void QMdiSubWindowPrivate::updateCursor()
{
#ifndef QT_NO_CURSOR
Q_Q(QMdiSubWindow);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
return;
#endif
@@ -1491,7 +1491,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMinButton:
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMinimized())
q->showNormal();
@@ -1508,7 +1508,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMaxButton:
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMaximized())
q->showNormal();
@@ -1555,7 +1555,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
}
QRegion region;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
return region;
#endif
@@ -1709,7 +1709,7 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co
}
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
// ### Fix mac style, the +4 pixels hack is not necessary anymore
if (qobject_cast<QMacStyle *>(q->style()))
height -= 4;
@@ -1764,7 +1764,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (isChildOfTabbedQMdiArea(q))
return false;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM)
return true;
#else
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
@@ -2172,7 +2172,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
bool putSizeGripInLayout = layout ? true : false;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
putSizeGripInLayout = false;
#endif
@@ -2228,7 +2228,8 @@ void QMdiSubWindowPrivate::updateInternalWindowTitle()
Note that only \l{QMdiSubWindow}s can be set as children of
QMdiArea; you cannot, for instance, write:
- \badcode
+ \code
+ //bad code
QMdiArea mdiArea;
QTextEdit editor(&mdiArea); // invalid child widget
\endcode
@@ -2255,7 +2256,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
d->titleBarPalette = d->desktopPalette();
d->font = QApplication::font("QMdiSubWindowTitleBar");
// We don't want the menu icon by default on mac.
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
if (windowIcon().isNull())
d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
else
@@ -2823,7 +2824,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()))
delete d->sizeGrip;
#endif
@@ -2918,7 +2919,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
return;
}
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
&& !(windowFlags() & Qt::FramelessWindowHint)) {
d->setSizeGrip(new QSizeGrip(0));
@@ -3312,7 +3313,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
d->hoveredSubControl, this);
}
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
#endif
@@ -3522,7 +3523,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
sizeGripHeight = d->sizeGrip->height();
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
#endif