From 78d349eaab53a66a0b575c6adfa85e0392cae3ea Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 13 Oct 2019 14:00:07 +0200 Subject: tst_QSqlQuery: remove tests commented out a long time ago Remove some code which was commented out with 'NOT_READY_YET' since the initial Qt5 import. Since the mentioned bug reports are no longer available remove this code. Change-Id: I98686e53d85619f01d16105d147eba79b557a104 Reviewed-by: Edward Welbourne --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 90 ----------------------- 1 file changed, 90 deletions(-) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 784d0a70d7..6c838995eb 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -185,12 +185,6 @@ private slots: void mysql_timeType_data() { generic_data("QMYSQL"); } void mysql_timeType(); -#ifdef NOT_READY_YET - void task_229811(); - void task_229811_data() { generic_data(); } - void task_234422_data() { generic_data(); } - void task_234422(); -#endif void task_217003_data() { generic_data(); } void task_217003(); @@ -3463,90 +3457,6 @@ void tst_QSqlQuery::task_205701() QSqlDatabase::removeDatabase("atest"); } -#ifdef NOT_READY_YET -// For task: 229811 -void tst_QSqlQuery::task_229811() -{ - QFETCH( QString, dbName ); - QSqlDatabase db = QSqlDatabase::database( dbName ); - CHECK_DATABASE( db ); - - if (!db.driverName().startsWith( "QODBC" )) return; - - QSqlQuery q( db ); - - const QString tableName(qTableName("task_229811", __FILE__, db)); - - if ( !q.exec( "CREATE TABLE " + tableName + " (Word varchar(20))" ) ) { - qDebug() << "Warning" << q.lastError(); - } - - QVERIFY_SQL( q, exec( "INSERT INTO " + tableName + " values ('Albert')" ) ); - QVERIFY_SQL( q, exec( "INSERT INTO " + tableName + " values ('Beehive')" ) ); - QVERIFY_SQL( q, exec( "INSERT INTO " + tableName + " values ('Alimony')" ) ); - QVERIFY_SQL( q, exec( "INSERT INTO " + tableName + " values ('Bohemian')" ) ); - QVERIFY_SQL( q, exec( "INSERT INTO " + tableName + " values ('AllStars')" ) ); - - - QString stmt = "SELECT * FROM " + tableName + " WHERE Word LIKE :name"; - QVERIFY_SQL(q,prepare(stmt)); - q.bindValue(":name", "A%"); - QVERIFY_SQL(q,exec()); - - QVERIFY(q.isActive()); - QVERIFY(q.isSelect()); - QVERIFY(q.first()); - - QSqlRecord rec = q.record(); - QCOMPARE(rec.field(0).value().toString(), QString("Albert")); - QVERIFY(q.next()); - rec = q.record(); - QCOMPARE(rec.field(0).value().toString(), QString("Alimony")); - QVERIFY(q.next()); - rec = q.record(); - QCOMPARE(rec.field(0).value().toString(),QString("AllStars")); - - q.exec("DROP TABLE " + tableName ); -} - -void tst_QSqlQuery::task_234422() -{ - QFETCH( QString, dbName ); - QSqlDatabase db = QSqlDatabase::database( dbName ); - CHECK_DATABASE( db ); - - QSqlQuery query(db); - QStringList m_airlines; - QStringList m_countries; - - m_airlines << "Lufthansa" << "SAS" << "United" << "KLM" << "Aeroflot"; - m_countries << "DE" << "SE" << "US" << "NL" << "RU"; - - const QString tableName(qTableName("task_234422", __FILE__, db)); - - QVERIFY_SQL(query,exec("CREATE TABLE " + tableName + " (id int primary key, " - "name varchar(20), homecountry varchar(2))")); - for (int i = 0; i < m_airlines.count(); ++i) { - QVERIFY(query.exec(QString("INSERT INTO " + tableName + " values(%1, '%2', '%3')") - .arg(i).arg(m_airlines[i], m_countries[i]))); - } - - QVERIFY_SQL(query, exec("SELECT name FROM " + tableName)); - QVERIFY(query.isSelect()); - QVERIFY(query.first()); - QVERIFY(query.next()); - QCOMPARE(query.at(), 1); - - QSqlQuery query2(query); - - QVERIFY_SQL(query2,exec()); - QVERIFY(query2.first()); - QCOMPARE(query2.at(), 0); - QCOMPARE(query.at(), 1); -} - -#endif - void tst_QSqlQuery::task_233829() { QFETCH( QString, dbName ); -- cgit v1.2.3 From ea377c5a2fac29b0ed25b3bd0f74f51fc3a44010 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 14 Oct 2019 15:29:50 +0200 Subject: Add testing of fillRect() to QPainter lancelot test Change-Id: I3be230d3fafa178a37cf7387f79f372c8d8aeb05 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/other/lancelot/paintcommands.cpp | 49 +++++++++ tests/auto/other/lancelot/paintcommands.h | 4 + tests/auto/other/lancelot/scripts/fillrect.qps | 121 ++++++++++++++++++++++ tests/auto/other/lancelot/scripts/fillrect_aa.qps | 121 ++++++++++++++++++++++ 4 files changed, 295 insertions(+) create mode 100644 tests/auto/other/lancelot/scripts/fillrect.qps create mode 100644 tests/auto/other/lancelot/scripts/fillrect_aa.qps diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index fbf906b55d..215a4c2a29 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -365,6 +365,7 @@ void PaintCommands::staticInit() "^gradient_setCoordinateMode\\s+(\\w*)$", "gradient_setCoordinateMode ", "gradient_setCoordinateMode ObjectBoundingMode"); + DECL_PAINTCOMMANDSECTION("drawing ops"); DECL_PAINTCOMMAND("drawPoint", command_drawPoint, "^drawPoint\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", @@ -454,6 +455,14 @@ void PaintCommands::staticInit() "\n - where t means tile" "\n - and s is an offset in the tile", "drawTiledPixmap :/images/alpha.png "); + DECL_PAINTCOMMAND("fillRect", command_fillRect, + "^fillRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(\\w*)?$", + "fillRect [color]\n - Uses current brush if no color given", + "fillRect 10 10 20 20 blue"); + DECL_PAINTCOMMAND("fillRectF", command_fillRectF, + "^fillRectF\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s*(\\w*)?$", + "fillRectF [color]\n - Uses current brush if no color given", + "fillRectF 10.5 10.5 20.2 20.2 blue"); DECL_PAINTCOMMANDSECTION("painterPaths"); DECL_PAINTCOMMAND("path_moveTo", command_path_moveTo, @@ -1331,6 +1340,46 @@ void PaintCommands::command_drawTextDocument(QRegularExpressionMatch re) m_painter->restore(); } +/***************************************************************************************************/ +void PaintCommands::command_fillRect(QRegularExpressionMatch re) +{ + QStringList caps = re.capturedTexts(); + int x = convertToInt(caps.at(1)); + int y = convertToInt(caps.at(2)); + int w = convertToInt(caps.at(3)); + int h = convertToInt(caps.at(4)); + + if (!caps.at(5).isEmpty()) { + QColor color = convertToColor(caps.at(5)); + if (m_verboseMode) + printf(" -(lance) fillRect(%d, %d, %d, %d, %s)\n", x, y, w, h, qPrintable(color.name())); + m_painter->fillRect(x, y, w, h, color); + } else { + if (m_verboseMode) + printf(" -(lance) fillRect(%d, %d, %d, %d)\n", x, y, w, h); + m_painter->fillRect(x, y, w, h, m_painter->brush()); + } +} + +void PaintCommands::command_fillRectF(QRegularExpressionMatch re) +{ + QStringList caps = re.capturedTexts(); + double x = convertToDouble(caps.at(1)); + double y = convertToDouble(caps.at(2)); + double w = convertToDouble(caps.at(3)); + double h = convertToDouble(caps.at(4)); + + if (!caps.at(5).isEmpty()) { + QColor color = convertToColor(caps.at(5)); + if (m_verboseMode) + printf(" -(lance) fillRectF(%.2f, %.2f, %.2f, %.2f, %s)\n", x, y, w, h, qPrintable(color.name())); + m_painter->fillRect(QRectF(x, y, w, h), color); + } else { + if (m_verboseMode) + printf(" -(lance) fillRectF(%.2f, %.2f, %.2f, %.2f)\n", x, y, w, h); + m_painter->fillRect(QRectF(x, y, w, h), m_painter->brush()); + } +} /***************************************************************************************************/ void PaintCommands::command_noop(QRegularExpressionMatch) diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index 79bdab634a..816ecd6fa2 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -200,6 +200,10 @@ private: void command_drawStaticText(QRegularExpressionMatch re); void command_drawTextDocument(QRegularExpressionMatch re); void command_drawTiledPixmap(QRegularExpressionMatch re); + void command_fillRect(QRegularExpressionMatch re); + void command_fillRectF(QRegularExpressionMatch re); + + // paths void command_path_addEllipse(QRegularExpressionMatch re); void command_path_addPolygon(QRegularExpressionMatch re); void command_path_addRect(QRegularExpressionMatch re); diff --git a/tests/auto/other/lancelot/scripts/fillrect.qps b/tests/auto/other/lancelot/scripts/fillrect.qps new file mode 100644 index 0000000000..103ef2646a --- /dev/null +++ b/tests/auto/other/lancelot/scripts/fillrect.qps @@ -0,0 +1,121 @@ +setRenderHint Antialiasing false + +# offscreen +translate 0 -200 + +begin_block rects +# int API +fillRect 10 10 20 20 green +fillRect 40 10 20 20 +drawRect 70 10 20 20 + +# float API, int values +fillRectF 10.0 40.0 20.0 20.0 green +fillRectF 40.0 40.0 20.0 20.0 +drawRect 70.0 40.0 20.0 20.0 + +# float API, float values +fillRectF 10.0 70.0 20.5 20.5 green +fillRectF 40.0 70.0 20.5 20.5 +drawRect 70.0 70.0 20.5 20.5 + +# alignment, int api, color +fillRect 10 100 10 10 green +fillRect 20 100 10 10 green +fillRect 10 110 10 10 green +fillRect 20 110 10 10 green + +# alignment, int api, brush +fillRect 40 100 10 10 +fillRect 50 100 10 10 +fillRect 40 110 10 10 +fillRect 50 110 10 10 + +# alignment comparison +drawRect 70 100 10 10 +drawRect 80 100 10 10 +drawRect 70 110 10 10 +drawRect 80 110 10 10 + +# alignment, float api, color +fillRectF 10.0 130.0 10.0 10.0 green +fillRectF 20.0 130.0 10.0 10.0 green +fillRectF 10.0 140.0 10.0 10.0 green +fillRectF 20.0 140.0 10.0 10.0 green + +# alignment, float api, brush +fillRectF 40.0 130.0 10.0 10.0 +fillRectF 50.0 130.0 10.0 10.0 +fillRectF 40.0 140.0 10.0 10.0 +fillRectF 50.0 140.0 10.0 10.0 + +# alignment comparison +drawRect 70.0 130.0 10.0 10.0 +drawRect 80.0 130.0 10.0 10.0 +drawRect 70.0 140.0 10.0 10.0 +drawRect 80.0 140.0 10.0 10.0 + +end_block + +begin_block row + +repeat_block rects + +save +translate 100.2 0.2 +repeat_block rects +restore + +save +translate 200.5 0.5 +repeat_block rects +restore + +save +translate 300.7 0.7 +repeat_block rects +restore + +end_block + +# end of block defs + +resetMatrix + +setPen NoPen +setBrush green +repeat_block row + +save +translate 500 50 +scale 0.42 0.42 +repeat_block row +restore + +save +translate 0 160 +scale 1.8 0.8 +repeat_block row +restore + +save +translate 650 320 +rotate 80 +repeat_block row +restore + +save +setBrush green Dense2Pattern +translate 0 400 +repeat_block row +restore + +save +gradient_clearStops +gradient_appendStop 0 green +gradient_appendStop 1 blue +gradient_setCoordinateMode ObjectBoundingMode +gradient_setLinear 0.0 0.0 1.0 1.0 +translate 0 600 +repeat_block row +restore diff --git a/tests/auto/other/lancelot/scripts/fillrect_aa.qps b/tests/auto/other/lancelot/scripts/fillrect_aa.qps new file mode 100644 index 0000000000..3232899661 --- /dev/null +++ b/tests/auto/other/lancelot/scripts/fillrect_aa.qps @@ -0,0 +1,121 @@ +setRenderHint Antialiasing true + +# offscreen +translate 0 -200 + +begin_block rects +# int API +fillRect 10 10 20 20 green +fillRect 40 10 20 20 +drawRect 70 10 20 20 + +# float API, int values +fillRectF 10.0 40.0 20.0 20.0 green +fillRectF 40.0 40.0 20.0 20.0 +drawRect 70.0 40.0 20.0 20.0 + +# float API, float values +fillRectF 10.0 70.0 20.5 20.5 green +fillRectF 40.0 70.0 20.5 20.5 +drawRect 70.0 70.0 20.5 20.5 + +# alignment, int api, color +fillRect 10 100 10 10 green +fillRect 20 100 10 10 green +fillRect 10 110 10 10 green +fillRect 20 110 10 10 green + +# alignment, int api, brush +fillRect 40 100 10 10 +fillRect 50 100 10 10 +fillRect 40 110 10 10 +fillRect 50 110 10 10 + +# alignment comparison +drawRect 70 100 10 10 +drawRect 80 100 10 10 +drawRect 70 110 10 10 +drawRect 80 110 10 10 + +# alignment, float api, color +fillRectF 10.0 130.0 10.0 10.0 green +fillRectF 20.0 130.0 10.0 10.0 green +fillRectF 10.0 140.0 10.0 10.0 green +fillRectF 20.0 140.0 10.0 10.0 green + +# alignment, float api, brush +fillRectF 40.0 130.0 10.0 10.0 +fillRectF 50.0 130.0 10.0 10.0 +fillRectF 40.0 140.0 10.0 10.0 +fillRectF 50.0 140.0 10.0 10.0 + +# alignment comparison +drawRect 70.0 130.0 10.0 10.0 +drawRect 80.0 130.0 10.0 10.0 +drawRect 70.0 140.0 10.0 10.0 +drawRect 80.0 140.0 10.0 10.0 + +end_block + +begin_block row + +repeat_block rects + +save +translate 100.2 0.2 +repeat_block rects +restore + +save +translate 200.5 0.5 +repeat_block rects +restore + +save +translate 300.7 0.7 +repeat_block rects +restore + +end_block + +# end of block defs + +resetMatrix + +setPen NoPen +setBrush green +repeat_block row + +save +translate 500 50 +scale 0.42 0.42 +repeat_block row +restore + +save +translate 0 160 +scale 1.8 0.8 +repeat_block row +restore + +save +translate 650 320 +rotate 80 +repeat_block row +restore + +save +setBrush green Dense2Pattern +translate 0 400 +repeat_block row +restore + +save +gradient_clearStops +gradient_appendStop 0 green +gradient_appendStop 1 blue +gradient_setCoordinateMode ObjectBoundingMode +gradient_setLinear 0.0 0.0 1.0 1.0 +translate 0 600 +repeat_block row +restore -- cgit v1.2.3 From d5c4cd7a251096482037e55b9d0a1b590264649b Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 15 Oct 2019 17:50:35 +0200 Subject: Examples: fix compiling tablet example on qnx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit std::abs(int) is defined in cstdlib which is not included on QNX. Fixes: QTBUG-78763 Change-Id: I14d087069369db7ab4e5db9d4f816a3fbffe95f6 Reviewed-by: Johanna Äijälä Reviewed-by: Friedemann Kleint --- examples/widgets/widgets/tablet/tabletcanvas.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index 9a8029486d..59ca608cef 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -53,6 +53,7 @@ #include #include #include +#include //! [0] TabletCanvas::TabletCanvas() -- cgit v1.2.3 From 5c37258b06107d247f254fc7e3e852d2838e0a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 8 Oct 2019 18:31:33 +0200 Subject: macOS: Don't dismiss menu during applicationShouldTerminate The logic was a leftover from the Carbon days and is no longer needed. Change-Id: I557b669eadea902fa439c43162218c5864077df9 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 00f5a1bf09..9daf65abcf 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -142,8 +142,6 @@ QT_USE_NAMESPACE - (BOOL)canQuit { - [[NSApp mainMenu] cancelTracking]; - bool handle_quit = true; NSMenuItem *quitMenuItem = [[QCocoaMenuLoader sharedMenuLoader] quitMenuItem]; if (!QGuiApplicationPrivate::instance()->modalWindowList.isEmpty() -- cgit v1.2.3 From e5c003b77ddd9830805124ab829067a7858bf024 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sat, 12 Oct 2019 16:58:08 +0200 Subject: Set icon on the select-all action in the text edit context menu too Makes this consistent with the rest of the actions here, and avoids dirty hacks like KIconTheme::assignIconsToContextMenu. Change-Id: I749f4d5f67efdbf595a52185dd507de5f87f6487 Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qlineedit.cpp | 1 + src/widgets/widgets/qwidgettextcontrol.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 7f482a6a4e..fb67936768 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -2226,6 +2226,7 @@ QMenu *QLineEdit::createStandardContextMenu() action = popup->addAction(QLineEdit::tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll)); action->setEnabled(!d->control->text().isEmpty() && !d->control->allSelected()); + setActionIcon(action, QStringLiteral("edit-select-all")); d->selectAllAction = action; connect(action, SIGNAL(triggered()), SLOT(selectAll())); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 094c59a0c9..dce18f9100 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -2362,6 +2362,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll())); a->setEnabled(!d->doc->isEmpty()); a->setObjectName(QStringLiteral("select-all")); + setActionIcon(a, QStringLiteral("edit-select-all")); } if ((d->interactionFlags & Qt::TextEditable) && QGuiApplication::styleHints()->useRtlExtensions()) { -- cgit v1.2.3