summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Fix tst_qfiledialog2 in case directory ~/foo existsAndreas Buhr2020-11-241-2/+2
| | | | | | | | | | | One test in tst_qfiledialog2 only succeeded if the directory "~/foo" did not exist. This patch changes the path used to "~/Vugiu1co" which has hopefully a much lower probability of existing. The string "Vugiu1co" is taken from a call to "pwgen". Pick-to: 6.0 Change-Id: Ia82b07902a91eb908a74aa90cdbdf4761d432d9a Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Skip QSystemTrayIcon unit test for offscreen platformAndreas Buhr2020-11-241-0/+3
| | | | | | | | | When we are using the offscreen plugin, there might or might not be a working system tray icon. This patch disables the unit test in that case as we do not know what to expect. Change-Id: I34fded516300cc9aab1eb67644dcef8631ecfdf1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-3/+3
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QTest: don't wait before sending mouse event: increment the timestampShawn Rutledge2020-11-171-2/+4
| | | | | | | | | | Tests can run faster now, but we still expect calculations based on the timestamp (such as QEventPoint::velocity()) to be correct. Change-Id: Ie962604c9ebd139384dcd89a157de66b4b773cc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: move blocked tests of qapplication to test folderAssam Boudjelthia2020-11-162-17/+21
| | | | | | | | | | | Android packages the test instead of qapplication folder, thus the BLACKLIST file for Android tests needs to be in "test" folder instead. Task-number: QTBUG-87666 Task-number: QTBUG-87025 Change-Id: I065072fa8a030cf9d15e057869e74a8c736c80ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: exclude tests crashing at startAssam Boudjelthia2020-11-169-6/+103
| | | | | | | | | | | These tests are failing with "java.lang.UnsatisfiedLinkError: dlopen failed: invalid ELF file" at the start, excluding them now to enable Android testing until they're fixed later. Task-number: QTBUG-87671 Task-number: QTBUG-87025 Change-Id: Ida7d7158fccdc31df1f9689f77fde832964d732f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QFileInfo: mark constructors as explicitGiuseppe D'Angelo2020-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | These look like leftovers (API flaws). Construction of QFileInfo from QString (or similar) should be not implicit, as QFileInfo construction is expensive (might hit the file system), and this may have users overlook APIs (for instance build a QFileInfo out of QDirIterator::next(), instead of using ::fileInfo(); using QDir::entryList instead of entryInfoList; etc.). Leave an opt-out mechanism to ease porting. Fix a handful of usages around qtbase, with at least a couple of them likely to be actual "sloppy" code. [ChangeLog][Potentially Source-Incompatible Changes][QFileInfo] Most QFileInfo constructors are now explicit. The QT_IMPLICIT_QFILEINFO_CONSTRUCTION macro is provided to keep old code working. Change-Id: Ic580e6316e67edbc840aa0c60d98c7aaabaf1af6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QChar: make construction from integral explicitGiuseppe D'Angelo2020-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QChar should not be convertible from any integral type except from char16_t, short and possibly char (since it's a direct superset). David provided the perfect example: if (str == 123) { ~~~ } compiles, with 123 implicitly converted to QChar (str == "123" was meant instead). But similarly one can construct other scenarios where QString(123) gets accidentally used (instead of QString::number(123)), like QString s; s += 123;. Add a macro to revert to the implicit constructors, for backwards compatibility. The breaks are mostly in tests that "abuse" of integers (arithmetic, etc.). Maybe it's time for user-defined literals for QChar/QString, but that is left for another commit. [ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar constructors from integral types are now by default explicit. It is recommended to use explicit conversions, QLatin1Char, QChar::fromUcs4 instead of implicit conversions. The old behavior can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION macro. Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Stop copying events in testsVolker Hilsheimer2020-11-123-13/+17
| | | | | | | | It's unnecessary, and copying QEvents is a bad practice since it's a polymorphic class. Change-Id: Ieb6de106084f838c5e6c8a0643c54fd3c7f4a7a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QTRY_COMPARE in an attempt to make the test less flakyVolker Hilsheimer2020-11-101-2/+2
| | | | | | | | | The test function only runs on X11, and this might help with the asynchronous nature of the client/server architecture, also for drag'n'drop. Change-Id: I38db9104e304e57c36f84932d13f8dfae7452883 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix a mistake when using QLatin1String::argGiuseppe D'Angelo2020-11-072-6/+6
| | | | | | | | | | | | QLatin1String::arg (and QStringView::arg) only support string-like arguments, and QLatin1String("%1").arg(123) does *not* produce the string "123" -- 123 gets routed through the QChar(int) constructor instead. Fix by using QString. Change-Id: I96371a15e1af957ef8133e30e79eb3e22b3e9d32 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLineEdit: check a int->QChar conversion, and make it explicitGiuseppe D'Angelo2020-11-061-4/+12
| | | | | | | | | | | | | QStyle::styleHint returns int, and that int was simply used to build a QChar representing the "password mask" character. Enforce that it actually fits and then do an explicit cast. (In general, of course, this is an API flaw; styleHint should somehow return a QString for this use case). Change-Id: Ifb6181b229b91cc84859cb9b9d57e21d6748c31a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Android: blacklist a list of failing tests for androidAssam Boudjelthia2020-11-0436-4/+269
| | | | | | | | | | | | | | | | We want to re-enable Android tests in QTQAINFRA-3867. However, many tests are failing already preventing that from happening. QTBUG-87025 is currently keeping track (links) to all of those failing tests. The current proposal is to hide those failing tests, and enable Android test running in COIN for other tests. After, that try to fix them one by one, and at the same time we can make sure no more failing tests go unnoticed. Task-number: QTBUG-87025 Change-Id: Ic1fe9fdd167cbcfd99efce9a09c69c344a36bbe4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add multi key bindings to QShortcutAllan Sandfeld Jensen2020-11-041-0/+20
| | | | | | | | | | | This makes it feature comparable with QAction, and makes it possible to use as a backend for QAction, and fixes a few missing alternative keybindings in qtwidgets. Change-Id: Iaefc630b96c4743fc5ef429dc841870ddd99fc64 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Get rid of all instance usage of QFontDatabaseVolker Hilsheimer2020-11-033-23/+16
| | | | | | | | All QFontDatabase APIs are static, use them accordingly. Task-number: QTBUG-88114 Change-Id: I0e4a7508646037e6e2812611262eed8b6d7ad3de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QCombobox: propagate the palette to the embedded line editWang Chuan2020-11-021-0/+27
| | | | | | | | | | Let the new created embedded QLineEdit use the palette from QCombobox, when calling [setEditable(true)] Fixes: QTBUG-81533 Pick-to: 5.15 Change-Id: Ia406dd8122a348e185f0e94d027646b95eeaa76e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* CMake: Fix tst_qapplication to respect blacklists in CMake buildsAlexandru Croitor2020-10-301-0/+1
| | | | | | | | | | | CMake builds are special and need to know the path to the source dir. This is handled automatically by QTEST_MAIN, but tst_qapplication doesn't use QTEST_MAIN. Thus we need to call QTEST_SET_MAIN_SOURCE_PATH manually. Task-number: QTBUG-87137 Change-Id: Ib2c461f0da0a3d9a2f571f37476b750a606065f7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QPushButton::touchTap autotestShawn Rutledge2020-10-291-0/+25
| | | | | Change-Id: Ibfed43fd4b8fdc3834ee7ca7bd92296504943abe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update tst_qspinsbox test to use metaType systemDavid Skoland2020-10-281-1/+1
| | | | | Change-Id: Ib744a1ceb3d90ae443ee754f97c0ef1edbbac52f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate old aliases for two countries and several languagesEdward Welbourne2020-10-282-8/+8
| | | | | | | | | | [ChangeLog][QtCore][QLocale] Deprecated several Language and Country aliases, ready for removal in Qt 6.0, in favor of their newer names. Task-number: QTBUG-84669 Pick-to: 5.15 5.15.2 Change-Id: Iebaa0a5a77bfa12f7014de53fab4a25b5f1cc92c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Skip flakey dialogs testcase on all platforms except windowsVolker Hilsheimer2020-10-271-3/+2
| | | | | | | | Testing the mouseMoveCount before XFAIL'ing before then testing the mouseRelaseCount was anyway wrong. Change-Id: I666f143ff15088562fc63f833f5785f870de6f26 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Show the year correctly after it has been editedAndy Shaw2020-10-261-0/+4
| | | | | | | | | | | | When converting the year as an integer via the locale then it can add in group separators which would not be desired here. Therefore it should be converted via the QDate approach to get the right output for the year. Fixes: QTBUG-86307 Fixes: QTBUG-85966 Pick-to: 5.15 Change-Id: I092bd1e5f69e544843fd5f28c96b94c9066490c5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-239-40/+40
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tests: blacklist tst_QGraphicsAnchorLayout::layoutDirection()Liang Qi2020-10-221-0/+2
| | | | | | | | | | | on Ubuntu 20.04 There is some issue with the glib event dispatcher. Task-number: QTBUG-87728 Pick-to: 5.15 Change-Id: I4d64206898dd2c8356d5fc51a68c2e5759b38aac Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* tests: blacklist tst_QMdiArea::tileSubWindows() on CentOSLiang Qi2020-10-221-0/+1
| | | | | | Task-number: QTBUG-87768 Change-Id: Iad86e3114e546c0cab92f0fccdc7a265575a687e Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Fix a bunch of compiler warnings in event handling test casesVolker Hilsheimer2020-10-223-13/+13
| | | | | | | | Leave the normalizedPos warnings, there is no equivalent function. Change-Id: I50c72ab24b4855e36941aafdee30cdb0e94c1684 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QTabBar: update index of last visible tab in insertTabStanislav Yelenskiy2020-10-211-0/+26
| | | | | | | | | | | | | | Index of the last visible tab was not updated, if a new tab was inserted after the current tab and before the last tab. When the new tab is inserted before the last visible tab, the index of the last tab increments by one. When the new tab is inserted after the last visible tab, then the newly inserted tab becomes the last visible. Fixes: QTBUG-86898 Change-Id: I2f4b7f705261ec35a5aa7b883ecdddba25f007b7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTabBar test: refactor: extract checkPositions helper functionStanislav Yelenskiy2020-10-211-22/+31
| | | | | | | | | | | Extract checkPositions helper function to re-use in the new test. Task-number: QTBUG-86898 Change-Id: I5c8241b5701cd8c8c3e21607c385217d4b75e728 Reviewed-by: Jordi Pujol Foyo <jordi@vikingsoftware.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Swallow some runtime warnings from tst_qapplicationVolker Hilsheimer2020-10-181-0/+2
| | | | | Change-Id: I226c3b55a1666eb3ccd369a3307919d4c72a2600 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix compile warning from testing deprecated signalVolker Hilsheimer2020-10-181-7/+46
| | | | | | | Silence the warning, and test event delivery in addition. Change-Id: I59c49a2ac70ecd32429116b76643700a7ad5ce3e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QAbstractItemView: don't lose items if model only allows MoveActionVolker Hilsheimer2020-10-161-19/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a model only allows MoveAction, then calls in the view/widget subclasses' dropEvent implementation to set the event's drop action to CopyAction will fail. QAbstractItemView will then remove the item when QDrag::exec returns. Instead of abusing the event actions for this, store explicitly that the dropEvent implementation already moved the item. If the flag is set, don't remove the item. In QListView, which uses moveRow to move items in the dropEvent handler, handle the case that the model might not implement moveRows. In that case, or when dropping an item onto another item (to overwrite data), fall back to the default implementation of QAbstractItemView. Sadly, it is impossible to know whether a model doesn't implement moveRows, or whether the move failed for other reasons, so this requires a bit of extra special case handling. QListView in IconMode is particularly odd in that it moves the item in the view, but not in the model. This follows up on fd894fd68edf3d67975cda8eb9dda43646887b0d and fixes additional issues discovered during debugging. Extend the existing unit test; since drag'n'drop runs a modal, native event loop on most systems, it still only runs on the Xcb platform. Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4 Pick-to: 5.15 Fixes: QTBUG-87057 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tests: blacklist two tests on Ubuntu 20.04Liang Qi2020-10-142-0/+4
| | | | | | | | | | | | tst_QApplication::sendEventsOnProcessEvents() and tst_QItemDelegate::editorKeyPress() There is some issue with the glib event dispatcher. Task-number: QTBUG-87137 Pick-to: 5.15 Change-Id: I79a983192edef3c3560a4296cc9dea2dfc2ee1b0 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Get rid of all usage of QApplication:desktopVolker Hilsheimer2020-10-147-22/+15
| | | | | | | | Use QScreen APIs instead. Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Avoid repeated date-time formatting in test data namingEdward Welbourne2020-10-091-14/+16
| | | | | | | | Also correct two comments which lied about the year being tested. Change-Id: I5be491a2b2c1e0c3b49d6ff9a8de852e17321cff Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-0744-141/+141
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Test end-date, not just its string representation, in QDTE testEdward Welbourne2020-10-061-170/+264
| | | | | | | | | | | | | In tst_QDateTimeEdit::dateEditCorrectSectionSize(), only the final displayed date was tested; many of the tests checked day of week (by name), which might well match despite actually selecting a different date than the one intended. So test the date is as expected, too. In the process, tidy up the code, give values more informative names, turn a trivial static function into a lambda. Change-Id: I0491159e9ee2f3cfdcf8a194c723be92c190c2a8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFlags: remove deprecated constructorEdward Welbourne2020-10-032-5/+5
| | | | | | | | Fix remaining places that still exercised it. Task-number: QTBUG-85700 Change-Id: I84562f53439197141343831c0b9f88983689e6bf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QTreeView: fetch as many nested entries as fit into the viewVolker Hilsheimer2020-10-021-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | QAbstractItemModel::canFetchMore and fetchMore implementations might only add a few rows to the model each time they are called. The item views don't generally expect that, and don't call fetchMore repeatedly, even if there would be room in the itemview for more data. This problem cannot be generally solved for all item views, as it would require in repeated expensive laying out of items. For nested indexes in a treeview however, we can try to fetch enough child rows to populate the screen when the item is laid out by repeatedly calling canFetchMore and fetchMore. To calculate how many items have space, apply the same heuristics as in the scrollContentsBy implementation to guess the number of items that can fit into the viewport. Created test case for the fix. Done-with: Doris Verria <doris.verria@qt.io> Fixes: QTBUG-85366 Pick-to: 5.15 Change-Id: I54f95552993873dd4cba80b0f70f4db9d98ddc1d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Re-enable a QDateTimeEdit right-to-left test of its sectionText()Edward Welbourne2020-09-301-8/+11
| | | | | | | | | Use a QScopeGuard to fix its restoration of left-to-right mode after completion. Change-Id: I5ac1e44629e72d993f2d5ba6586b86508d57cdaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* tests/xcb: fix tst_QWidget::updateWhileMinimized() - againLiang Qi2020-09-291-1/+2
| | | | | | | | | | | This amends 4403ec3bc1501cde454b0546759d4c27f9b6cb1b. CentOS 8.1 uses GNOME in XDG_CURRENT_DESKTOP. Pick-to: 5.15 Task-number: QTBUG-68862 Change-Id: Ia9a6f7f4c47853fc53d9860dad070109271a438e Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Fix compiler warnings from QKeyCombinationLars Knoll2020-09-2810-27/+36
| | | | | | | | Change lots of code to avoid the deprecated operator+() or implicit casts to int. Change-Id: I0c343cd5b28603afdf1214eefb85e928313345e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* fix QComboBox currentText return placeholderTextWang ChunLin2020-09-251-1/+1
| | | | | | | | | If it does not add item,the currentText should return empty string Fixes: QTBUG-86580 Pick-to: 5.15 Change-Id: I54c3a8b7ececfb1e62bcd7ac592feccaff3f8b48 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix redundant emission of editingFinished from QLineEdit with Return keyChristian Heimlich2020-09-231-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of QLineEdit uses the "edited" bit-field flag to prevent unnecessary emissions of editingFinished() when a line edit loses focus but its contents have not changed since the last time the signal was emitted; however, this flag is only cleared when the signal is fired due to focus loss and not when the Return/Enter key is pressed. This causes an unexpected double emission of the signal when focus is lost following a press of the Return/Enter key if the line edit's text was not further altered between the two actions. This change includes the Return/Enter press as a trigger for clearing the "edited" flag to make editingFinished()'s behavior more consistent and expected. Prevents slots in user code from triggering twice in situations where the line edit's current contents have already been handled, but still allows the end-user to force an emission of the signal via Return/Enter. The effect of the "edited" flag on the signals behavior has also been noted in the signal description as it was previously omitted. [ChangeLog][QtWidgets][QLineEdit][Behavior Change] Pressing the Return/Enter key in a QLineEdit will now also prevent editingFinished() from firing due to focus loss if the contents of the line edit have not changed since the last time the signal was emitted. See - https://forum.qt.io/topic/116902/ Change-Id: I11aadd45341337b7852da8cf5802c7c9efdd614d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-23127-157/+157
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate projectsAlexandru Croitor2020-09-226-3/+118
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Define inverted QRects consistentlyAllan Sandfeld Jensen2020-09-211-4/+4
| | | | | | | | | | | | | | | | Changes the definition of invalid QRects to be more consistent. This simplifies the logic, and makes it possible for us to fix normalized() so dimensions don't change. The actual API is not changed except for inverted rects. Only one use-case for the old normalized() function existed, and has been reimplemented as QRect::span(). Fixes: QTBUG-22934 Change-Id: I29dad2952dc6c8e84a6d931898dc7e43d66780f3 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add reentrancy guard for processEvents() in QProgressDialog::setValue()Christian Heimlich2020-09-211-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of QProgressDialog always calls QCoreApplication::processEvents() when the user calls QProgressDialog::setValue() if the PD is modal. For most cases this is fine, but when using a Qt::WindowModal PD with setValue() connected to a signal in another thread using Qt::QueuedConnection a reentrancy issue is present if setValue() is triggered too frequently as the execution of its previous call may not have finished. If this happens too many times in a row a stack overflow will occur. Current documentation notes this potential issue but offers no way it avoid it while still using QProgressDialog (user must implement a custom dialog) without resorting to using Qt::BlockingQueuedConnection, which unnecessarily reduces performance. Introduces the boolean reentrancy guard "processingEvents" that is checked before calling QCoreApplication::processEvents() in a modal PD when setValue() is used. It is set before the first call to processEvents() and cleared after that call returns. This ensures that only one invocation of processEvents() is possible from within setValue() at a time, and thereby minimizes iterations of the main event loop and eliminates the aforementioned stack overflow condition. See - https://forum.qt.io/topic/118292/ Fixes: QTBUG-10561 Pick-to: 5.15 Change-Id: Ifa9b91cbb66881981356954ead0906bdc91fab60 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* QGraphicsView:QGraphicstextitem show error after lose focusZhang Hao2020-09-181-1/+35
| | | | | | | | | | | | | The reason for this bug is that after the TextItem loses focus, the focusItem in QGraphicsScene is already empty. When QGraphicsScene responds to the inputMethodEvent event again, since focusItem is already empty,focusItem will no longer deliver events. Fixes:QTBUG-85088 Pick-to:5.15 Change-Id: I329054333c2adec133d35318761612aca3afcf0d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix warning from shadowing virtual functionVolker Hilsheimer2020-09-171-20/+11
| | | | | | | QToolButton::initStyleOption is const. Apply some DRY while at it. Change-Id: If29a52e828bbc2aa58df2852c4c434545acfef3e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix deprecation warnings in testsVolker Hilsheimer2020-09-171-12/+12
| | | | | | | | Adjust to changes to QIcon::pixmap, QMetaType::type, and QAbstractItemView::itemDelegate. Change-Id: I9eb0331ef899131afc86c33f27feeee76331ffc8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>