Display sizegrip on QMdiSubWindows, even on 10.7 and later

We don't have 4-edge window resizing, so we need QSizeGrip to
be functional again in this case.

Task-number: QTBUG-32228
Change-Id: Ib66bc662f8bf0b521427755570bc1cd65fb28446
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
Gabriel de Dietrich 2013-07-12 14:42:06 +02:00 committed by The Qt Project
parent 4f71a272b5
commit 64caf7b1be
2 changed files with 19 additions and 5 deletions

View File

@ -69,6 +69,7 @@
#include <qheaderview.h>
#include <qlineedit.h>
#include <qmainwindow.h>
#include <qmdisubwindow.h>
#include <qmenubar.h>
#include <qpaintdevice.h>
#include <qpainter.h>
@ -849,8 +850,17 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
gbi.direction = QApplication::isRightToLeft() ? kThemeGrowLeft | kThemeGrowDown
: kThemeGrowRight | kThemeGrowDown;
gbi.size = sz == QAquaSizeSmall ? kHIThemeGrowBoxSizeSmall : kHIThemeGrowBoxSizeNormal;
if (HIThemeGetGrowBoxBounds(&p, &gbi, &r) == noErr)
ret = QSize(QSysInfo::MacintoshVersion <= QSysInfo::MV_10_6 ? r.size.width : 0, r.size.height);
if (HIThemeGetGrowBoxBounds(&p, &gbi, &r) == noErr) {
int width = 0;
// Snow Leopard and older get a size grip, as well as QMdiSubWindows.
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_6
#ifndef QT_NO_MDIAREA
|| (widg && widg->parentWidget() && qobject_cast<QMdiSubWindow *>(widg->parentWidget()))
#endif
)
width = r.size.width;
ret = QSize(width, r.size.height);
}
}
break;
case QStyle::CT_ComboBox:
@ -4333,8 +4343,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
case CE_ProgressBarGroove:
break;
case CE_SizeGrip: {
// We do not draw size grips on versions > 10.6
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6)
// We do not draw size grips on versions > 10.6 unless it's a QMdiSubWindow
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6
#ifndef QT_NO_MDIAREA
&& !(w && w->parentWidget() && qobject_cast<QMdiSubWindow *>(w->parentWidget()))
#endif
)
break;
if (w && w->testAttribute(Qt::WA_MacOpaqueSizeGrip)) {

View File

@ -2927,7 +2927,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
#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));
d->setSizeGrip(new QSizeGrip(this));
Q_ASSERT(d->sizeGrip);
if (isMinimized())
d->setSizeGripVisible(false);