diff options
-rw-r--r-- | examples/widgets/widgets/tablet/tabletcanvas.cpp | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 1 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 49 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.h | 4 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/fillrect.qps | 121 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/fillrect_aa.qps | 121 | ||||
-rw-r--r-- | tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 90 |
9 files changed, 298 insertions, 92 deletions
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 <QCoreApplication> #include <QPainter> #include <QtMath> +#include <cstdlib> //! [0] TabletCanvas::TabletCanvas() 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() 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()) { 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 <coordinate method enum>", "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 <x> <y> <w> <h> [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 <x> <y> <w> <h> [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 diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index ef58d612c9..cc58356103 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(); @@ -3448,90 +3442,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 ); |