From ddeec1b07edc0f1f225f8dc52efefc2ff63049be Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 2 Oct 2018 02:39:21 +0200 Subject: QSFPM: don't let setFilterRegExp(QString) overwrite CaseSensitivity This is a regression from commit 346c15102b, which creates a new QRegExp in setFilterRegExp, losing previously set case sensitivity property (i.e. when the code does proxy->setFilterCaseSensitivity(Qt::CaseInsensitive) before setFilterRegExp). Interestingly that commit ensured that setFilterFixedString would still preserve CaseSensitivity, but not setFilterRegExp(QString). Change-Id: I3d37d001ce6e86dd90e7e07431440a42607172f9 Reviewed-by: Samuel Gaist Reviewed-by: Christian Ehrlicher Reviewed-by: Luca Beldi --- .../tst_qsortfilterproxymodel_regexp.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/tst_qsortfilterproxymodel_regexp.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/tst_qsortfilterproxymodel_regexp.cpp index e83738661e..38607f1378 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/tst_qsortfilterproxymodel_regexp.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/tst_qsortfilterproxymodel_regexp.cpp @@ -37,6 +37,7 @@ public: tst_QSortFilterProxyModelRegExp(); private slots: void tst_invalid(); + void tst_caseSensitivity(); }; tst_QSortFilterProxyModelRegExp::tst_QSortFilterProxyModelRegExp() : @@ -55,5 +56,14 @@ void tst_QSortFilterProxyModelRegExp::tst_invalid() QCOMPARE(model.filterRegExp(), QRegExp()); } +void tst_QSortFilterProxyModelRegExp::tst_caseSensitivity() +{ + const QLatin1String pattern("test"); + QSortFilterProxyModel model; + model.setFilterCaseSensitivity(Qt::CaseInsensitive); + model.setFilterRegExp(pattern); + QCOMPARE(model.filterCaseSensitivity(), Qt::CaseInsensitive); +} + QTEST_MAIN(tst_QSortFilterProxyModelRegExp) #include "tst_qsortfilterproxymodel_regexp.moc" -- cgit v1.2.3 From a154ea89e8ae4113f2dd63eb96864c9182f2c459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 14 Sep 2018 15:52:48 +0200 Subject: Extend tst_QGL::graphicsViewClipping blacklisting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ife72db5a0d7cb8abe55c60c519087e2b60f26990 Reviewed-by: Andy Shaw Reviewed-by: Tor Arne Vestbø Reviewed-by: Timur Pocheptsov --- tests/auto/opengl/qgl/BLACKLIST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST index 1eb0197484..d3165a51e5 100644 --- a/tests/auto/opengl/qgl/BLACKLIST +++ b/tests/auto/opengl/qgl/BLACKLIST @@ -19,7 +19,7 @@ winrt [graphicsViewClipping] windows winrt -rhel-7.4 ci +linux ci [glFBOUseInGLWidget] windows winrt -- cgit v1.2.3 From 21355b3630882932be940a48a88d8c40cf7ebf63 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 26 Sep 2018 17:36:04 +0200 Subject: QGraphicsScene: Make focusing on touchBegin optional Usually we focus in when we receive a click or equivalent. QGraphicsScene by default also transfers the focus when you start a touch on a trackpad or similar. Most of the time this also generates a synthetic mouse click, so people don't necessary notice. However, at least on macOS you can configure this behavior. With focusOnTouch switched off, QGraphicsScene behaves as one would expect on macOS. Fixes: QTBUG-59442 Change-Id: Ib87112640eef6b77892ad2490d80eedd055e6dce Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar Reviewed-by: Shawn Rutledge --- .../qgraphicsscene/tst_qgraphicsscene.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index c8ee2d65a3..838b1f4be6 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -254,6 +254,7 @@ private slots: void zeroScale(); void focusItemChangedSignal(); void minimumRenderSize(); + void focusOnTouch(); // task specific tests below me void task139710_bspTreeCrash(); @@ -4758,6 +4759,41 @@ void tst_QGraphicsScene::minimumRenderSize() QVERIFY(smallChild->repaints > smallerGrandChild->repaints); } +void tst_QGraphicsScene::focusOnTouch() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + scene.setSceneRect(0, 0, 100, 100); + QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + rect->setFlag(QGraphicsItem::ItemIsFocusable, true); + + view.show(); + QApplication::setActiveWindow(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QVERIFY(!rect->hasFocus()); + + scene.setFocusOnTouch(false); + + QTouchDevice device; + device.setType(QTouchDevice::TouchPad); + QList touchPoints; + QTouchEvent::TouchPoint point; + point.setScenePos(QPointF(10, 10)); + point.setState(Qt::TouchPointPressed); + touchPoints.append(point); + QTouchEvent event(QEvent::TouchBegin, &device, Qt::NoModifier, Qt::TouchPointStates(), + touchPoints); + + QApplication::sendEvent(&scene, &event); + + QVERIFY(!rect->hasFocus()); + scene.setFocusOnTouch(true); + + QApplication::sendEvent(&scene, &event); + QVERIFY(rect->hasFocus()); +} + void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache() { QGraphicsScene scene; -- cgit v1.2.3 From d7e274a44621a4c1bb1ede66c00ee1d1e3f7bd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 13 Mar 2014 09:10:47 +0100 Subject: StyleSheetStyle: Load @Nx images Perform a @Nx image file lookup when loading pixmaps. Make drawBackgroundImage() handle high-dpi pixmaps, here the layout calculations needs to be in device- independent pixels Fixes: QTBUG-36825 Change-Id: I61e6f53c59f61f3bd88c34a036349e51e8c8ad92 Reviewed-by: Ulf Hermann Reviewed-by: Alex Blasche --- .../styles/qstylesheetstyle/images/testimage.png | Bin 299 -> 300 bytes .../qstylesheetstyle/images/testimage@2x.png | Bin 0 -> 318 bytes .../widgets/styles/qstylesheetstyle/resources.qrc | 1 + .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 33 +++++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/auto/widgets/styles/qstylesheetstyle/images/testimage@2x.png (limited to 'tests/auto') diff --git a/tests/auto/widgets/styles/qstylesheetstyle/images/testimage.png b/tests/auto/widgets/styles/qstylesheetstyle/images/testimage.png index 06fb34f0d6..a4adc7a47f 100644 Binary files a/tests/auto/widgets/styles/qstylesheetstyle/images/testimage.png and b/tests/auto/widgets/styles/qstylesheetstyle/images/testimage.png differ diff --git a/tests/auto/widgets/styles/qstylesheetstyle/images/testimage@2x.png b/tests/auto/widgets/styles/qstylesheetstyle/images/testimage@2x.png new file mode 100644 index 0000000000..d55f0c507b Binary files /dev/null and b/tests/auto/widgets/styles/qstylesheetstyle/images/testimage@2x.png differ diff --git a/tests/auto/widgets/styles/qstylesheetstyle/resources.qrc b/tests/auto/widgets/styles/qstylesheetstyle/resources.qrc index 248bf80f50..f523070073 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/resources.qrc +++ b/tests/auto/widgets/styles/qstylesheetstyle/resources.qrc @@ -2,5 +2,6 @@ images/testimage.png + images/testimage@2x.png \ No newline at end of file diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 43aec651fe..f5d9433f70 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -33,6 +33,7 @@ #include #include +#include #include using namespace QTestPrivate; @@ -101,6 +102,9 @@ private slots: void styleSheetTargetAttribute(); void unpolish(); + void highdpiImages_data(); + void highdpiImages(); + private: QColor COLOR(const QWidget& w) { w.ensurePolished(); @@ -2066,6 +2070,35 @@ void tst_QStyleSheetStyle::unpolish() QCOMPARE(w.minimumWidth(), 0); } +void tst_QStyleSheetStyle::highdpiImages_data() +{ + QTest::addColumn("screenFactor"); + QTest::addColumn("color"); + + QTest::newRow("highdpi") << 2.0 << QColor(0x00, 0xFF, 0x00); + QTest::newRow("lowdpi") << 1.0 << QColor(0xFF, 0x00, 0x00); +} + +void tst_QStyleSheetStyle::highdpiImages() +{ + QFETCH(qreal, screenFactor); + QFETCH(QColor, color); + + QWidget w; + QScreen *screen = QGuiApplication::screenAt(w.pos()); + QHighDpiScaling::setScreenFactor(screen, screenFactor); + w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }"); + w.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&w)); + QImage image(w.size(), QImage::Format_ARGB32); + w.render(&image); + QVERIFY(testForColors(image, color)); + + QHighDpiScaling::setScreenFactor(screen, 1.0); + QHighDpiScaling::updateHighDpiScaling(); // reset to normal +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" -- cgit v1.2.3 From 9f710b15f0b1651a26d5b80c2bcb48104bd12db2 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 20 Sep 2018 12:34:31 +0200 Subject: uic: Write the float and double properties in 'f' format Make the code consistent with the DomProperty::write() method. Task-number: QTBUG-70613 Change-Id: I622b4a019a4473823584de97304f8324f2cf0c6b Reviewed-by: Friedemann Kleint --- tests/auto/tools/uic/baseline/buttongroup.ui.h | 20 +++++++-------- .../auto/tools/uic/baseline/qpagesetupwidget.ui.h | 14 +++++----- .../auto/tools/uic/baseline/qtgradienteditor.ui.h | 30 +++++++++++----------- tests/auto/tools/uic/baseline/validators.ui.h | 14 +++++----- 4 files changed, 39 insertions(+), 39 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/tools/uic/baseline/buttongroup.ui.h b/tests/auto/tools/uic/baseline/buttongroup.ui.h index ddc3995d4b..87814dcba1 100644 --- a/tests/auto/tools/uic/baseline/buttongroup.ui.h +++ b/tests/auto/tools/uic/baseline/buttongroup.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'buttongroup.ui' ** -** Created by: Qt User Interface Compiler version 5.10.1 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -129,9 +129,9 @@ public: sizePolicy3.setHeightForWidth(periodSpinBox->sizePolicy().hasHeightForWidth()); periodSpinBox->setSizePolicy(sizePolicy3); periodSpinBox->setMinimumSize(QSize(0, 30)); - periodSpinBox->setMinimum(-1); - periodSpinBox->setSingleStep(0.1); - periodSpinBox->setValue(-1); + periodSpinBox->setMinimum(-1.000000000000000); + periodSpinBox->setSingleStep(0.100000000000000); + periodSpinBox->setValue(-1.000000000000000); formLayout->setWidget(0, QFormLayout::FieldRole, periodSpinBox); @@ -139,9 +139,9 @@ public: amplitudeSpinBox->setObjectName(QString::fromUtf8("amplitudeSpinBox")); amplitudeSpinBox->setEnabled(false); amplitudeSpinBox->setMinimumSize(QSize(0, 30)); - amplitudeSpinBox->setMinimum(-1); - amplitudeSpinBox->setSingleStep(0.1); - amplitudeSpinBox->setValue(-1); + amplitudeSpinBox->setMinimum(-1.000000000000000); + amplitudeSpinBox->setSingleStep(0.100000000000000); + amplitudeSpinBox->setValue(-1.000000000000000); formLayout->setWidget(2, QFormLayout::FieldRole, amplitudeSpinBox); @@ -155,9 +155,9 @@ public: overshootSpinBox->setObjectName(QString::fromUtf8("overshootSpinBox")); overshootSpinBox->setEnabled(false); overshootSpinBox->setMinimumSize(QSize(0, 30)); - overshootSpinBox->setMinimum(-1); - overshootSpinBox->setSingleStep(0.1); - overshootSpinBox->setValue(-1); + overshootSpinBox->setMinimum(-1.000000000000000); + overshootSpinBox->setSingleStep(0.100000000000000); + overshootSpinBox->setValue(-1.000000000000000); formLayout->setWidget(4, QFormLayout::FieldRole, overshootSpinBox); diff --git a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h index e914c664d3..a5379bc468 100644 --- a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h +++ b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qpagesetupwidget.ui' ** -** Created by: Qt User Interface Compiler version 5.9.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -104,7 +104,7 @@ public: horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); pageWidth = new QDoubleSpinBox(groupBox_2); pageWidth->setObjectName(QString::fromUtf8("pageWidth")); - pageWidth->setMaximum(9999.99); + pageWidth->setMaximum(9999.989999999999782); horizontalLayout_3->addWidget(pageWidth); @@ -115,7 +115,7 @@ public: pageHeight = new QDoubleSpinBox(groupBox_2); pageHeight->setObjectName(QString::fromUtf8("pageHeight")); - pageHeight->setMaximum(9999.99); + pageHeight->setMaximum(9999.989999999999782); horizontalLayout_3->addWidget(pageHeight); @@ -199,7 +199,7 @@ public: topMargin = new QDoubleSpinBox(groupBox); topMargin->setObjectName(QString::fromUtf8("topMargin")); topMargin->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - topMargin->setMaximum(999.99); + topMargin->setMaximum(999.990000000000009); gridLayout->addWidget(topMargin, 0, 1, 1, 1); @@ -212,7 +212,7 @@ public: leftMargin = new QDoubleSpinBox(groupBox); leftMargin->setObjectName(QString::fromUtf8("leftMargin")); leftMargin->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - leftMargin->setMaximum(999.99); + leftMargin->setMaximum(999.990000000000009); horizontalLayout->addWidget(leftMargin); @@ -223,7 +223,7 @@ public: rightMargin = new QDoubleSpinBox(groupBox); rightMargin->setObjectName(QString::fromUtf8("rightMargin")); rightMargin->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - rightMargin->setMaximum(999.99); + rightMargin->setMaximum(999.990000000000009); horizontalLayout->addWidget(rightMargin); @@ -241,7 +241,7 @@ public: bottomMargin = new QDoubleSpinBox(groupBox); bottomMargin->setObjectName(QString::fromUtf8("bottomMargin")); bottomMargin->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); - bottomMargin->setMaximum(999.99); + bottomMargin->setMaximum(999.990000000000009); gridLayout->addWidget(bottomMargin, 2, 1, 1, 1); diff --git a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h index 21dc9551d0..9db07f35ac 100644 --- a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h +++ b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qtgradienteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -176,8 +176,8 @@ public: spinBox1->setGeometry(QRect(279, 69, 73, 23)); spinBox1->setKeyboardTracking(false); spinBox1->setDecimals(3); - spinBox1->setMaximum(1); - spinBox1->setSingleStep(0.01); + spinBox1->setMaximum(1.000000000000000); + spinBox1->setSingleStep(0.010000000000000); label2 = new QLabel(QtGradientEditor); label2->setObjectName(QString::fromUtf8("label2")); label2->setGeometry(QRect(209, 99, 64, 23)); @@ -186,8 +186,8 @@ public: spinBox2->setGeometry(QRect(279, 99, 73, 23)); spinBox2->setKeyboardTracking(false); spinBox2->setDecimals(3); - spinBox2->setMaximum(1); - spinBox2->setSingleStep(0.01); + spinBox2->setMaximum(1.000000000000000); + spinBox2->setSingleStep(0.010000000000000); label3 = new QLabel(QtGradientEditor); label3->setObjectName(QString::fromUtf8("label3")); label3->setGeometry(QRect(209, 129, 64, 23)); @@ -196,8 +196,8 @@ public: spinBox3->setGeometry(QRect(279, 129, 73, 23)); spinBox3->setKeyboardTracking(false); spinBox3->setDecimals(3); - spinBox3->setMaximum(1); - spinBox3->setSingleStep(0.01); + spinBox3->setMaximum(1.000000000000000); + spinBox3->setSingleStep(0.010000000000000); label4 = new QLabel(QtGradientEditor); label4->setObjectName(QString::fromUtf8("label4")); label4->setGeometry(QRect(209, 159, 64, 23)); @@ -206,8 +206,8 @@ public: spinBox4->setGeometry(QRect(279, 159, 73, 23)); spinBox4->setKeyboardTracking(false); spinBox4->setDecimals(3); - spinBox4->setMaximum(1); - spinBox4->setSingleStep(0.01); + spinBox4->setMaximum(1.000000000000000); + spinBox4->setSingleStep(0.010000000000000); label5 = new QLabel(QtGradientEditor); label5->setObjectName(QString::fromUtf8("label5")); label5->setGeometry(QRect(209, 189, 64, 23)); @@ -216,8 +216,8 @@ public: spinBox5->setGeometry(QRect(279, 189, 73, 23)); spinBox5->setKeyboardTracking(false); spinBox5->setDecimals(3); - spinBox5->setMaximum(1); - spinBox5->setSingleStep(0.01); + spinBox5->setMaximum(1.000000000000000); + spinBox5->setSingleStep(0.010000000000000); gradientStopsWidget = new QtGradientStopsWidget(QtGradientEditor); gradientStopsWidget->setObjectName(QString::fromUtf8("gradientStopsWidget")); gradientStopsWidget->setGeometry(QRect(10, 225, 193, 67)); @@ -390,10 +390,10 @@ public: positionSpinBox->setObjectName(QString::fromUtf8("positionSpinBox")); positionSpinBox->setKeyboardTracking(false); positionSpinBox->setDecimals(3); - positionSpinBox->setMinimum(0); - positionSpinBox->setMaximum(1); - positionSpinBox->setSingleStep(0.01); - positionSpinBox->setValue(0); + positionSpinBox->setMinimum(0.000000000000000); + positionSpinBox->setMaximum(1.000000000000000); + positionSpinBox->setSingleStep(0.010000000000000); + positionSpinBox->setValue(0.000000000000000); vboxLayout1->addWidget(positionSpinBox); diff --git a/tests/auto/tools/uic/baseline/validators.ui.h b/tests/auto/tools/uic/baseline/validators.ui.h index 0595cf2037..d0ae777f65 100644 --- a/tests/auto/tools/uic/baseline/validators.ui.h +++ b/tests/auto/tools/uic/baseline/validators.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'validators.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -252,9 +252,9 @@ public: doubleMinVal->setObjectName(QString::fromUtf8("doubleMinVal")); sizePolicy.setHeightForWidth(doubleMinVal->sizePolicy().hasHeightForWidth()); doubleMinVal->setSizePolicy(sizePolicy); - doubleMinVal->setMinimum(-100000); - doubleMinVal->setMaximum(100000); - doubleMinVal->setValue(0); + doubleMinVal->setMinimum(-100000.000000000000000); + doubleMinVal->setMaximum(100000.000000000000000); + doubleMinVal->setValue(0.000000000000000); gridLayout1->addWidget(doubleMinVal, 0, 1, 1, 1); @@ -281,9 +281,9 @@ public: doubleMaxVal->setObjectName(QString::fromUtf8("doubleMaxVal")); sizePolicy.setHeightForWidth(doubleMaxVal->sizePolicy().hasHeightForWidth()); doubleMaxVal->setSizePolicy(sizePolicy); - doubleMaxVal->setMinimum(-100000); - doubleMaxVal->setMaximum(100000); - doubleMaxVal->setValue(1000); + doubleMaxVal->setMinimum(-100000.000000000000000); + doubleMaxVal->setMaximum(100000.000000000000000); + doubleMaxVal->setValue(1000.000000000000000); gridLayout1->addWidget(doubleMaxVal, 1, 1, 1, 1); -- cgit v1.2.3