Introducing NoDropShadowWindowHint window flag
Added suppport on QCocoaWindow. Also we deprecate WA_MacNoShadow since it isn't used anywhere, and updated the 'windowflags' example app. Change-Id: Id0b453ba15a23b768b0615838597bca139f507ad Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
parent
d92fd4ca54
commit
b1893f7c49
@ -99,6 +99,8 @@ void ControllerWindow::updatePreview()
|
||||
flags |= Qt::X11BypassWindowManagerHint;
|
||||
if (framelessWindowCheckBox->isChecked())
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
if (windowNoShadowCheckBox->isChecked())
|
||||
flags |= Qt::NoDropShadowWindowHint;
|
||||
if (windowTitleCheckBox->isChecked())
|
||||
flags |= Qt::WindowTitleHint;
|
||||
if (windowSystemMenuCheckBox->isChecked())
|
||||
@ -171,6 +173,7 @@ void ControllerWindow::createHintsGroupBox()
|
||||
x11BypassWindowManagerCheckBox =
|
||||
createCheckBox(tr("X11 bypass window manager"));
|
||||
framelessWindowCheckBox = createCheckBox(tr("Frameless window"));
|
||||
windowNoShadowCheckBox = createCheckBox(tr("No drop shadow"));
|
||||
windowTitleCheckBox = createCheckBox(tr("Window title"));
|
||||
windowSystemMenuCheckBox = createCheckBox(tr("Window system menu"));
|
||||
windowMinimizeButtonCheckBox = createCheckBox(tr("Window minimize button"));
|
||||
@ -187,8 +190,9 @@ void ControllerWindow::createHintsGroupBox()
|
||||
layout->addWidget(msWindowsFixedSizeDialogCheckBox, 0, 0);
|
||||
layout->addWidget(x11BypassWindowManagerCheckBox, 1, 0);
|
||||
layout->addWidget(framelessWindowCheckBox, 2, 0);
|
||||
layout->addWidget(windowTitleCheckBox, 3, 0);
|
||||
layout->addWidget(windowSystemMenuCheckBox, 4, 0);
|
||||
layout->addWidget(windowNoShadowCheckBox, 3, 0);
|
||||
layout->addWidget(windowTitleCheckBox, 4, 0);
|
||||
layout->addWidget(windowSystemMenuCheckBox, 5, 0);
|
||||
layout->addWidget(windowMinimizeButtonCheckBox, 0, 1);
|
||||
layout->addWidget(windowMaximizeButtonCheckBox, 1, 1);
|
||||
layout->addWidget(windowCloseButtonCheckBox, 2, 1);
|
||||
@ -196,7 +200,7 @@ void ControllerWindow::createHintsGroupBox()
|
||||
layout->addWidget(windowShadeButtonCheckBox, 4, 1);
|
||||
layout->addWidget(windowStaysOnTopCheckBox, 5, 1);
|
||||
layout->addWidget(windowStaysOnBottomCheckBox, 6, 1);
|
||||
layout->addWidget(customizeWindowHintCheckBox, 5, 0);
|
||||
layout->addWidget(customizeWindowHintCheckBox, 6, 0);
|
||||
hintsGroupBox->setLayout(layout);
|
||||
}
|
||||
//! [6]
|
||||
|
@ -88,6 +88,7 @@ private:
|
||||
QCheckBox *msWindowsFixedSizeDialogCheckBox;
|
||||
QCheckBox *x11BypassWindowManagerCheckBox;
|
||||
QCheckBox *framelessWindowCheckBox;
|
||||
QCheckBox *windowNoShadowCheckBox;
|
||||
QCheckBox *windowTitleCheckBox;
|
||||
QCheckBox *windowSystemMenuCheckBox;
|
||||
QCheckBox *windowMinimizeButtonCheckBox;
|
||||
|
@ -94,6 +94,8 @@ void PreviewWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||
text += "\n| Qt::X11BypassWindowManagerHint";
|
||||
if (flags & Qt::FramelessWindowHint)
|
||||
text += "\n| Qt::FramelessWindowHint";
|
||||
if (flags & Qt::NoDropShadowWindowHint)
|
||||
text += "\n| Qt::NoDropShadowWindowHint";
|
||||
if (flags & Qt::WindowTitleHint)
|
||||
text += "\n| Qt::WindowTitleHint";
|
||||
if (flags & Qt::WindowSystemMenuHint)
|
||||
|
@ -312,7 +312,8 @@ public:
|
||||
WindowOkButtonHint = 0x00080000,
|
||||
WindowCancelButtonHint = 0x00100000,
|
||||
WindowSoftkeysVisibleHint = 0x40000000,
|
||||
WindowSoftkeysRespondHint = 0x80000000
|
||||
WindowSoftkeysRespondHint = 0x80000000,
|
||||
NoDropShadowWindowHint = 0x40000000
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(WindowFlags, WindowType)
|
||||
|
@ -1175,9 +1175,6 @@
|
||||
to this top level window. This attribute has no effect on non-X11
|
||||
platforms.
|
||||
|
||||
\value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows
|
||||
for this top level window. Only affects Cocoa builds of Qt for Mac OS X.
|
||||
|
||||
\omitvalue WA_SetLayoutDirection
|
||||
\omitvalue WA_InputMethodTransparent
|
||||
\omitvalue WA_WState_CompressKeys
|
||||
@ -1208,6 +1205,7 @@
|
||||
\omitvalue WA_SetWindowModality
|
||||
\omitvalue WA_WState_WindowOpacitySet
|
||||
\omitvalue WA_WState_AcceptedTouchBeginEvent
|
||||
\omitvalue WA_MacNoShadow
|
||||
*/
|
||||
|
||||
/*! \typedef Qt::HANDLE
|
||||
@ -1968,6 +1966,8 @@
|
||||
ability to understand Motif and/or NETWM hints. Most existing
|
||||
modern window managers can handle this.
|
||||
|
||||
\value NoDropShadowWindowHint Disables window drop shadow on supporting platforms.
|
||||
|
||||
The \c CustomizeWindowHint flag is used to enable customization of
|
||||
the window controls. This flag must be set to allow the \c
|
||||
WindowTitleHint, \c WindowSystemMenuHint, \c
|
||||
|
@ -122,6 +122,7 @@ public:
|
||||
|
||||
NSInteger windowLevel(Qt::WindowFlags flags);
|
||||
NSUInteger windowStyleMask(Qt::WindowFlags flags);
|
||||
void setWindowShadow(Qt::WindowFlags flags);
|
||||
|
||||
void setCurrentContext(QCocoaGLContext *context);
|
||||
QCocoaGLContext *currentContext() const;
|
||||
|
@ -370,6 +370,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
|
||||
return styleMask;
|
||||
}
|
||||
|
||||
void QCocoaWindow::setWindowShadow(Qt::WindowFlags flags)
|
||||
{
|
||||
bool keepShadow = !(flags & Qt::NoDropShadowWindowHint);
|
||||
[m_nsWindow setHasShadow:(keepShadow ? YES : NO)];
|
||||
}
|
||||
|
||||
Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||
{
|
||||
if (m_nsWindow) {
|
||||
@ -377,6 +383,7 @@ Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||
NSInteger level = this->windowLevel(flags);
|
||||
[m_nsWindow setStyleMask:styleMask];
|
||||
[m_nsWindow setLevel:level];
|
||||
setWindowShadow(flags);
|
||||
}
|
||||
|
||||
m_windowFlags = flags;
|
||||
@ -625,6 +632,7 @@ NSWindow * QCocoaWindow::createNSWindow()
|
||||
defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up
|
||||
// before the window is shown and needs a proper window.).
|
||||
window->m_cocoaPlatformWindow = this;
|
||||
setWindowShadow(flags);
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user