From c9efa5704ba89736e90d7a28e07687a826874232 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 28 Sep 2009 16:07:58 +0300 Subject: Fixed QMessageBox::updateSize test case for S60. In S60 message boxes are always in portrait mode located on the bottom of screen and they occypy the whole sreen width. In addition messageboxes in S60 does not have their own buttons, but the buttons are located in system softkey area. That's why adding standard buttons for message box in S60 does not change the dialog size. Reviewed-by: Sami Merila --- tests/auto/qmessagebox/tst_qmessagebox.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index 64e5a9c..5607fbd 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -130,7 +130,7 @@ private slots: void testSymbols(); void incorrectDefaultButton(); void updateSize(); - + void setInformativeText(); void iconPixmap(); @@ -683,7 +683,13 @@ void tst_QMessageBox::incorrectDefaultButton() void tst_QMessageBox::updateSize() { QMessageBox box; +#ifdef Q_WS_S60 + // In S60 messagebox is always occupies maximum width, i.e. screen width + // so we need to have long enough text to split over several line + box.setText("This is awesome long text"); +#else box.setText("This is awesome"); +#endif box.show(); QSize oldSize = box.size(); QString longText; @@ -693,9 +699,12 @@ void tst_QMessageBox::updateSize() QVERIFY(box.size() != oldSize); // should have grown QVERIFY(box.width() > oldSize.width() || box.height() > oldSize.height()); oldSize = box.size(); +#ifndef Q_WS_S60 + // In S60 dialogs buttons are in softkey area -> message box size does not change box.setStandardButtons(QMessageBox::StandardButtons(0xFFFF)); QVERIFY(box.size() != oldSize); // should have grown QVERIFY(box.width() > oldSize.width() || box.height() > oldSize.height()); +#endif } void tst_QMessageBox::setInformativeText() -- cgit v0.12 From 6e5c9afdb16e44d55683794442e66681f60d373b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 28 Sep 2009 15:13:57 +0200 Subject: Impossible to interact with the year on QCalendarWidget on GraphicsView The problem is that it is using mapToGlobal to translate a mouse position andthat doesn't work well when the widget is mebedded inside graphics view. Task-number: QT-2218 Reviewed-by: Bjoern Erik Nilsen --- src/gui/widgets/qcalendarwidget.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp index 71588c4..08ed7f6 100644 --- a/src/gui/widgets/qcalendarwidget.cpp +++ b/src/gui/widgets/qcalendarwidget.cpp @@ -3022,11 +3022,21 @@ bool QCalendarWidget::event(QEvent *event) bool QCalendarWidget::eventFilter(QObject *watched, QEvent *event) { Q_D(QCalendarWidget); - if (event->type() == QEvent::MouseButtonPress && d->yearEdit->hasFocus() && !QRect(d->yearEdit->mapToGlobal(QPoint(0, 0)), d->yearEdit->size()).contains(static_cast(event)->globalPos())) { - event->accept(); - d->_q_yearEditingFinished(); - setFocus(); - return true; + if (event->type() == QEvent::MouseButtonPress && d->yearEdit->hasFocus()) { + QWidget *tlw = window(); + QWidget *widget = static_cast(watched); + //as we have a event filter on the whole application we first make sure that the top level widget + //of both this and the watched widget are the same to decide if we should finish the year edition. + if (widget->window() == tlw) { + QPoint mousePos = widget->mapTo(tlw, static_cast(event)->pos()); + QRect geom = QRect(d->yearEdit->mapTo(tlw, QPoint(0, 0)), d->yearEdit->size()); + if (!geom.contains(mousePos)) { + event->accept(); + d->_q_yearEditingFinished(); + setFocus(); + return true; + } + } } return QWidget::eventFilter(watched, event); } -- cgit v0.12 From e131a4653ec13e9a680a4b41094e78f2cc929f4d Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 28 Sep 2009 15:09:29 +0200 Subject: Fix tst_QTextDocument::cursorPositionChangedOnSetText The test was introduced to make sure that the cursor position changed signal was not emitted excessively on setPlainText or on setHtml. The original fix however still included one superfluous emission for a temporary QTextCursor object. This was fixed by change 930ba91ec1e630, this change adjusts the auto test accordingly. Reviewed-by: Simon Hausmann --- tests/auto/qtextdocument/tst_qtextdocument.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index c0d7ed3..f393393 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -1787,21 +1787,17 @@ void tst_QTextDocument::cursorPositionChangedOnSetText() { CursorPosSignalSpy spy(doc); - cursor = QTextCursor(); + // doc has one QTextCursor stored in the + // cursor member variable, thus the signal + // gets emitted once. doc->setPlainText("Foo\nBar\nBaz\nBlub\nBlah"); - // the signal should still be emitted once for the QTextCursor that - // QTextDocument::setPlainText creates temporarily. But the signal - // should not be emitted more often. QCOMPARE(spy.calls, 1); spy.calls = 0; doc->setHtml("

Foo

Bar

Baz

Blah"); - // the signal should still be emitted once for the QTextCursor that - // QTextDocument::setPlainText creates temporarily. But the signal - // should not be emitted more often. QCOMPARE(spy.calls, 1); } -- cgit v0.12