summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-04 13:59:25 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-05 08:03:46 (GMT)
commitdecc287134139c61da5610afc060a6ca8d09f368 (patch)
tree0e4119380fac7c55fd30f91031a8767e0de0af06
parent7e8e53cded4622ac35ff115e26e074de6722d1a0 (diff)
downloadQt-decc287134139c61da5610afc060a6ca8d09f368.zip
Qt-decc287134139c61da5610afc060a6ca8d09f368.tar.gz
Qt-decc287134139c61da5610afc060a6ca8d09f368.tar.bz2
Cocoa: Menus show old selected values.
We never told Cocoa that it needed to redraw the window view when a window was shown. This is implicit if the window is shown for the first time, but needs to be done explicit if you hide and show it again. Task-number: 254672 Reviewed-by: bnilsen
-rw-r--r--src/gui/kernel/qwidget_mac.mm6
-rw-r--r--tests/auto/qwidget_window/tst_qwidget_window.cpp24
2 files changed, 29 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 8913c89..057df81 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3249,6 +3249,12 @@ void QWidgetPrivate::show_sys()
#ifndef QT_MAC_USE_COCOA
SizeWindow(window, q->width(), q->height(), true);
#endif
+
+#ifdef QT_MAC_USE_COCOA
+ // Make sure that we end up sending a repaint event to
+ // the widget if the window has been visible one before:
+ [qt_mac_get_contentview_for(window) setNeedsDisplay:YES];
+#endif
if(qt_mac_is_macsheet(q)) {
qt_event_request_showsheet(q);
} else if(qt_mac_is_macdrawer(q)) {
diff --git a/tests/auto/qwidget_window/tst_qwidget_window.cpp b/tests/auto/qwidget_window/tst_qwidget_window.cpp
index f059abe..6dddfe8 100644
--- a/tests/auto/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/qwidget_window/tst_qwidget_window.cpp
@@ -78,6 +78,7 @@ private slots:
void tst_windowFilePath();
void tst_showWithoutActivating();
+ void tst_paintEventOnSecondShow();
};
void tst_QWidget_window::initTestCase()
@@ -150,7 +151,9 @@ class TestWidget : public QWidget
{
public:
int m_first, m_next;
- void reset(){ m_first = m_next = 0; }
+ bool paintEventReceived;
+
+ void reset(){ m_first = m_next = 0; paintEventReceived = false; }
bool event(QEvent *event)
{
switch (event->type()) {
@@ -162,6 +165,10 @@ public:
m_next = event->type();
else
m_first = event->type();
+ break;
+ case QEvent::Paint:
+ paintEventReceived = true;
+ break;
default:
break;
}
@@ -300,5 +307,20 @@ void tst_QWidget_window::tst_showWithoutActivating()
#endif // Q_WS_X11
}
+void tst_QWidget_window::tst_paintEventOnSecondShow()
+{
+ TestWidget w;
+ w.show();
+ w.hide();
+
+ w.reset();
+ w.show();
+#ifdef Q_WS_X11
+ QTest::qWait(500);
+#endif
+ QApplication::processEvents();
+ QVERIFY(w.paintEventReceived);
+}
+
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"