summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-05 16:52:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-05 16:52:36 (GMT)
commitfe239b32550e83e8a42617457adca8d7922ff92f (patch)
tree169cbe3b37b547f9f175f3d29c89b4c3a1e7dad0
parent4e40db0481bef688e43d4b28b6dedefa06e277c0 (diff)
parentf75d55f1a71cae9864ca4bf12c92fcd9e34ed651 (diff)
downloadQt-fe239b32550e83e8a42617457adca8d7922ff92f.zip
Qt-fe239b32550e83e8a42617457adca8d7922ff92f.tar.gz
Qt-fe239b32550e83e8a42617457adca8d7922ff92f.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Revert "Prevent widgets with WA_DontShowOnScreen from keeping the app running" Fix for number entry in QDateTimeEntry using Shift+KeyPad (QTBUG-7842) Get rid of setFirstActionActive on mouse release in QMenu
-rw-r--r--src/gui/kernel/qwidget.cpp20
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp2
-rw-r--r--src/gui/widgets/qmenu.cpp4
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp30
-rw-r--r--tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp2
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp17
6 files changed, 30 insertions, 45 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e678220..884447d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7573,23 +7573,21 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
if (isMain)
QApplication::quit();
#endif
- // Attempt to close the application only if this widget has the
- // WA_QuitOnClose flag set set and has a non-visible parent
- quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible() || parentWidget->testAttribute(Qt::WA_DontShowOnScreen));
+ // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
+ quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
if (quitOnClose) {
- // If there is no non-withdrawn primary window left (except
- // the ones without QuitOnClose or with WA_DontShowOnScreen),
- // we emit the lastWindowClosed signal
+ /* if there is no non-withdrawn primary window left (except
+ the ones without QuitOnClose), we emit the lastWindowClosed
+ signal */
QWidgetList list = QApplication::topLevelWidgets();
bool lastWindowClosed = true;
for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i);
- if ((w->isVisible() && !w->testAttribute(Qt::WA_DontShowOnScreen))
- && !w->parentWidget() && w->testAttribute(Qt::WA_QuitOnClose)) {
- lastWindowClosed = false;
- break;
- }
+ if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))
+ continue;
+ lastWindowClosed = false;
+ break;
}
if (lastWindowClosed)
QApplicationPrivate::emitLastWindowClosed();
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 762db86..50fa9c9 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1175,7 +1175,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
return; }
}
QAbstractSpinBox::keyPressEvent(event);
- if (select && !(event->modifiers() & Qt::ShiftModifier) && !d->edit->hasSelectedText()) {
+ if (select && !d->edit->hasSelectedText()) {
if (inserted && d->sectionAt(d->edit->cursorPosition()) == QDateTimeParser::NoSectionIndex) {
QString str = d->displayText();
int pos = d->edit->cursorPosition();
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 8ce7cc0..08960da 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -2302,9 +2302,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
QAction *action = d->actionAt(e->pos());
if (action && action == d->currentAction) {
- if (action->menu())
- action->menu()->d_func()->setFirstActionActive();
- else {
+ if (!action->menu()){
#if defined(Q_WS_WIN)
//On Windows only context menus can be activated with the right button
if (e->button() == Qt::LeftButton || d->topCausedWidget() == 0)
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index b464867..459ac2b 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -706,36 +706,6 @@ void tst_QApplication::quitOnLastWindowClosed()
QSignalSpy spy(&app, SIGNAL(aboutToQuit()));
QSignalSpy spy2(&timer, SIGNAL(timeout()));
- QPointer<QMainWindow> mainWindow = new QMainWindow;
- QPointer<QWidget> invisibleTopLevelWidget = new QWidget;
- invisibleTopLevelWidget->setAttribute(Qt::WA_DontShowOnScreen);
-
- QVERIFY(app.quitOnLastWindowClosed());
- QVERIFY(mainWindow->testAttribute(Qt::WA_QuitOnClose));
- QVERIFY(invisibleTopLevelWidget->testAttribute(Qt::WA_QuitOnClose));
- QVERIFY(invisibleTopLevelWidget->testAttribute(Qt::WA_DontShowOnScreen));
-
- mainWindow->show();
- invisibleTopLevelWidget->show();
-
- timer.start();
- QTimer::singleShot(1000, mainWindow, SLOT(close())); // This should quit the application
- QTimer::singleShot(2000, &app, SLOT(quit())); // This makes sure we quit even if it didn't
-
- app.exec();
-
- QCOMPARE(spy.count(), 1);
- QVERIFY(spy2.count() < 15); // Should be around 10 if closing caused the quit
- }
- {
- int argc = 0;
- QApplication app(argc, 0, QApplication::GuiServer);
- QTimer timer;
- timer.setInterval(100);
-
- QSignalSpy spy(&app, SIGNAL(aboutToQuit()));
- QSignalSpy spy2(&timer, SIGNAL(timeout()));
-
QPointer<CloseEventTestWindow> mainWindow = new CloseEventTestWindow;
QVERIFY(app.quitOnLastWindowClosed());
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
index b92b873..558d4de 100644
--- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -3357,6 +3357,8 @@ void tst_QDateTimeEdit::keypadAutoAdvance_data()
QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
QTest::newRow("None") << (Qt::KeyboardModifiers)Qt::NoModifier;
QTest::newRow("Keypad") << (Qt::KeyboardModifiers)Qt::KeypadModifier;
+ // QTBUG-7842: Using KeyPad with shift (numlock off)
+ QTest::newRow("Keypad+Shift") << (Qt::KeyboardModifiers)(Qt::KeypadModifier|Qt::ShiftModifier);
}
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index 9dc18e0..3559b15 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -104,6 +104,7 @@ private slots:
void setFixedWidth();
void deleteActionInTriggered();
void pushButtonPopulateOnAboutToShow();
+ void QTBUG7907_submenus_autoselect();
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
@@ -930,6 +931,22 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow()
QVERIFY(!lastMenu->geometry().intersects(b.geometry()));
}
+void tst_QMenu::QTBUG7907_submenus_autoselect()
+{
+ QMenu menu("Test Menu");
+ QMenu set1("Setting1");
+ QMenu set2("Setting2");
+ QMenu subset("Subsetting");
+ subset.addAction("Values");
+ set1.addMenu(&subset);
+ menu.addMenu(&set1);
+ menu.addMenu(&set2);
+ menu.show();
+ QTest::qWaitForWindowShown(&menu);
+ QTest::mouseClick(&menu, Qt::LeftButton, Qt::NoModifier, QPoint(5,5) );
+ QTest::qWait(500);
+ QVERIFY(!subset.isVisible());
+}
QTEST_MAIN(tst_QMenu)