summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
* Test result of qobject_cast before dereferencingLi Xi2021-11-161-0/+13
| | | | | | | | | | | | | | Since QMainWindow::setMenuWidget accepts a QWidget (allowing users to implement their own menu widget), we need to use qobject_cast on the stored widget to see if it is a QMenuBar before calling QMenuBar APIs. This qobject_cast may return nullptr. Fixes: QTBUG-98247 Change-Id: Iff1dbd24fa7ca09098fe49c179770356c966251d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a0e7fbd4d54ddbea5c2b155b0f828df3ce3c98fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: check if objectClass() is not null in registerNativeMethods()Assam Boudjelthia2021-11-152-12/+48
| | | | | | | | | | | | | In case the class doens't have a default constructor, checking for object.isValid() will give false because the object won't be created, however, the class could still be loaded and we could have a valid jclass. Fixes: QTBUG-96069 Change-Id: I8d59e26d9d7c0e8e363ce443937091a374a24473 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit dfb4b7856a82a72934211d9a1a44626777570d30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: make the slider knob big enough for BigSur and MontereyVolker Hilsheimer2021-11-151-2/+6
| | | | | | | | | | | | The slider is very touch friendly from macOS 11 on, and the knob is quite large. Give it some extra pixels, and adjust the test accordingly. Task-number: QTBUG-98093 Change-Id: Iedf6db1081cdd4013ca29ce760aea1e0361b1123 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 6ff07ec23b562d78f7fa19b5c6ada72724dc81a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QMultiHash::operator== crashAndreas Buhr2021-11-111-0/+12
| | | | | | | | | | | QMultiHash::operator== crashes when comparing two unequal objects. This patch fixes it. Fixes: QTBUG-98265 Change-Id: Ibf9fef3372a2b4581843be5f25e65cc9a55ef64d Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 838edd9c48284b97dfc22cf3644bb082035a9a93) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDuplicateTracker: add clear()Thiago Macieira2021-11-111-0/+16
| | | | | | | | | I'll need it in QFactoryLoader. Change-Id: Ice04365c72984d07a64dfffd16b47f68d25252b4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 090c7e3262dce93df83c73a4a822761e5d9b4650) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFileDialog: Fix adding default suffix when file path contains dotAlexander Volkov2021-11-111-0/+16
| | | | | | | | | | | Check that a file name, not the full path, contains a dot. Fixes: QTBUG-59401 Change-Id: I193b2ae457a3ac6a460524dbf200786eb3461cef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit d36249e9759364a7025b531d1dfe89a891e65a4e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: Expose the maximum uniform buffer range limitLaszlo Agocs2021-11-111-0/+2
| | | | | | | | | Task-number: QTBUG-97715 Change-Id: I7f0a52c410b9b77f735fb3b7fd33141674bb0cda Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit a8be40bd64b9258334d6936b1775bc6631fd158d) Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-111-1/+1
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6652bf2353d807f724f398a15cb22c188830f57c)
* Fix tst_qfontdatabase on Windows with FreetypeEskil Abrahamsen Blomfeldt2021-11-111-1/+5
| | | | | | | | | | | | Since e05e3c776256d35798f451f31cd71e809786ed78, the advance test in tst_QFontDatabase::condensedFontMatching() passes with the bundled freetype engine, so the XFAIL causes a failure when running with this configuration. Change-Id: Ie6fbccfa0d9c79654563e9e3f19694f252e32fc6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 518790af79df339143820cd9d34a74c00db1ed7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update CLDR-derived data to newly-released v40Ievgenii Meshcheriakov2021-11-101-3/+3
| | | | | | | | | | | | | | Update tst_qlocale to take into account "narrow" day representation change for Russian locales. This version of CLDR changes narrow forms to one letter. Previously those forms were identical to short forms (two letter). The new representation is consistent with other languages and so does not appear to be a bug. Fixes: QTBUG-94358 Change-Id: I9724c281a250685da8232e5c05c9c375a8c79253 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 96a03533f95425217c23e3e2fe6574984545d3a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Workaround MSVC 2022 bug about QString::replaceAndreas Buhr2021-11-101-2/+5
| | | | | | | | | | | | | MSVC 2022 (17.0.0) complains about "'QString::replace': 12 overloads have no legal conversion for 'this' pointer". This is a compiler bug. It is reported to MS. Still we workaround it here so that qtbase can be built with MSVC 2022. Task-number: QTBUG-96975 Change-Id: I0180e2e6760d2809ca61e3cd8f02b04f970172a7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 30a70fc6e0ffa562e27d0fc25f99187f7de71493) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDomDocument::setContent: Open device if necessaryFabian Kosmale2021-11-091-0/+18
| | | | | | | | | | | | | This restores the Qt 5 behavior in Qt 6, but prepares for disabling it in Qt 7. We want to deprecate the current behavior, as it makes it unclear who is responsible for calling close. Fixes: QTBUG-97747 Change-Id: I2c99eb96667e784576d8850085068ca334d75b16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit a4ce85f356b78401fe727a07b908a1e7b5a25198) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAIV: Reset double-click flag in mousePressEventVolker Hilsheimer2021-11-051-0/+38
| | | | | | | | | | | | | | | | Amends 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f, which introduced logic that recognizes double clicks to avoid duplicate clicked() emits. If a slot connected to doubleClicked opens a dialog, then the release-event will not be seen by the item view, leaving the flag incorrectly set and preventing the next clicked signal. Fixes: QTBUG-97853 Change-Id: Iced83e8c66a763672f522265435dc52a745227e4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit e5ebc28764979f00f1ce3aeb8b2d44b5cadb93c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Include qproperty.h where neededMarc Mutz2021-11-054-0/+4
| | | | | | | | | Don't rely on transitive include from qobject.h, which will go away. Change-Id: I99dd97ff4fb1d0632d040daab0bffa2d7b85d3ae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 0b768e3c43887fe35c2df4ca4263f54ebb7fec9d) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Prevent recursive calls to QWindow::closeTor Arne Vestbø2021-11-041-0/+27
| | | | | | | | | | QWidget will call close() in its destructor, which we might end up in if a user deletes the widget in the closeEvent. Change-Id: I39684aec0ca130033dad60f2bbf823364a5edcec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit acb86da793c603991da63ba6ab7c6684518d0cd2) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Correct qcollator_posix.cpp's check against system localeEdward Welbourne2021-11-041-3/+3
| | | | | | | | | | | | | | | The check was made against the default locale but the code calls the system functions (wcscoll, wcsxfrm, wcscmp) for locale-specific collation, so should be comparing to the system locale's collation locale (i.e. LC_COLLATE). Also correct the Android-only check in tst_QCollator::compare() which duplicated the check but neglected the C locale, which is also supported (via QString::compare). Change-Id: I48c3237dd6825e2070272ab88d95bdb8cbb9fc37 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 25d807f6292e9918ccdbe06cf7f590f60ecae457) Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Test QWindow close() behaviorMorten Johan Sørvig2021-11-041-10/+77
| | | | | | | | | | | | Verify that closing a QWindow using either the close() API or a close event works as expected, and that the window can be re-created. Also test QWindows with child windows. Task-number: QTBUG-46701 Change-Id: I4c12452ff58e1233536c2d6932e72cf924d8ed74 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 8c2fda1ef5cb913522cad1fa74b321ed5744b870) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Release mouse buttons after double clickVolker Hilsheimer2021-11-031-0/+2
| | | | | | | | | | | | Otherwise, the button state maintained by Qt when using the offscreen plugin is not reset, breaking following tests. Task-number: QTBUG-97964 Change-Id: Ib37fd038e214863e1e316dc3d41e9d28c157b1f8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io> (cherry picked from commit 9151ab44bc7af04471d034e21746d7e9da0c01ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bump version to 6.2.2Jani Heikkinen2021-11-022-2/+2
| | | | | Change-Id: Ic14ce91b21948d1c6051a5476f74e0a8bbbf9080 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix signed/unsigned comparison warnings in tst_QArrayDataEdward Welbourne2021-10-291-6/+6
| | | | | | | | | | | QArrayDataPointer<>::size is now a qsizetype, not the uint it used to be. Change-Id: I09d7e5a50401b46a12f29f93b2b39d646b771cfc Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 3b51b8c31df493ea2c9946c49fc2fc39690ed6a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix test to not rely on event processingVolker Hilsheimer2021-10-271-6/+8
| | | | | | | | | | | | | | | | | | QTest's simulation of mouse move events currently uses QCursor::setPos and then processes events. This is unreliable across platforms. This test relies on the event processing and either way has inverted logic in the paint event; the painted region needs to at least include the tab's rect, not the other way around. Also, the mouse move wasn't needed here at all, and some styles don't have a different style for pressed tabs anyway. Change-Id: Ib8f6f7be017ff87458e96ec419edcd065dd75b15 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 05532a09684990ebfabf1fa60fcdb7751afb8282) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Calculate effect bounds when drawing widget graphics effectAntti Määttä2021-10-271-0/+153
| | | | | | | | | | | | | | Calculate effect bounds for the updated region when drawing the effect so that the whole affected area gets updated. The effect bounds have already been added to the region so it doesn't need to be handled in the drawing function. Fixes: QTBUG-96240 Change-Id: I0c317311622e6299fb1a3015541408d1d83c93de Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ea3ede9c45748aa8bc1dee572be2570f83fbcb95) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update clipping area when antialiasing changesChen Bin2021-10-271-0/+76
| | | | | | | | | | | | | | | | | | | | Antialiasing is disabled when the painter's antialiasing attribute is set behind the clipping function(example `setClipPath` or `setClipRegion`). The cause of this problem is that the antialiasing state of the clipping region is not updated after the antialiasing attribute is set. A variable is required to record the painter's transformation state set before the clipping function, because the transformation will be applied to the clipping region, resulting in the abnormal clipping region. The value of `s->matrix` is not accurate for the clipping fun- ction. Fixes: QTBUG-97269 Change-Id: I409a9db32efc3b991ebb97ec9aed19bbddb273d8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 6de36918c03e91933fbfb5bf7b53abbe03edf460) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QHash: avoid crashing when reserving on a shared hashMårten Nordheim2021-10-261-0/+17
| | | | | | | | | Change-Id: I21ad13fa223bd5a2c61112e790965093a2750268 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 323b97ccaea7b9442fa1bcb01514e0c5a4a97fdc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVarLengthArray: Reduce memory allocations in insert()Robert Löhning2021-10-261-0/+31
| | | | | | | | | | | | | | | | | Currently, we allocate memory for elements one by one which can get pretty slow when adding many elements. [ChangeLog][QtCore][QVarLengthArray] Reduced number of memory allocations in insert() by allocating more memory at once. Fixes: QTBUG-97489 Change-Id: Idfb5b5946b047d5215c8ed00770574249f9f5d40 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit a7d1c48ca3162a805708d059da87ca3d742863f1) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTabBar: re-layout when tab size hint depends on selected stateVolker Hilsheimer2021-10-251-2/+30
| | | | | | | | | | | | | | | | | | QTabBar caches the rects for the tabs to avoid costly recalculation of each tab's size hint. That cache is only updated via layoutTabs if the entire tab bar is resized or modified. However, when a style sheet is set that calculates a different size hint for tabs that are selected, then the tab bar also needs to be laid-out when the current tab changes. To minimize the cost, compare the cached size for the new current tab with its new size hint, and re-layout the tabs when they are different. Fixes: QTBUG-6905 Fixes: QTBUG-8209 Change-Id: I110444d18938c2b3446ee58e4a8c6c472b5f12c3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit da632baf34ef2308da04c56c497e115b9d1ad531) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't fire shortcut if the action only lives in an unreachable submenuVolker Hilsheimer2021-10-251-0/+74
| | | | | | | | | | | | | | | | | | Menus can be represented by a menu action, and if that menu action has been hidden or disabled, then the submenu is not accessible from the parent menu or menu bar to which it was added. Don't walk the menu action chain further when checking whether the shortcut should trigger. Note that this is unrelated to the menu being visible or not; we obviously want to trigger shortcuts for actions that only live in a menu that has not been shown, otherwise the shortcut would be rather pointless. Fixes: QTBUG-25743 Change-Id: I48735e17352989bbc84a72263e4828f519b78095 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 01f96b1764d0339aca2b7f2de4cef6b97047cb7b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* BLACKLIST tst_QListView::internalDragDropMove for OpenSUSE leapHeikki Halmet2021-10-251-0/+3
| | | | | | | | | Task-number: QTBUG-94250 Change-Id: I9ea92b5952e1823cf90716f027f2f8eea1b86278 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> (cherry picked from commit ca321cfa0bf5249adda253e4c98eda825fa9f7da)
* Consistently restore threadpool limit at end of testsVolker Hilsheimer2021-10-221-12/+20
| | | | | | | | | | | | Fix warning about unused variable, and use qScopeGuard to make sure that the limit of the global threadpool is restored even if one of the tests fail. Change-Id: I36747cb451074cceea961561478210728ed6d313 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7d133a5613b7d9bae544fa56d26577c0c9d50ff4) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix metatype declaration for QHash/QMultiHash with no operator==Sona Kurazyan2021-10-201-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | When declaring metatypes, the metatype system tries to detect if the comparison operators for the given type exist and automatically register them. In case of QHash, the equality operator was enabled if the value type provides one. But the implementation needs equality operator of the key type as well. As a result, when the key type has no equality operator, the metatype system detects that the equality operator is available for the QHash itself, but the compilation for metatype registration fails when trying to instantiate the code that uses equality operator for the key. This is fixed by enabling equality operators for the QHash only when both the key and value types provide one. The same issue existed also for QMultiHash, with the difference, that QMultiHash didn't have the constraints even on the value type. So added checks for both. Fixes: QTBUG-96256 Change-Id: Ib8b6d365223f2b3515cbcb1843524cd6f867a6ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit a9d51298ae34ed05adb100983ed92bec07ce2ce5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QDir::mkpath() return true when given an existing root pathKarsten Heimrich2021-10-201-4/+4
| | | | | | | | | | | On macOs with APFS mkdir sets errno to EISDIR, so take the error code into account. Fixes: QTBUG-97110 Change-Id: I8e7d10c95430a2802bdbfbf94dd65219bd9071a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit bb8d84c358eb4b324258b936bdeb211fdd90d7cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Compile Private API autotests for INTEGRITYTatiana Borisova2021-10-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | - GHS's __PRETTY_FUNCTION__ (used by QT as Q_FUNC_INFO) doesn't have spaces round the = operator when indicating the type of the template parameter. The compilation error: qt5/qtbase/src/corelib/kernel/qmetatype.h", line 2104: note #3316-D: cannot access position 53 in array of 49 elements constexpr const char *begin = func + prefix; ^ detected during: instantiation of "auto QtPrivate::typenameHelper<T>() [with T=void]" at line 2186 Task-number: QTBUG-97087 Change-Id: I33e61f5d54a61944a5aecf07d149a8dee0ef1e5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 57ec47921e1e703372c1a69a5e3b375ef3918acc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QDir::mkpath() return true when given an existing drive nameKarsten Heimrich2021-10-201-0/+5
| | | | | | | | | | | | | Commit ed48391c592e8ba68c723e3017ac384f0c7a7c23 removed the check for ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...) function in case an existing windows drive name was passed as argument. This restores the behavior of the function which broke after 5.15. Fixes: QTBUG-85997 Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> (cherry picked from commit 71652ad4bf7b4cfe35473c3f93213c16e7653135) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* uic: Fix missing Python import when setting tab ordersFriedemann Kleint2021-10-201-1/+1
| | | | | | | | | | Add QWidget as default import so that QWidget.setTabOrder() is found. Change-Id: I7593008d1395e3fddacf7124d271a0eaf4c345d9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 5074679cfc80ef6bf8c098cd8e90cc318ab65e6c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Correctly record normalGeometry in Cocoa pluginVolker Hilsheimer2021-10-181-61/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cocoa sends QWidget the state-change notification after the window has been resized already, at which point we cannot store the normal geometry anymore. Handle zoom and full screen callbacks prior to the state changing to store the geometry in QCocoaWindow. We do not need to handle minimized state, as the window will still reflect the original geometry. Return the stored value from an override of QPlatformWindow::normalGeometry so that QWidget gets the correct values even though the new state is already active. Fix the tst_QWidget::normalGeometry test to make it pass on all platforms by waiting for the window to actually have transitioned to the new state before comparing geometries. Both macOS and Windows fully pass; on Xcb, deminimizing a window using setWindowState does not work, which is why the test was partially skipped (confirmed by visual testing). Move those problematic, complex test cases to the end so that most cases are covered on Xcb as well. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 74e634d82ced894f235526c7c2b6ac476c93e2bc) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Clean up tst_qwidgetVolker Hilsheimer2021-10-182-186/+184
| | | | | | | | | | | | | | | | | | | | Remove dead code Make logic to position test widgets more consistent across test functions Consistent cursor positioning logic Get rid of unnecessary event processing Reduce calls to qWait with hard coded values Use qWaitFor to establish asynchronous preconditions Ignore expected warning messages Expect-fail (instead of blacklist or skip) some tests that always fail Ignore unpredictable events in childEvents test Split large "render" test in multiple test functions Task-number: QTBUG-52974 Task-number: QTBUG-26424 Change-Id: I206e114c2c1d9801e08600d3341c2738dc881f17 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 1453f048f535d98ea2454462875eed77a966bcde)
* Fix cursor positioning on bidi boundariesVolker Hilsheimer2021-10-181-0/+58
| | | | | | | | | | | | | | | | | | When the cursor is positioned between to script items that have different writing directions, prioritise the script item that has the same direction as the paragraph (i.e. the QTextEngine) when deciding where and how to display the cursor. If visual cursor movement is enabled, the behavior is unchanged. As a drive-by, clean up coding style and avoid shadowing of function- local variables. Task-number: QTBUG-88529 Change-Id: I15227b10b1469d9caf1235b00e4d6f9f64a8b510 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 5335cc4a5a73bbd6d717989b4257660b92000fb6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix cursor placement at left and right ends of bidi textVolker Hilsheimer2021-10-181-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a text line that has a change of direction at either end of the text, the cursor needs to be positioned where the next character is inserted, or where backspace deletes the previous character. In bidi text, this is ambiguous as illustrated by this example: abcشزذ Depending on whether this string was typed in a left-to-right document or in a right-to-left document, it could be first latin, then arabic; or it could be first arabic, then latin. If a general left-to-right context, cursor position 0 should be in front of the 'a', and cursor position 6 should be at the end of the arabic text, in the visual middle of the line. Cursor position 3 can be either after the 'c' if the next character typed would be latin, or at the visual end of the line if the next character will be arabic. Qt calculated the cursor position past the right end of the text as 3 (which is not wrong, but 3 has two visual positions), and placed the cursor at the visual end of the line (favoring the right-to-left alternative). Backspace would then delete the 'c', writing a new latin character would insert a 'd' next to the 'c', writing a new arabic character would insert it also in the middle - none of these operations happen at the visual end of the line, where the cursor was blinking. To fix this, we take into account the general layout of the text, which is typically based on the document, or the user's locale setting and UI translation, and calculate the cursor position accordingly: if we are past the visual end of the document on either side, then the cursor position is either 0 or the last character of the text, depending on the direction of the QTextEngine used. This way, the cursor ends up in the middle of the document when we click beyond the end of the line, which is where characters are removed and inserted. Typing a 'd' at this point will make the cursor jump to the end, where the d is added. There are still corner cases: clicking on the right-most arabic character calculates the cursor position as 3, which is then ambiguous, as it can be either at the visual end of the string, or next to the 'c'. َQt makes the inconsistent choice to place the cursor at the visual end, showing the left-to-right indicator, but pressing a 'd' adds the 'd' after the 'c' in the middle of the text. Fixes: QTBUG-88529 Change-Id: Idccd4c4deead2bce0e858189f9aef414857eb8af Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit f54044d4a92ab5ef04c11bc3ca9f064e91d97e63) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QTabBar's SelectPreviousTab behaviorQiang Li2021-10-171-0/+2
| | | | | | | | | | | | | | | When setCurrentIndex is called by removeTab, the old current index might no longer be valid. Only update the lastTab value of the new current tab if the old current index is still valid. As a drive-by, use the validIndex helper function. Fixes: QTBUG-94352 Change-Id: I945e2093a90a1fccbba86d32b1113f83fedd41de Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 5d4b91ea66666f3c8d3c8640b87a33c13dbd0c2c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add missing version bump from '6.2.0' to '6.2.1'Jani Heikkinen2021-10-172-2/+2
| | | | | | | | Fixes: QTBUG-97458 Change-Id: I1379a55e7180f1f37a8f8fb5ff27d244785a2145 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 4bd8dc01c3cca18767000737f018eb61506567b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Cleanup of qthreadpoolAllan Sandfeld Jensen2021-10-171-7/+56
| | | | | | | | | | | | | | Don't bother overwaiting in waitForDone(), if it was done at one point after it was called we can return true. And do not stop threads recently awakened by a startThread call as they have tasks to do. Make allowing at least one thread regardless of reservation more standard instead of hacked in certain places. Change-Id: I304bcdc5822f440d5e72fc33ba2aa1678c9ba0d0 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 9a6c653eaf22f604289a02c844af3bc5880605e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWidget: Don't rely on topextra to determine if window is top levelTor Arne Vestbø2021-10-171-0/+1
| | | | | | | | | | | Doing so results in bailing out early for a widget that hasn't been shown yet, or otherwise resulted in creating extra and topextra, which means the normalGeometry will not reflect the widget's geometry. Change-Id: Ieb85e9a6109ae34fe20d79e3c12f4517f827a590 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e95e9c28f07e22ea76a7a5521c090a785133dbfd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix autotest public API compilation for INTEGRITYTatiana Borisova2021-10-172-4/+12
| | | | | | | | | | | - getgid/getpwuid are not supported - process should be used with config check Task-number: QTBUG-96176 Change-Id: Ib6854772bcf52f3533cb722f963426717926258b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 144f3fe5a38d0cfe9778c855919a4ad26fa482fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* When filling a pixmap after an assignment ensure the set DPR is not lostAndy Shaw2021-10-171-0/+14
| | | | | | | Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit a36c84c6a3dca29afdb7741b16975c108be341ab) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Call QWidget close handling in QWidget::close for non-toplevel native widgetsDoris Verria2021-10-171-0/+20
| | | | | | | | | | | | | | | Since commit 7ba75d0 we close the QWindow in QWidget::close for native widgets and trigger the closeEvent in QWidgetWindow. However, if the widget's window handle is not a top level window, QWindow::close() will not close the window, failing in this way to deliver the closeEvent and call the close handling in QWidgetPrivate::handleClose. To fix, call handleClose() from QWidget::close for such widgets. Task-number: QTBUG-74606 Change-Id: Ied342eced3340aaf19b5443762935b1a5fc5c27b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ec09900997e9b92206938ca5f9fe2e356440e513) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Select a single range of cells in QTableView, away from merged cellsShawn Rutledge2021-10-171-0/+75
| | | | | | | | | | | | | | | | | | | | | - when there is no intersection between the current selection and the spans collection, get ranges for all cells, just as if no span exists - when there is an intersection between the current selection and the spans collection, get separate ranges for each cell (as before) This fixes the regular case of selecting multiple non-spanned cells after some cells are merged (get a single range for all cells instead of separate range for each cell). However, when selecting together a group of spanned and non-spanned cells, you still get a separate range for each cell. But this is normal behavior in similar applications; for example in LibreOffice, you cannot select and merge spanned and non-spanned cells: an error dialog tells you that it's not allowed. Done-with: Christos Kokkinidis Fixes: QTBUG-255 Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 826765f654e43034929ff6fbc975ab0ab5d6922a)
* Markdown importer: keep entities in HTML blocks with the HTMLShawn Rutledge2021-10-161-0/+66
| | | | | | | | | | | | | If an entity occurs directly in markdown, we parse and insert it directly; but if it occurs in an HTML block, it has to be added to the HTML accumulator string for deferred parsing when the HTML block ends. Fixes: QTBUG-91222 Fixes: QTBUG-94245 Change-Id: I0cf586d68d6751892ca035a98f77cd67950d3bc4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 362e56b520cd5f3efcc7600d558b515a8aec6a79) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Markdown writer: indent fence consistent with code blockShawn Rutledge2021-10-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Under a list item, we've been indenting code blocks: ``` int main() ... ``` - But it's also ok *not* to indent (and github handles that better): ``` int main() ... ``` - There was a bug that when the code is not indented, the fence would be indented anyway: ``` int main() ... ``` and that was not OK, neither for md4c nor for github. Now with this change, either way is rewritable: you can read markdown into QTextDocument, make small edits and write it back out again, with the indentation being preserved (the code block is either part of the list item, thus indented, or else it's outside the list completely). Task-number: QTBUG-92445 Change-Id: I5f51899e28ba9f09b88a71e640d9283416cce171 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 5e55297ee01b20c9cd4119a6e5757a0b4aafd620) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix references to QGuiApplication::lastWindowClosedTor Arne Vestbø2021-10-143-4/+4
| | | | | | | | | | The signal is emitted from QGuiApplication these days. Change-Id: I7423cd4808e8df86960f225fd6e4a12a1a4f11f3 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 947188b969d14dd37c1c8b00b0b9c572cdd6cfac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Take overshoot into account when laying out QAbstractScrollAreaVolker Hilsheimer2021-10-141-0/+39
| | | | | | | | | | | | | | | | | | | | | | | QAbstractScrollAreaPrivate::layoutChildren() positions the viewport, but did not take the overshoot from scrolling with a scroller into account. If the scroll area was resized during a scroll, then this resulted in the roll back overcompensating for the overshoot, placing the viewport outside the visible area. Fix this by taking the overshoot into account when positioning the viewport. Add a test case. We have to use QWindow-based mouse event simulation, as the QWidget based move events use QCursor::setPos, which doesn't reliably go through the gesture framework. Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Done-with: Zhang Hao <zhanghao@uniontech.com> Fixes: QTBUG-94769 Change-Id: Idf650c91e5a9cffa996e23e743939243b1d4fcc0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f7a4a79c62daeba9ab5545c5e0a1f36d5e1fce6b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>