QWidget windows have fullscreen button by default; manual test for it

It's again possible for QWindows and widget windows to go into
fullscreen mode on the Mac.

Change-Id: I7b304a135838394ef0392f89be4f225f2949fad3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Shawn Rutledge 2012-11-28 19:46:04 +01:00 committed by The Qt Project
parent 134f5e0cce
commit c8dc41bacd
6 changed files with 19 additions and 8 deletions

View File

@ -384,6 +384,9 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
} }
} }
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug("windowStyleMask of '%s': flags %X -> styleMask %lX", qPrintable(window()->title()), (int)flags, styleMask);
#endif
return styleMask; return styleMask;
} }

View File

@ -1080,8 +1080,8 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
else if (type == Qt::Tool) else if (type == Qt::Tool)
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
else else
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint; flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint |
Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint;
} }

View File

@ -2092,6 +2092,7 @@ void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags)
windowFlags = Qt::FramelessWindowHint; windowFlags = Qt::FramelessWindowHint;
windowFlags &= ~windowType; windowFlags &= ~windowType;
windowFlags &= ~Qt::WindowFullscreenButtonHint;
windowFlags |= Qt::SubWindow; windowFlags |= Qt::SubWindow;
#ifndef QT_NO_ACTION #ifndef QT_NO_ACTION

View File

@ -59,6 +59,7 @@ HintControl::HintControl(QWidget *parent)
, windowSystemMenuCheckBox(new QCheckBox(tr("Window system menu"))) , windowSystemMenuCheckBox(new QCheckBox(tr("Window system menu")))
, windowMinimizeButtonCheckBox(new QCheckBox(tr("Window minimize button"))) , windowMinimizeButtonCheckBox(new QCheckBox(tr("Window minimize button")))
, windowMaximizeButtonCheckBox(new QCheckBox(tr("Window maximize button"))) , windowMaximizeButtonCheckBox(new QCheckBox(tr("Window maximize button")))
, windowFullscreenButtonCheckBox(new QCheckBox(tr("Window fullscreen button")))
, windowCloseButtonCheckBox(new QCheckBox(tr("Window close button"))) , windowCloseButtonCheckBox(new QCheckBox(tr("Window close button")))
, windowContextHelpButtonCheckBox(new QCheckBox(tr("Window context help button"))) , windowContextHelpButtonCheckBox(new QCheckBox(tr("Window context help button")))
, windowShadeButtonCheckBox(new QCheckBox(tr("Window shade button"))) , windowShadeButtonCheckBox(new QCheckBox(tr("Window shade button")))
@ -74,6 +75,7 @@ HintControl::HintControl(QWidget *parent)
connect(windowSystemMenuCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowSystemMenuCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowMinimizeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowMinimizeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowMaximizeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowMaximizeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowFullscreenButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowCloseButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowCloseButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowContextHelpButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowContextHelpButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
connect(windowShadeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged())); connect(windowShadeButtonCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
@ -91,11 +93,12 @@ HintControl::HintControl(QWidget *parent)
layout->addWidget(windowSystemMenuCheckBox, 4, 0); layout->addWidget(windowSystemMenuCheckBox, 4, 0);
layout->addWidget(windowMinimizeButtonCheckBox, 0, 1); layout->addWidget(windowMinimizeButtonCheckBox, 0, 1);
layout->addWidget(windowMaximizeButtonCheckBox, 1, 1); layout->addWidget(windowMaximizeButtonCheckBox, 1, 1);
layout->addWidget(windowCloseButtonCheckBox, 2, 1); layout->addWidget(windowFullscreenButtonCheckBox, 2, 1);
layout->addWidget(windowContextHelpButtonCheckBox, 3, 1); layout->addWidget(windowCloseButtonCheckBox, 3, 1);
layout->addWidget(windowShadeButtonCheckBox, 4, 1); layout->addWidget(windowContextHelpButtonCheckBox, 4, 1);
layout->addWidget(windowStaysOnTopCheckBox, 5, 1); layout->addWidget(windowShadeButtonCheckBox, 5, 1);
layout->addWidget(windowStaysOnBottomCheckBox, 6, 1); layout->addWidget(windowStaysOnTopCheckBox, 6, 1);
layout->addWidget(windowStaysOnBottomCheckBox, 7, 1);
layout->addWidget(customizeWindowHintCheckBox, 5, 0); layout->addWidget(customizeWindowHintCheckBox, 5, 0);
layout->addWidget(transparentForInputCheckBox, 6, 0); layout->addWidget(transparentForInputCheckBox, 6, 0);
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
@ -120,6 +123,8 @@ Qt::WindowFlags HintControl::hints() const
flags |= Qt::WindowMinimizeButtonHint; flags |= Qt::WindowMinimizeButtonHint;
if (windowMaximizeButtonCheckBox->isChecked()) if (windowMaximizeButtonCheckBox->isChecked())
flags |= Qt::WindowMaximizeButtonHint; flags |= Qt::WindowMaximizeButtonHint;
if (windowFullscreenButtonCheckBox->isChecked())
flags |= Qt::WindowFullscreenButtonHint;
if (windowCloseButtonCheckBox->isChecked()) if (windowCloseButtonCheckBox->isChecked())
flags |= Qt::WindowCloseButtonHint; flags |= Qt::WindowCloseButtonHint;
if (windowContextHelpButtonCheckBox->isChecked()) if (windowContextHelpButtonCheckBox->isChecked())
@ -148,6 +153,7 @@ void HintControl::setHints(Qt::WindowFlags flags)
windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint); windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint);
windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint); windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint);
windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint); windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint);
windowFullscreenButtonCheckBox->setChecked(flags & Qt::WindowFullscreenButtonHint);
windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint); windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint);
windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint); windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint);
windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint); windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint);

View File

@ -76,6 +76,7 @@ private:
QCheckBox *windowSystemMenuCheckBox; QCheckBox *windowSystemMenuCheckBox;
QCheckBox *windowMinimizeButtonCheckBox; QCheckBox *windowMinimizeButtonCheckBox;
QCheckBox *windowMaximizeButtonCheckBox; QCheckBox *windowMaximizeButtonCheckBox;
QCheckBox *windowFullscreenButtonCheckBox;
QCheckBox *windowCloseButtonCheckBox; QCheckBox *windowCloseButtonCheckBox;
QCheckBox *windowContextHelpButtonCheckBox; QCheckBox *windowContextHelpButtonCheckBox;
QCheckBox *windowShadeButtonCheckBox; QCheckBox *windowShadeButtonCheckBox;

View File

@ -456,7 +456,7 @@ ControllerWidget::ControllerWidget(QWidget *parent)
x += 300; x += 300;
m_testWindow->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint m_testWindow->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint
| Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
| Qt::WindowTitleHint); | Qt::WindowTitleHint | Qt::WindowFullscreenButtonHint);
m_testWindow->setFramePosition(QPoint(x, y)); m_testWindow->setFramePosition(QPoint(x, y));
m_testWindow->resize(200, 200); m_testWindow->resize(200, 200);
if (args.contains(QLatin1String("-windowminimized"), Qt::CaseInsensitive)) if (args.contains(QLatin1String("-windowminimized"), Qt::CaseInsensitive))