Cocoa: Add QMdiSubWindow size grip back.
Change all Q_WS_MAC -> Q_OS_MAC in qmdisubwindow.cpp Remove QEXPECT_FAIL from tst_qmdisubwindow.cpp. Task-number: QTBUG-29434, QTBUG-25297 Change-Id: I299b87ab994e2d5ba93d5bbae48de0df1ac1c9d6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
4b42c91821
commit
73d32873cf
@ -160,7 +160,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QDebug>
|
#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>
|
#include <private/qmacstyle_mac_p.h>
|
||||||
#endif
|
#endif
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
@ -304,7 +304,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti
|
|||||||
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
|
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
|
||||||
Q_ASSERT(widget);
|
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.
|
// Native Mac windows don't show tool tip.
|
||||||
if (qobject_cast<QMacStyle *>(widget->style()))
|
if (qobject_cast<QMacStyle *>(widget->style()))
|
||||||
return;
|
return;
|
||||||
@ -1079,7 +1079,7 @@ void QMdiSubWindowPrivate::updateCursor()
|
|||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
Q_Q(QMdiSubWindow);
|
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()))
|
if (qobject_cast<QMacStyle *>(q->style()))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@ -1499,7 +1499,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
|
|||||||
q->showNormal();
|
q->showNormal();
|
||||||
break;
|
break;
|
||||||
case QStyle::SC_TitleBarMinButton:
|
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 (qobject_cast<QMacStyle *>(q->style())) {
|
||||||
if (q->isMinimized())
|
if (q->isMinimized())
|
||||||
q->showNormal();
|
q->showNormal();
|
||||||
@ -1516,7 +1516,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
|
|||||||
q->showNormal();
|
q->showNormal();
|
||||||
break;
|
break;
|
||||||
case QStyle::SC_TitleBarMaxButton:
|
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 (qobject_cast<QMacStyle *>(q->style())) {
|
||||||
if (q->isMaximized())
|
if (q->isMaximized())
|
||||||
q->showNormal();
|
q->showNormal();
|
||||||
@ -1563,7 +1563,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QRegion region;
|
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()))
|
if (qobject_cast<QMacStyle *>(q->style()))
|
||||||
return region;
|
return region;
|
||||||
#endif
|
#endif
|
||||||
@ -1717,7 +1717,7 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
|
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
|
// ### Fix mac style, the +4 pixels hack is not necessary anymore
|
||||||
if (qobject_cast<QMacStyle *>(q->style()))
|
if (qobject_cast<QMacStyle *>(q->style()))
|
||||||
height -= 4;
|
height -= 4;
|
||||||
@ -1772,7 +1772,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
|
|||||||
if (isChildOfTabbedQMdiArea(q))
|
if (isChildOfTabbedQMdiArea(q))
|
||||||
return false;
|
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;
|
return true;
|
||||||
#else
|
#else
|
||||||
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
|
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
|
||||||
@ -2180,7 +2180,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
|
|||||||
return;
|
return;
|
||||||
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
|
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
|
||||||
bool putSizeGripInLayout = layout ? true : false;
|
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()))
|
if (qobject_cast<QMacStyle *>(q->style()))
|
||||||
putSizeGripInLayout = false;
|
putSizeGripInLayout = false;
|
||||||
#endif
|
#endif
|
||||||
@ -2263,7 +2263,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
d->titleBarPalette = d->desktopPalette();
|
d->titleBarPalette = d->desktopPalette();
|
||||||
d->font = QApplication::font("QMdiSubWindowTitleBar");
|
d->font = QApplication::font("QMdiSubWindowTitleBar");
|
||||||
// We don't want the menu icon by default on mac.
|
// We don't want the menu icon by default on mac.
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
if (windowIcon().isNull())
|
if (windowIcon().isNull())
|
||||||
d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
|
d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
|
||||||
else
|
else
|
||||||
@ -2831,7 +2831,7 @@ bool QMdiSubWindow::event(QEvent *event)
|
|||||||
d->isMaximizeMode = false;
|
d->isMaximizeMode = false;
|
||||||
d->isWidgetHiddenByUs = false;
|
d->isWidgetHiddenByUs = false;
|
||||||
if (!parent()) {
|
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()))
|
if (qobject_cast<QMacStyle *>(style()))
|
||||||
delete d->sizeGrip;
|
delete d->sizeGrip;
|
||||||
#endif
|
#endif
|
||||||
@ -2926,7 +2926,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
|
|||||||
return;
|
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
|
if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
|
||||||
&& !(windowFlags() & Qt::FramelessWindowHint)) {
|
&& !(windowFlags() & Qt::FramelessWindowHint)) {
|
||||||
d->setSizeGrip(new QSizeGrip(0));
|
d->setSizeGrip(new QSizeGrip(0));
|
||||||
@ -3320,7 +3320,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
|
|||||||
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
|
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
|
||||||
d->hoveredSubControl, this);
|
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())
|
if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
|
||||||
hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
|
hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
|
||||||
#endif
|
#endif
|
||||||
@ -3530,7 +3530,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
|
|||||||
int sizeGripHeight = 0;
|
int sizeGripHeight = 0;
|
||||||
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
|
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
|
||||||
sizeGripHeight = d->sizeGrip->height();
|
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)
|
else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
|
||||||
sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
|
sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
|
||||||
#endif
|
#endif
|
||||||
|
@ -600,9 +600,6 @@ void tst_QMdiSubWindow::showShaded()
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
mouseReceiver = window;
|
mouseReceiver = window;
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QEXPECT_FAIL("", "QTBUG-25297", Abort);
|
|
||||||
#endif
|
|
||||||
QVERIFY(mouseReceiver);
|
QVERIFY(mouseReceiver);
|
||||||
sendMouseMove(mouseReceiver, mousePosition, Qt::NoButton);
|
sendMouseMove(mouseReceiver, mousePosition, Qt::NoButton);
|
||||||
sendMousePress(mouseReceiver, mousePosition);
|
sendMousePress(mouseReceiver, mousePosition);
|
||||||
@ -711,9 +708,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
|
|||||||
mouseReceiver = qFindChild<QSizeGrip *>(window);
|
mouseReceiver = qFindChild<QSizeGrip *>(window);
|
||||||
else
|
else
|
||||||
mouseReceiver = window;
|
mouseReceiver = window;
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QEXPECT_FAIL("", "QTBUG-25297", Abort);
|
|
||||||
#endif
|
|
||||||
QVERIFY(mouseReceiver);
|
QVERIFY(mouseReceiver);
|
||||||
|
|
||||||
// ----------------------------- resize -----------------------------
|
// ----------------------------- resize -----------------------------
|
||||||
@ -1451,9 +1445,6 @@ void tst_QMdiSubWindow::defaultSizeGrip()
|
|||||||
// QSizeGrip on windows with decoration.
|
// QSizeGrip on windows with decoration.
|
||||||
QMdiSubWindow *windowWithDecoration = mdiArea.addSubWindow(new QWidget);
|
QMdiSubWindow *windowWithDecoration = mdiArea.addSubWindow(new QWidget);
|
||||||
windowWithDecoration->show();
|
windowWithDecoration->show();
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QEXPECT_FAIL("", "QTBUG-25297", Abort);
|
|
||||||
#endif
|
|
||||||
QVERIFY(qFindChild<QSizeGrip *>(windowWithDecoration));
|
QVERIFY(qFindChild<QSizeGrip *>(windowWithDecoration));
|
||||||
|
|
||||||
// ...but not on windows without decoration (Qt::FramelessWindowHint).
|
// ...but not on windows without decoration (Qt::FramelessWindowHint).
|
||||||
@ -1713,9 +1704,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
|
|||||||
// to minimize the window.
|
// to minimize the window.
|
||||||
subWindow->showMinimized();
|
subWindow->showMinimized();
|
||||||
QVERIFY(subWindow->isMinimized());
|
QVERIFY(subWindow->isMinimized());
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QEXPECT_FAIL("", "QTBUG-25297", Abort);
|
|
||||||
#endif
|
|
||||||
QCOMPARE(subWindow->size(), minimizedSize);
|
QCOMPARE(subWindow->size(), minimizedSize);
|
||||||
QCOMPARE(subWindow->minimumSize(), minimizedSize);
|
QCOMPARE(subWindow->minimumSize(), minimizedSize);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user