summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-07-30 15:03:53 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-07-30 15:13:32 (GMT)
commit71961def3b006d042fb6f2d46e5f40d527553dc0 (patch)
treee96f808dd88098674d34febc4ae9c7cdd7bdba43
parent989e195a4b7b0eb579dc4418dd47c2eca7e8b384 (diff)
downloadQt-71961def3b006d042fb6f2d46e5f40d527553dc0.zip
Qt-71961def3b006d042fb6f2d46e5f40d527553dc0.tar.gz
Qt-71961def3b006d042fb6f2d46e5f40d527553dc0.tar.bz2
Disabling the close button didn't work correctly
Close button was enabled if the native window handle was created implicitely (for example by the setWindowTitle() function). Moved the code that enables of disables the close button to the place where we create native window handle. Task-number: 256360 Reviewed-by: trustme
-rw-r--r--src/gui/kernel/qwidget_win.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 455d06d..2f230d7 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -467,6 +467,17 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
}
+ if (topLevel) {
+ if (data.window_flags & Qt::CustomizeWindowHint
+ && data.window_flags & Qt::WindowTitleHint) {
+ HMENU systemMenu = GetSystemMenu((HWND)q->internalWinId(), FALSE);
+ if (data.window_flags & Qt::WindowCloseButtonHint)
+ EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
+ else
+ EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
+ }
+ }
+
q->setAttribute(Qt::WA_WState_Created); // accept move/resize events
hd = 0; // no display context
@@ -638,16 +649,6 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
|| (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
q->setAttribute(Qt::WA_DropSiteRegistered, true);
-
- if (data.window_flags & Qt::CustomizeWindowHint
- && data.window_flags & Qt::WindowTitleHint) {
- HMENU systemMenu = GetSystemMenu((HWND)q->internalWinId(), FALSE);
- if (data.window_flags & Qt::WindowCloseButtonHint)
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
- else
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
- }
-
#ifdef Q_WS_WINCE
// Show borderless toplevel windows in tasklist & NavBar
if (!parent) {