The documentation says we can change window parent to avoid the widget
deleting the window. That didn't work as the widget didn't get the
child-removed event as it wasn't the parent.
This patch instead uses an event filter on the set parent.
Pick-to: 6.3 6.2
Change-Id: I1f61d1832fcf3257722f305beeefd8f1abf1f656
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
When replacing a widget in a hidden splitter, then we only need to keep
the new widget hidden if the previous widget was hidden.
If the new widget is not explicitly hidden, and the splitter is already
visible, then we need to explicitly show the new widget.
Augment test case; the existing test cases already cover swapping out a
collapsed or hidden widget.
Fixes: QTBUG-102134
Pick-to: 6.3 6.2
Change-Id: I9b60711a5c1cab79777ce4183783114a16ac3394
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This reverts commit 1e938c348b
and bb2f4d08d9.
bb2f4d08d9 causes the crash, but 1e938c348b amends it, so
this reverts both. When the cause of the crash has been determined
and mitigated, the patches can be recreated.
Fixes: QTBUG-103719
Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006
Reviewed-by: David Faure <david.faure@kdab.com>
When XCB_INPUT_TOUCH_BEGIN closes a popup, we then receive
XCB_INPUT_TOUCH_END, and cannot find a target window (because it's
destroyed). If we don't deliver it, we need to at least clear the
stored point from QPointingDevicePrivate::activePoints. Then when
we deliver the next touch press, m_fakeMouseSourcePointId also
needs to be reset.
It's now even more paramount that autotests (and real-world
touchscreens) must never omit any active touchpoint from a touch event.
If a point doesn't move, it must be included in the QTouchEvent, with
Stationary state. If not, QGuiApp::processTouchEvent() could generate
multiple TouchBegin events in a row, which gets other bits of logic
confused, here and there.
Fixes: QTBUG-94557
Fixes: QTBUG-98519
Fixes: QTBUG-102751
Fixes: QTBUG-103706
Pick-to: 6.2 6.3 5.15
Change-Id: Ia95e410a2bb8bc7784aa5d296fac2b89e53a9f55
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Invalid inserts of items are tested. However, on an invalid insert
of QTreeWidgetItem into QTreeWidget, the QTreeWidget does not take
ownership of the to-be-inserted items. These items were leaked in
the past.
This patch introduces a scope-guard, so the items are not leaked.
Change-Id: Ib53ac02605c3a3c0bd1ae69bbd0876f860d08093
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Several classes in QWidget use QDataStream internally in order
to save and restore state. These QDataStream usages were not
versioned, meaning that if Qt changes the serialization for some
datatype, then the data saved between different Qt versions becomes
incompatible. Note that the save/restore API in question just produce
opaque blobs as QByteArrays -- the user has no control over the
QDataStream objects and thus versions.
Fix by version the usages.
In QHeaderView this has caused a regression because QBitArray *did*
change version between Qt 5 and 6. In general, using QDataStream without
explicit versioning is a mistake, so deploy the same fix elsewhere as
well.
Fixes: QTBUG-99487
Pick-to: 5.15 6.2 6.3
Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: <doctor.whom@gmail.com>
In a QGraphicsTextItem without a width yet, there's no need to do any
layouting. The use case is obviously items with an app-defined size,
not the default where text items adapt to their contents.
Results:
0.065 msecs to create a QGraphicsTextItem with some text (layouted)
0.036 msecs to set everything up in a QGraphicsTextItem with 0 width
QTextEdit was abusing the width 0 to mean "no wrap, width comes from
contents", but since the value -1 means that already in QTextDocument,
QTextEdit now uses a width of -1 for that meaning.
Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
A class that reimplements a virtual function isn't using the override
keyword, which generates a warning during compilation.
Pick-to: 6.3
Change-Id: Ic39ea24993e031f95ac9e61c3285d3be05fe6c34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
We don't support it any more. I don't think it has ever properly
compiled Qt 6 (and it's no longer working for me against GCC 12's
libstdc++ headers). If you report a bug against it, Intel support's
first question is if you can try instead the new Clang/LLVM-based oneAPI
C++ compiler.
So we support only that one, which identifies itself as Q_CC_CLANG.
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Remove a processEvents() call followed by a QCOMPARE and turn it
into a QTRY_COMPARE. Otherwise it seems to be randomly failing on Ubuntu
22.04.
Change-Id: I3c1b9d55c857c79ffd36aeb98971db60267adace
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Problem: if you create a hybrid Widgets and Quick Controls
application, you would need to use QApplication rather than
QGuiApplication. But in that case, the QQuickWindows would
never receive window activation events from QApplication.
And this causes problems for controls, since, for example,
the palettes in use there will never update upon activation
changes, and instead sometimes get stuck as e.g QPalette::Inactive
after application startup.
This patch will make sure that we send out activation events
also for QWindows that are not QWidgetWindows.
Pick-to: 6.3 6.2
Change-Id: I649f5c653081c0c5249f4faf28a7de2c92f17421
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Check DockWidgetArea permissions of QDockWidgetGroupWindows with single
dock widget. Obtain a dock widget's tab position from a dock widget
group window if it can't be established otherwise. Remove hardcoded
assumption that a dock widget is in the left dock. Both cases have lead
to inconsistent entries and dangling pointers in
QDockAreaLayoutInfo::item_list.
Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds
value '0', which becomes obsolete by the fix.
Create a QDockWidgetGroup window prepered to become a floating tab,
whenever a dock widget is being hovered over. Store it in item_list so
it can be found and deleted when required.
No longer call e->ignore() after propagating close events to the first
dock widget and thus preventing others from receiving the event.
Add logging category qt.widgets.dockwidgets
Update dock widget autotest with tests to check the fixes mentioned:
plugging, unplugging, hiding, showing, closing and deleting.
Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android
due to flaky isFloating() response after a dock widget has been closed
or plugged.
QSKIP dockPermissions and floatingTabs test on Windows due to mouse
simulation malfunction.
QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059)
Fixes: QTBUG-99136
Pick-to: 6.3 6.2
Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
tst_qmessagebox was disabled because it crashed.
It does not any more. Now it hangs, which
is a new problem.
Fixes: QTBUG-87671
Task-number: QTBUG-101217
Pick-to: 6.2 6.3
Change-Id: Iec15cf82a4112ee79182ec091622e40147bd3e7f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This reverts commit b39d3cfe30.
Reason for revert: the test fails in dev again
Task-number: QTBUG-87404
Change-Id: Icc51e36e037e9c7e8154266def129dd8ad412775
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
To allow other cases to run while finding the reason. Most of these
cases fail only on CI and not locally.
Pick-to: 6.3 6.2
Task-number: QTBUG-102043
Change-Id: Ib552ab00b4232f6aabdf85acf050633251d9e71d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Skip the crashing case temporarily to allow other tests to run
while finding a fix.
Pick-to: 6.2 6.3
Task-number: QTBUG-100470
Task-number: QTBUG-102043
Change-Id: I8b16f95e5c66b95cc9959494b5317d39d58194e6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Commit a35a7fcb5a introduced the usage
of insets to correctly take into account the default Android status bars
and other reserved regions.
However in practice that does not work as expected - the bottom inset
is always reported to be non-zero, even when fullscreen mode is enabled.
To fix the issue, FLAG_FULLSCREEN is explicitly checked before applying
the insets.
Fixes: QTBUG-99624
Pick-to: 6.3 6.2
Change-Id: I8b25f0b06447cd452c42ef072493e3137e25f38b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Fix some obvious issues, QSKIP or blacklist other problems.
This does not fix all the test failures, but allows to enable most of
the test cases, so that we could catch future regressions.
Task-number: QTBUG-87668
Pick-to: 6.3 6.2
Change-Id: I1ed0b476d4ac55c658c572cfa1379fcdc6137ee8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Now when 71b3d18ea7 is merged,
we can re-enable the previously skipped tests, as they do
not crash anymore.
Task-number: QTBUG-101423
Task-number: QTBUG-101321
Task-number: QTBUG-87417
Pick-to: 6.3 6.2
Change-Id: I6b4b3619b0af5e48b5e92b514bc0ab6586a76d51
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
If the active QWidget gets destroyed, then QWidgetWindow::focusObject
will return nullptr. If then no other object takes focus, then we'd
never emit change signals, and QGuiApplication's _q_updateFocusObject
(which then informs the input context and emits signals) didn't get
called. This left the input context with a dangling focus object
pointer, which resulted in crashes.
If the QWidget clears its focus, but the corresponding window doesn't
know that it had focus, then fall back to the widget's focus widget
to see if we have a change in focus, so that signals get emitted.
Add a test case that shows that we didn't call _q_updateFocusObject
by counting emissions of the QGuiApplication::focusObjectChanged
signal, which we emit in this function. The signal is emitted more
than once both when showing a widget, and now also when destroying
a widget that has a focus child. The former is a previous issue,
the latter is an improvement to not emitting the signal at all.
Pick-to: 6.3 6.2
Fixes: QTBUG-101423
Fixes: QTBUG-101321
Change-Id: Ib96a397211d442f52ce795a3eebd055a0ef51b0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Don't mix unsigned and signed types in comparisons.
Pick-to: 6.3
Change-Id: Ia4ba9c114177425a21cadc8cafe8179928315a5d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
After cbf1b4bc60bca3994b8f8685ee922e53a6b4eed2 the selected item got
deselected on Ctrl+Press, which made Ctrl+dragging a selected item
impossible.
Only deselect on Ctrl+Release. Add scenario to existing test case,
and update the documentation to clarify the properties involved, and
to point out that the event parameter might be nullptr.
Fixes: QTBUG-101647
Pick-to: 6.3 6.2
Change-Id: I749b1cb1a0a311f5c1d4c333984716f05f2c90b5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Enderlein <volker.enderlein@ifm-chemnitz.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Skip some of the obviously failing QCompleter-related tests instead of
blacklisting them.
Skip a test that causes a crash.
This allows to re-enable this test in CMakeLists.txt for Android.
Task-number: QTBUG-87417
Pick-to: 6.3 6.2
Change-Id: Ie7ee708df8ceddf117689e8ac749850ba86e8816
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The test is very flaky on Windows 11. Make sure that we have a secondary
window to close before proceeding, and wait for fade effects to finish,
otherwise we might never get the leave event from the windowing system.
Also replace a QVERIFY(qWaitFor) construct with a simple QTRY_VERIFY.
With these changes, a local run of 20 repeats of this test on a stressed
VM improves from 75% to 100%.
Pick-to: 6.3 6.2
Fixes: QTBUG-98477
Change-Id: Iedcc175b336e3cab23817b954aba1736d02f1b9d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Adapt to changes in QWidget::addAction API from 08e4d2db08.
Pick-to: 6.3
Change-Id: If6e05b47de88cf55070238f08b96586b855cc5c1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This was lost when QtCore, QtGui and QtWidgets were split up. Restored
now via a virtual function on QObjectPrivate.
Chose to return std::string instead of QString or QByteArray because
its SSO is usually sufficient to hold these flag strings.
[ChangeLog][QtCore][QObject] Restored printing of Qt3-style
information from dumpObjectTree().
[ChangeLog][QtWidgets][QWidget] Restored printing of Qt3-style
information from QWidget::dumpObjectTree().
Fixes: QTBUG-101732
Change-Id: I39ff5728ea5f5abbdbf81b5d7e13b8d16b6ee8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Selection change handlers of the items might call a method that
implicitly recreates the selectedItems QSet, which then invalidates
the iterators of the ranged for loop, resulting in crashes.
Iterate over a copy of the set instead.
Add a test case that crashen without the fix.
Fixes: QTBUG-101651
Pick-to: 6.3 6.2
Change-Id: I6da6f4043fe1906b0186931a37283f635cb5a404
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
ClipboardManager didn't have any APIs to clear clipboard data before
API level 28.
As a workaround an empty Intent with MIMETYPE_UNKNOWN is created and
inserted into the clipboard for lower API levels.
This makes the QApplication::clipboard()->clear() method work more or
less as expected.
This allows to unblacklist tst_QPlainTextEdit::copyAvailable().
Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I454376199cf3b8eed0fa2ecf2f85b87f40892280
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The test task191545_dragSelectRows relied on the fact
that the view is not scrolling. But on a small screen,
it scrolls automatically.
Fixes: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: I691361c965ab03d8a012f2b83715c7c96d990ec5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Android 9 introduce an API call to clear the clipboard, before that
it wasn't possible to do that, the test QPlainTextEdit::canPaste()
should expect that to fail.
Pick-to: 6.3 6.2
Task-number: QTBUG-100470
Change-Id: Ie2d8aabf77672c62b3a6c72a080a4e37f1696303
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Amends a74cdf778c, after which the
initialization of items in invisible rows is skipped. Since data members
in QFormLayoutItem were lazily initialized, this resulted in out-of-bounds
access of QList entries.
Use member initialization for all QFormLayoutItem fields, and check that
vLayoutIndex is valid before using it to access the list entry. Skip
labels and fields for which it is not initialized.
Add test case. As a drive-by, silence the test's provoked warning
messages via ignoreMessage.
Change-Id: I374b414a51df20b9af3087a2676061fc6b7f23e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Found when retesting the testcase completer.zip from QTBUG-54642
Pick-to: 6.3 6.2 5.15
Change-Id: Id84eefeb3a33dc6d790cfa23755352381cc097a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And remove their uses.
[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.
Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We want to mark the corresponding QColor ctor(s) explicit.
Use Qt::GlobalColor or the new QColor::fromString() instead.
Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QComboBox is included because it works like a button when it is not
editable. QGroupBox is included because it has a checkbox and QCheckBox
is a subclass of QAbstractButton.
Change-Id: Iad89259314e77f78c915dce83ec601df94c88941
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Qt Creator crashes when max is INT_MAX and min is -1, see bugreport.
Change-Id: I441e76c0ff87052083ed3d77e6085b186402e5d8
Fixes: QTBUG-101581
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Without this change, the test fails when run twice in a row. Also, skip
the test if we can't move the cursor.
Pick-to: 6.3
Change-Id: Ic45c073007d114fbd7825cedef6761c1e410b4af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The test crashed for some reason, so other testcases are also not
executed. Skip the test for now to enable more tests in the CI
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I5ad38645d1b8f86c64da7208c0ae4f66d126c7d9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Most of the blacklisted tests were already fixed earlier.
The tst_QPlainTextEdit::adjustScrollbars() test needed a small fix
to show the window non-fullscreen, so that the scrollbar could appear.
Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3
Change-Id: I849f411a5798053742323fc4db3fe30f2b690a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This test crashed and prevents other testcases from execution.
The test requires a proper fix, but that's not trivial, so skipping
to enable more tests in the CI for now.
Task-number: QTBUG-101321
Pick-to: 6.3 6.2
Change-Id: I1bd4b1182cc868a36391a718457eae647675fc17
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
This test uses the cursor. However we have no cursor support on Android.
Skip the test instead of blacklisting it, because that is the correct
behavior.
Fixes: QTBUG-87389
Pick-to: 6.3 6.2
Change-Id: I1a2d2dd406b3d7da1bc70b51c2072a83d9a29ca5
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
tst_qmenu was disabled because it crashed.
It does not any more.
Task-number: QTBUG-87671
Task-number: QTBUG-87424
Pick-to: 6.2 6.3
Change-Id: I1a3a1d2861b5a8f20d83fd8ba38fdcb3c88faee9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_qfiledialog was disabled because it crashed. It does not any more.
Task-number: QTBUG-87671
Task-number: QTBUG-101194
Pick-to: 6.2 6.3
Change-Id: Icfda2cd01677f3a076b74429fcf66a1de79d2aa9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When we create a QPixmap using QWidget::grab(), a default system
image format is used for that.
On Android this format is ARGB32_Premultiplied, while on the desktop
systems it is RGB32.
The images that are saved in the resources and used as references, also
have the RGB32 format.
As a result, on Android we need to convert the pixmap to a proper format
before comparing it to the reference.
Fixes: QTBUG-69064
Pick-to: 6.3 6.2
Change-Id: I2d881e508d34e0b1a2a1a7bffcbc71ae2907d31d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
QHeaderView creates persistent indexes in
_q_sectionsAboutToBeChanged(), called by the slot connected to
rowsAboutToBeMoved/columnsAboutToBeMoved.
In the case of rows, QAbstractItemModel emits the signal *before*
preparing to update persistent indexes in itemsAboutToBeMoved(),
so it can see the ones newly created by QHeaderView, all is well.
In the case of columns, the emit was done *after* calling
itemsAboutToBeMoved(), so the additional persistent indexes created by
QHeaderView were ignored, and in endMoveRows() we could end up with:
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex: "persistent model indexes corrupted"
This bug has been there since the very beginning of beginMoveColumns(),
but was undetected because moving columns in a model is pretty rare
(in my case there's a QTransposeProxyModel that turns columns into
rows in the underlying model, and a proxy that handles dropMimeData...)
Pick-to: 6.3 6.2 5.15
Change-Id: I74bad137594019a04c2a19c2abb351ff3065c25a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The content of the window was intended to trigger wrapping.
On Android, the window is larger, so more content is
necessary. This patch adds more content.
Fixes: QTBUG-87401
Pick-to: 6.2 6.3
Change-Id: I33a2fe4560c358f2b0b83523ee4ab26bb5dd2513
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Hiding a row in a form layout is inconvenient to do as access to the
widgets in each row is cumbersome. In addition, a row might include a
layout for the label or the field column, and we can't hide layouts and
instead need to navigate to the widgets inside the layout. And even if
an application developer does all that, the spacing calculation doesn't
ignore hidden rows.
Add setRowVisible and isRowVisible APIs with the usual overloads.
Implement the logic to traverse a layout item to its contained widgets,
so that they are explicitly hidden when a row is hidden, and skip hidden
rows in the spacing calculation.
[ChangeLog][Widgets][QFormLayout] New APIs setRowVisible and isRowVisible
to hide and show rows in a form layout.
Fixes: QTBUG-6864
Change-Id: I6af98409802f331c4523e91d7dac8a97762c579d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_qgraphicsview was disabled because it crashed.
It does not any more.
Task-number: QTBUG-87671
Task-number: QTBUG-87397
Pick-to: 6.2 6.3
Change-Id: Ib604274d098c271e22b010e6cb822fdf9553df1c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
There was a test for Qt4 compatibility in tst_qheaderview.
We don't run it since Qt 6.
This patch removes the unused code.
Change-Id: I751829ac5a142e79379e81e9e739107544cf7406
Reviewed-by: Arnaud Bienner <arnaud.bienner@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
The view.resize() command has no effect if the requested
size is smaller than the screen. So the view has space for
the whole model. It then won't scroll, so scrolling cannot
be tested.
This patch enlarges the model so that scrolling is always
necessary and thus possible.
Task-number: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: Ibff512158d9c16be120a69c7328b6d0ae2c3b551
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Some tests were blacklisted, but the problems cannot be reproduced
any more. This patch activates them.
Fixes: QTBUG-87404
Pick-to: 6.2 6.3
Change-Id: I5944c750a5717daaf43a22d6d1fa51ae54fc3da2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_qopenglwidget was disabled because it crashed.
It does not any more.
Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: I7ea55f262f362c098b52e1b1a319b26c31a7e067
Reviewed-by: Pekka Gehör <pekka.gehor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Port the test to use the QWindow* based overloads of QTest::mouseMove()
and move the cursor away.
Pick-to: 6.3
Task-number: QTBUG-98489
Change-Id: Id1ac0ef176c6f9bf179f989ddd5775877525fc0d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Tests are run for QNX in qemu similar to b2qt currently (using offscreen
plugin and software rendering). So the issue is same.
Pick-to: 6.2 6.3
Task-number: QTBUG-100930
Change-Id: Ie973c6c611ac48703fd7cce53925940b80858bc8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Scroll tests relied on having a small window. On Android, the
window can not be smaller than the screen.
This patch changes the tests so that the windows have large
enough content so scrolling can happen.
Fixes: QTBUG-87408
Pick-to: 6.2 6.3
Change-Id: I26a444518fd934527089297c594673937f0ecf88
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_qabstractitemview requires a movable cursor.
This patch skips the test if there is no movable cursor.
Pick-to: 6.2 6.3
Fixes: QTBUG-87400
Change-Id: I4e917b2ad062ce068f23603410aa9209edb9828d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
If adding a QLineEdit to a QGraphicsScene as a QGraphicsProxyWidget, the popup
completion of that QLineEdit is drawn in the wrong location. When the completer
getting the rect of screen, it gets the rect of the QGraphicsScene where
QLineEdit is located rather than the rect of the screen, resulting in an error
in the following calculation.
Note that as long as the completer popup is a toplevel widget not parented
to the target widget, it will not be automatically embedded into the graphics
view via QGraphicsProxyWidget. So with multiple views for a scene, or in views
that use transformations, the geometry will still be off.
Pick-to: 6.3
Task-number: QTBUG-20531
Change-Id: If5d8a707ca35a9e4709117b077978145c6143e46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Even QtCore alone cannot be built without the properties feature since
Qt 5.5. While fixing this is easy, other modules like dbus,
networking are also using QObject::property() and friends liberally.
All in all I doubt that anybody will miss the feature (otherwise it
would have been fixed in the last decade).
Change-Id: Iaf3cc20bda54ee2ff3b809fac8fa82b94ecc88c0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove Integrity and Android specific code that explicitly adds
test data to the resource files. qt_internal_add_test functions
implicitly adds test data to resources for Android and Integrity
platforms by default.
Change-Id: Ia1d58755b47442e1953462e38606f70fec262368
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Multiple tests use qt_internal_add_resource that copies the
functionality that is already implemented inside the
qt_internal_add_test function. Simplify these test by replacing
the qt_internal_add_resource call with the new BUILTIN_TESTDATA
option.
Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Size a QMdiSubWindow is no real toplevel widget, QLayout::activate() did
not properly set the minimum size based on it's children. Fix this by
treating a QMdiSubWindow as a toplevel widget during the calculation.
Fixes: QTBUG-100494
Change-Id: Ia2e6c519c7214c36383facd244711bd932231d40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If one calls setPlainText("") before setting a placeholder text,
the placeholder visibility is not updated, and the placeholder is not
visible. Fix it by updating placeholderVisible properly.
Fixes: QTBUG-96212
Pick-to: 5.15 6.2 6.3
Change-Id: I1bd3f0cb4c59973a847bcf3787e35d7c17b6d673
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Unless "." (or the empty string) is in $PATH, we're not supposed to find
executables in the current directory. This is how the Unix shells behave
and we match their behavior. It's also the behavior Qt had prior to 5.9
(commit 28666d167a). On Windows, searching
the current directory is the norm, so we keep that behavior.
This commit does not add an explicit check for an empty return from
QStandardPaths::findExecutable(). Instead, we allow that empty string to
go all the way to execve(2), which will fail with ENOENT. We could catch
it early, before fork(2), but why add code for the error case?
See https://kde.org/info/security/advisory-20220131-1.txt
[ChangeLog][Important Behavior Changes] When passed a simple program
name with no slashes, QProcess on Unix systems will now only search the
current directory if "." is one of the entries in the PATH environment
variable. This bug fix restores the behavior QProcess had before Qt 5.9.
If launching an executable in the directory set by setWorkingDirectory()
or inherited from the parent is intended, pass a program name starting
with "./". For more information and best practices about finding an
executable, see QProcess' documentation.
Pick-to: 5.15 6.2 6.3
Change-Id: I54f205f6b7314351b078fffd16cf7013c97ee9fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends d42cfeb84f, which would result in
infinite recursion when the Edit menu was populated and added to the
menubar after the menubar has been shown.
Add a macOS-only test case that reproduces the crash without the fix.
Fixes: QTBUG-100441
Pick-to: 6.3
Change-Id: I018a7aa7f01558a3b9732b4d6d96a911dc7fbd19
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The auto-repeat timer of QScrollBar kicks in after 50ms, so if the test
takes too long and the timer fires during the qWait call or during event
delivery, then we might get multiple valueChanged emissions.
Detect that scenario and allow the test to XFAIL if things take
a significant time (more than 40ms vs the expected 1ms).
Pick-to: 6.3 6.2
Change-Id: Ie90aadc62372397db695fd2b34fe1f5252ce8d37
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
As with QHoverEvent, it's better to require globalPos rather than
"initialized to QCursor::pos(), which may not be appropriate" as the
docs have pointed out for many years now. This removes the remaining
calls to QCursor::pos() in event constructors.
Task-number: QTBUG-52430
Task-number: QTBUG-69433
Task-number: QTBUG-100324
Change-Id: I076dae56f37abaad7085cc95dddee453a80a45f3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The QSinglePointEvent ctor assumes that the given globalPos is correct,
so it was wrong that the QHoverEvent ctor passed along a local position
as global. It's better to require globalPos as an argument; and in fact
it seems that everywhere we construct a QHoverEvent, global position is
available, or possible to get by transformation (which is better than
resorting to QCursor::pos()).
Also, don't convert to QPoint: pointer events have qreal resolution and
there's no reason to truncate them.
Fixes: QTBUG-100324
Change-Id: I919455da36265988d3d149eb97563c9ed0d2c660
Pick-to: 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends e3b2b12a91, which made the
style sheet calculate the font-dependent text size, but didn't
add the space needed for the close button or a tab icon.
QTabBar's layout code already adds the space needed for icons
and margins to the size; so instead of overwriting that size,
subtract the size needed by the normal font, and then add the
size needed for the font form the style rule, considering both
vertical and horizontal tab bars.
Fix the test case to style only one tab rather than the entire
tab bar, otherwise the font is applied to the entire tab bar,
and not just to a specific tab, which is the style sheet style
code in question.
Pick-to: 6.2 6.3
Task-number: QTBUG-6905
Change-Id: Ieed0ba146a32e81229419adecaf41f467cfd5959
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The animateClick method is a QAbstractButton member, and neither
QCommandLinkButton nor QPushButton override it. The method is tested in
the QAbstractButton test, and 3a9b7d1f18648d7236664d3adfc65c009b01e668
made that test more robust. The previous, flaky version of the test was
almost duplicated here. They add no additional code coverage, so remove
them.
Pick-to: 6.2 6.3
Change-Id: I1fa988c1eabd5054193acb1f5fa1c81d29b3878d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The test is timing sensitive; if it takes more than 100ms
to process events, then the timer that clicks the button might
have fired. So only verify that the button is still down if 100ms have
not yet passed, and verify that at least 100ms have passed when the
click is complete.
Also use QSignalSpy to test the signal emissions.
Pick-to: 6.2 6.3
Change-Id: I95f99e204a17c6709f8e2913eefe4b487e949123
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The current behavior for handling the angle delta of a wheel event
changes index the instant there is a change in angle delta. This works
fine for mouse wheels that send events with 120 angle delta units and
there is also already behavior defined for devices with pixel deltas,
but there is nothing good for handling events from high resolution mouse
wheels that don't have pixel deltas.
This patch makes it so that the current index doesn't change until the
accumulated angle delta for the X or Y axis reaches 120.
[ChangeLog][QtWidgets][QTabBar] Scrolling with a high resolution mouse
wheel changes the current index at a rate more like a normal mouse
wheel.
Task-number: QTBUG-97844
Pick-to: 6.3
Change-Id: I2e7fd88984a253f6ef8a0008deb7233e4cb4d84a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Get rid of the function-static main window, which would be destroyed
after QApplication if the test is run with a subset of test row (that
does not include the TestEnd state test).
Make the MainWindow a class member of the test class instead, and rename
it from "mainW" to "mainWindow" to avoid shadowing by "mainW" widgets in
other test functions.
Amends 55928821d1.
Task-number: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I83efce5b54afc3a0027a7c0e63efee6a235af585
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
In Qt 5 style sheets, objects could be selected by an enum-type property
using the integer value of the enum value, e.g
QToolButton[popupMode="1"] { ... }
In Qt 6, the the new meta type system and QVariant implementation enabled
QVariant::toString to return the string representation of the enum value
instead for a property containing an enum. Since QStyleSheetStyle's
attribute matching is string based, this breaks the Qt 5 style selector,
and QCSS code instead needs to use e.g.
QToolButton[popupMode=MenuButtonPopup] { ... }
While the new syntax is arguably preferable, this is an unintentional
change that silently breaks style sheet code (no error or warning at
compile- or run-time).
To support Qt 5-style selectors, we have to change the StyleSelector
interface of the QCssParser API so that we can pass through what type
of value the attribute extractor should return; if an integer string "1"
is provided, then we need to compare the enum integer value; if the
string provided does not represent a number, then we need to compare the
name of the enum value.
Since the pure virtual attribute() method that needs to be implemented
to extract the attribute value of the node is implemented in modules
outside qtbase, add a second virtual method that takes the entire
QCss::AttributeSelector, which includes the value to match. Extractor
implementations can use it to evaluate which type of data to return for
an exact match. The default implementation calls the old attribute()
method so that existing StyleSelector implementations continue to work.
Make the respective change in the QStyleSheetStyleSelector, and simplify
the surrounding code. Adjust other StyleSelector implemnentations in
qtbase. As a drive-by, remove the superfluous virtual declaration from
those overrides.
Once submodules are adjusted to override this virtual function instead
of the (now no longer pure) virtual attribute() method, that method can
be removed.
Pick-to: 6.3 6.2
Fixes: QTBUG-99642
Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This code didn't actually use QMutableEventPoint::from(), so didn't
run into the UB that from() depended on, but it's in the way of making
QMutableEventPoint a befriendable namespace instead of a public
subclass of QEventPoint.
Replaced the QMutableEventPoint ctor that takes a timestamp, and
therefore isn't compatible with the ctors on QEventPoint, with a
static function that returns QEventPoint instead.
Port QList initialization to braced-initialization as a drive-by.
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
In Qt 5, such selectors have to use the integer value of the enum
value. Using the enum value name does not work.
In Qt 6, such selectors must use the enum value by name, using
the integer does not work.
It's not clear yet what changed, possible a side effect of the
changes and improvements in the meta object system and QVariant in
Qt 6. So for now, document the difference in behavior in a test.
Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99642
Change-Id: I96e0280b191b8ca06b16a97ab3ed367e9a8f43a0
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The header no longer uses QMutableEventPoint.
Fix TUs that relied on the transitive include.
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The test uses a static MainWindow so that we can execute a series of key
simulations on the same window. The window is then destroyed when we
reach the final test row.
If some of the tests fail, then the window is left in an unknown state,
resulting in cascading failures for the other tests. Fix this by always
trying to show and activate the window, and always destroying the static
window if we have reached the last test data row.
Fixes: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I466669f387e8b199e9e719a7ebbe3ae670658b7e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The CALayer backingstore never had a scroll implementation because we
were relying on the QRasterBackingStore implementation, but as it turned
out that implementation was not applicable for the CALayer backingstore.
We now implement scroll() by determining which part of the back buffer
can be scrolled directly in-place, and then scrolling the rest by
copying from the front buffer. We have to handle both cases, as clients
may scroll multiple times before flushing, and the scrolled area may
overlap both valid back-buffer content and content that needs to be
pulled from the front-buffer.
Pick-to: 6.3 6.2
Change-Id: Icc09c9488386925116779c9024669a4329b38247
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Add test to verify that allowing wordWrap actually breaks long lines.
Pick-to: 6.3
Change-Id: I09bd2d754e86ebf35db551ee76f7f037371acec9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove unused column in test data and unused local variables.
Pick-to: 6.3
Change-Id: Ia012fe8240cf9831c1053b76ae31216145d61732
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QWidget and QWindow use bits in QObjectPrivate to provide for a couple
of shortcuts -- one in qobject_cast, and another in the isWidgetType() /
isWindowType() functions in QObject. These can be optimized by simply
looking at the bits, without actually doing more expensive runtime
casts.
These bits were set on construction, but not unset on destruction. The
result was for instance that destroying a QWidget would report that the
object was still a QWidget when ~QObject was reached.
Fix this
1) by setting the bits only when QWidget / QWindow constructors start;
2) by resetting the bits once ~QWidget / ~QWindow are completed.
Technically speaking this is not 100% correct in the presence of data
members, but luckily those classes don't have any.
Amend an existing test for QWidget (whose comment said exactly the
opposite of what the test actually did) and add a test for QWindow.
Some other code was wrongly relying on isWidgetType() returning true
for destroyed QWidgets; amend it as needed.
[ChangeLog][QtCore][QObject] Using qobject_cast on partially constructed
or destroyed QWidget/QWindow instances now yields correct results.
Similarly, using the convenience isWidgetType() / isWindowType()
functions now correctly return false on such instances. Before,
qobject_cast (and the convenience functions) would erroneously report
that a given object was a QWidget (resp. QWindow) even during that
object's construction (before QObject's constructor had completed) or
destruction (after QWidget's (resp. QWindow's) destructors had been
completed). This was semantically wrong and inconsistent with other ways
of gathering runtime type information regarding such an object (e.g.
dynamic_cast, obj->metaObject()->className() and so on).
Pick-to: 6.3
Change-Id: Ic45a887951755a9d1a3b838590f1e9f2c4ae6e92
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The test waits a bit hoping that all paint events are delivered after
showing the widget so that we can count the rectangles that are getting
updated when scrolling.
Waiting for 20ms is too short unless the system is completely idle.
Based on testing on a local VM, 150ms produces reliable results.
Pick-to: 6.2 6.3
Change-Id: I7729e94eae41476be67291a2f664cff784f96c7d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
After 7369c31ca1f446e81eda1c93ba13767ffcd83efe, unaccepted touch points
were not grabbed anymore in calls to activateImplicitTouchGrab. However,
gesture recognition relies that widgets for which a gesture has been
partially recognized grab also unaccepted touch points.
Add a parameter to allow the implicit grabbing to take place also for
unaccepted event points.
Add test case that replays touch events similar to what Squish is doing,
and fails without this fix.
Pick-to: 6.2
Change-Id: Idb0b20301b1827be57a03013a59043d97c2ee7b6
Reviewed-by: Stefan Gehn <stefan.gehn@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Expose QWidgetRepaintManager's data structures so that we can write
unit tests, and verify that they are correct after moving opaque
widgets (which triggers the accelerated move code path).
Improve the compareWidget logic to not rely on screen grabbing
(which requires permissions), but instead use QPlatformBackingStore's
toImage function, which is faster and more reliable, and also doesn't
require us to show the UI we want to grab full screen in order to
avoid issues with overlapping windows etc.
Change-Id: Iff2ea419f03a390ab6baca26814fef6ff45f7470
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
On some platforms, such as X11 and Wayland with some compositors,
QMenu could be a popup window, which should be set a transient parent
to get relative position, which is requested by Wayland.
Added transientParentWindow() for QMenuPrivate like QDialogPrivate.
Fixes: QTBUG-68636
Pick-to: 6.2
Change-Id: I6d8880cb008ecf61a4c005898b38e3953379a13d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Added to QWidgetRepaintManager test case, which is the only place where
the function is used.
Includes a helper that creates a complex scene with opaque children,
which will be used in additional unit tests.
Change-Id: I0e0188dd560923a552a8967d8e992dc17cc849d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When you are editing in a QTextEdit and press enter to start a new line,
calling insertBlock() with no arguments tries to preserve the current
charFormat and blockFormat. That is often OK:
- if you hit enter at the end of a list item, you probably want another
item in the same list
- if you are writing code inside a code block, you're probably just
writing the next statement on the next line: stay in the same block
- margins, indents, tab positions should stay the same (but hopefully
your editor has UI to manually reset the block format to default
in case you are not continuing in the same style)
But there are some exceptions we can apply to be helpful:
- nobody ever wants to follow an <hr/> with another one (but
hopefully the application has an action to insert one manually)
- a heading is more likely to be followed by a paragraph, or perhaps
a smaller heading; another heading at the same level is unlikely.
We need to reset the char format, not only the block format, because
the large font and heavy font weight are stored there.
- when adding to a todo list, hitting enter at the end of the last task,
let's assume the next task is not yet done, so it will be unchecked
by default (else, why are you writing a todo list at all)
To achieve that, we need to customize the formats and call the
insertBlock() overload that takes them. The no-argument insertBlock()
will continue to preserve the formats, because it's an old API that is
used for much more than interactive editing.
Additionally, word processors tend to let you end a list (for example)
by hitting enter twice. In that case, you stay in the same paragraph
that you created the first time you hit enter, but now the formats are
reset to default, so that you can go on typing an ordinary paragraph,
rather than having to mouse up to the toolbar to select the paragraph
style in a combobox, or something like that. So we now do that: reset
both block and char formats after you hit enter on a blank line; but if
you then hit enter again, after the block format has been reset, then
you will get the actual blank line (empty block) inserted.
[ChangeLog][QtWidgets][QTextEdit] Hitting enter at the end of a line
with a special block format (horizontal rule, heading, checklist item)
now makes some "smart" adjustments to avoid retaining properties that
are unlikely to be continued on the next line. Hitting enter twice now
resets block and char formats to default.
Fixes: QTBUG-48815
Task-number: QTBUG-80473
Fixes: QTBUG-97459
Change-Id: I3dfdd5b4c0d9ffb4673acc861cb7b5c22291df25
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
We need to check whether the horizontal header's selection includes the
index for the row at the top, rather than for row 0, as the index we
check is based on the scrolled position of the header, so would never be
included in the top row when the view is scrolled. This is correctly
done in selectRow already.
Add a test case that simulates selection of rows and columns by clicking
on the header.
Fixes: QTBUG-98444
Pick-to: 6.2
Change-Id: I2fa1b32bf75dc96225b40145b713bf7e2ffc29dd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The first sub window added will activate itself automatically, and
isActive is set to true. Therefore the call to setActiveSubWindow to
activate the first sub window will be ignored.
When showing the mdiarea, all sub windows will be activated in the order
in which they were added, so the active window will always be the last
sub window added.
Fix this by setting isActive to false so that setActiveSubWindow
activates the first sub window when the mdiarea becomes active.
Fixes: QTBUG-92037
Pick-to: 6.2
Change-Id: Id4a793e2059803c1a4ada916fdae2d3cc02cdf06
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We have some special handling in qt_windows.h,
use it instead of the original windows.h
Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Don't crash if the font does not have any families set.
Pick-to: 6.2
Task-number: QTBUG-97995
Change-Id: I8dc2f2fc00309b6fff6d4a661ec6d659f30808af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
If QFontComboBox is instantiated in the form of new and call
QFontDatabase::addApplicationFont, QFontComboBoxPrivate::_q_updateModel()
will be called when the program exits, at this time qApp will crash.
Fix this by when program exiting, QFontComboBoxPrivate don't need
call _q_updateModel().
Fixes: QTBUG-98099
Done-With: Konstantin Ritt <ritt.ks@gmail.com>
Pick-to: 5.15 6.2
Change-Id: I3df3d19c3d1971288d60f2eef386262befbf396b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
In paintAndFlush, QWidgetRepaintManager subtracts opaque children if
the target isn't overlapped and isMoved is set to true. So in moveRect,
set isMoved to true after the blitting of movable areas, and reset it to
false if we have overlapped sibling or child regions. Otherwise, moving
so far that sourceRect is invalid (none of the original pixels are
visible after the move) we end up in a code path that sets isMoved to
true even with overlapping children or siblings, which then breaks
paintAndFlush's assumptions.
Reuse the test case written by Sergiy Korobov <tiamatenko@gmail.com> in
earlier attempts to fix this bug.
Fixes: QTBUG-26269
Pick-to: 6.2
Change-Id: If7443863f5eee79a80220cd587522122f42a21e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
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.
Pick-to: 6.2
Fixes: QTBUG-98247
Change-Id: Iff1dbd24fa7ca09098fe49c179770356c966251d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QTabBar implements wheelEvent to move the current index up or down. This
is useful for clicky mouse wheels, but a bad user experience when using
a kinetic wheel or touch pad, as every pixel movement will change the
current index.
Instead, scroll the entire tab bar when the wheel event comes from a
device that supports scroll phases, without changing the current index.
As drive-by's, fix the test introduced in aa09bea00c to
not leak memory or leave a test-specific style set on the QApplication
instance, which can break other tests.
Also, make relevant layout code in QTabBar respect the usesScrollButtons
property, const'ify local variables, and return an accepted QWheelEvent
if the event resulted in a change.
[ChangeLog][QtWidgets][QTabBar] Scrolling with a kinetic wheel or touch
pad scrolls the entire tab bar, without changing the current index.
Change-Id: I990e51466dd25c741877bbf0e197449f897a9efb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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.
Pick-to: 6.2
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>
Check that a file name, not the full path, contains a dot.
Fixes: QTBUG-59401
Pick-to: 5.15 6.2
Change-Id: I193b2ae457a3ac6a460524dbf200786eb3461cef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
After special processing for hover, QPushButton::mouseMoveEvent()
needs to call the base class function, like every virtual override
should, to continue processing other logic. Amends
3310e13a17
Fixes: QTBUG-97937
Pick-to: 6.0 6.2
Change-Id: Ic2e111d6c38371e0aa04423f5fb26c52717bf5fb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Relying on QCursor::pos makes tests fragile and prevents multi-seat support.
Instead, record the mouse position in the already existing event handling,
and use that instead. Styles might use either WA_Hover or enable mouse
tracking for the widget to enable hover-effects, so we need to support both.
Fix the scenario where a newly inserted tab ends up under the mouse, which
was previously not handled correctly (only the case of removing a tab was).
Clean up the repaint management when the hovered tab changes; just call
update on the old rect, and then later update on the new rect; there's no
need to make a copy first, updates are posted and compressed.
Add a unit test that makes sure that we paint tabs that should be under the
mouse in the hovered state. Since not all styles enable hovering and/or
mouse tracking in all cases, use a style sheet for those styles that don't.
Change-Id: I7cdbb18e9e04b52651e273680fec87b50cb81e05
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>
Amends 17c1ebf8bf, 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
Pick-to: 6.2 5.15
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>
Otherwise, the button state maintained by Qt when using the offscreen
plugin is not reset, breaking following tests.
Pick-to: 6.2
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>
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.
Pick-to: 6.2
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>
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.
Pick-to: 6.2 5.15
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>
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
Pick-to: 6.2
Change-Id: I110444d18938c2b3446ee58e4a8c6c472b5f12c3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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.
Pick-to: 6.2
Fixes: QTBUG-25743
Change-Id: I48735e17352989bbc84a72263e4828f519b78095
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Some item views, such as QListView in icon mode, implement a selection
rectangle with which the user can "lasso" items. So far, dragging that
rectangle did not trigger auto scroll, so unless an item near the edge
was selected, the user had to stop the lassoing and scroll manually to
reach more items.
Since QAbtractItemView implements auto scrolling for drag'n'drop, we can
use that mechanism also when the selection rectangle is dragged. This
requires some modifications:
We need to make sure that scrolling the view during a drag-selection
generates mouse move events so that the selection is extended and the
rectangle is updated in subclasses.
And we need to stop using QCursor::pos to get the position of the mouse
pointer, as this makes the auto-scrolling untestable. Instead, record
the mouse position last seen during a mouseMove or dragMoveEvent in
content-coordinates (identical to pressedPosition).
As a drive-by, fix some coding-style issues in nearby code.
Done-with: Zhang Hao <zhanghao@uniontech.com>
Fixes: QTBUG-96124
Change-Id: I426f786e5842ae9f9fb04e9d34dc6d3379a6207f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Instead of plumbing QWidgetWindow close events via handleCloseEvent,
we just implement closeEvent directly. This allows QWindow do save
the state of the window/widget before the close event, so that we
know whether we should trigger lastWindowClosed handling, even if
the window was deleted as a result of the close event.
This also relieves QGuiApplication and QApplication from dealing
with the close logic in their notify functions, so that these
functions can focus on the propagation of events -- not how the
event is handled.
Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends 32edae5e26, which introduced a
timeout after which the restored state is discarded. If this timeout
hits during a CI run, then the test is expected to
fail.
Implement a lambda that watches for the restored state to disappear.
This happens primarily when restoring a fullscreen state, where some
desktop environments scroll in a new virtual desktop. It should not
happen for other data tags.
Change-Id: I5ff43a4e1857eca17a5d4fe2b47add1f70636e8d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
On systems that asynchronously resize the window to maximized or full
screen state, the window will become visible in its normal geometry
before it gets the final size by the windowing system. This might cause
multiple resize events, to each of which the widget's layout responds
with a call to its setGeometry implementation.
The QMainWindowLayout is special in that it will shrink dock widgets if
there is not enough space for them, but it doesn't grow them back once
there is. With the initial resize event being for a smaller size than
what was restored, the state is not restored correctly, but remains in
the state that fit into the smallest size with which setGeometry got
called.
To fix this, we have to keep the restored state around until the window
either gets a size that is large enough for it to fit, or until we can
be reasonably certain that the windowing system is done resizing the
window while transitioning it to the maximized or full screen state.
Since across the various platforms and windowing systems there is no
reliable way to know when the window reaches its final size, we have
to use a timer that we (re)start for each call to setGeometry with a
size that's not large enough. Once the timer times out, we have to
give up; then the last layout state calculated is the final state.
To calculate the size of the layout, introduce a function to the
QDockAreaLayout that returns the size required for the current sizes
of the docks. Refactor sizeHint and minimumSize (which were identical)
into a helper template that takes member-function pointers to call the
respective method from the dock area layout's content items.
Add a test case for various permutations of the scenario. The timeout
of 150ms is based on running this test case repeatedly on various
desktop platforms and X11 window managers.
Fixes: QTBUG-46620
Change-Id: I489675c2c40d3308ac8194aeb4267172b2fb38be
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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>
Pick-to: 6.2
Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
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.
Pick-to: 6.2
Change-Id: Ieb85e9a6109ae34fe20d79e3c12f4517f827a590
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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
Pick-to: 6.2
Change-Id: Ied342eced3340aaf19b5443762935b1a5fc5c27b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The signal is emitted from QGuiApplication these days.
Pick-to: 6.2
Change-Id: I7423cd4808e8df86960f225fd6e4a12a1a4f11f3
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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
Pick-to: 5.15 6.2
Change-Id: Idf650c91e5a9cffa996e23e743939243b1d4fcc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The test passes, the functionality is implemented in QCocoaWindow.
Task-number: QTBUG-8857
Pick-to: 6.2
Change-Id: I2f4b3a39cec1aaaf4351753b590f35e280503461
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
- 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
Pick-to: 6.2
Fixes: QTBUG-255
Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.
Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The skip-reason only cites Qt/X11. Convert the #ifdef into a platform
name check instead. The test also fails with the offscreen plugin, so
skip it for that as well.
Pick-to: 6.2
Change-Id: I49607b89f4b32359e81e1d9aadff2c3e03035c53
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QDialog overrides setVisible to set focus on the default push button, or
(if there is no such button), make the first autoDefault push button the
default button. QDialog also explicitly sends a FocusIn event to the
focus widget in the dialog.
All this should not be done if the dialog does not become active after
getting shown, which will be prevented if the WA_ShowWithoutActivating
attribute is set.
Add a test case.
Fixes: QTBUG-8857
Pick-to: 6.2
Change-Id: If47021a4721a280ba45e95b43d0424cdacd9b4ea
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
For a widget that implements height-for-width, the vertical scrollbar
becoming visible might be just enough to make the scrollbar unnecessary.
In that situation, the scrollbar flips on and off continuously.
To avoid that situation, make the width of the widget smaller until the
height fits without scrollbar, up to the point where we have space for
the scrollbar anyway.
The calcuation here is assumed to be cheap, but depends on the
heightForWidth implementation in the widget. Running the while-loop a
few dozen times should have no performance impact during resizing
and laying out the scroll area contents.
Add a test that confirms that within a brief period of time we only get
the one hide-event we expect.
Done-with: Zou Ya <zouya@uniontech.com>
Fixes: QTBUG-92958
Pick-to: 6.2 5.15
Change-Id: I0faeb5f9b1a226aada958c18333d9c2ac8203dd1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
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
Pick-to: 6.2
Change-Id: I945e2093a90a1fccbba86d32b1113f83fedd41de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.
This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.
[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.
Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.
However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.
This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.
Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Closing a window with a native child results in the native child's
QWidgetWindow being closed. That explicitly calls setVisible(false)
on the child, which will still have the ExplicitShowHide attribute
set from the initial (explicit) show. Even though we then reset
the ExplicitShowHide, the WState_Hidden attribute will still be
set, so Qt considers the window to have been hidden, and not show
it again when the parent becomes visible.
Add a test case.
Fixes: QTBUG-96286
Fixes: QTBUG-79012
Fixes: QTBUG-71519
Change-Id: I482e6d5236c959d82ce66798176b259a3176972c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
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>
Item views can open an editor widget on the first key press, and need to
take special care not to break input methods. The initial key press
starts compositing by the system input method, which is then interrupted
by the focus transfer to the editor.
To solve this problem, the widget needs to keep focus while the initial
composition is ongoing, and only transfer focus to the editor once the
composition is either accepted or cancelled by the user. Add a state flag
that is set during this initial preedit phase.
During this initial composition, the item view will receive all input
method events, and needs to forward these to the open, but not yet focused
editor for the user to get the correct visual feedback during the preedit
phase. The item view also needs to report to input method queries on
behalf of the editor to make sure that the IM UI is correctly positioned
without covering the user input.
Implement a test that simulates the sequences through synthesized
QInputMethodEvents; we can't simulate the entire system input stack.
Fixes: QTBUG-54848
Change-Id: Ief3fe349f9d7542949032905c7f9ca2beb197611
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
At the current state, Qt::WA_StaticContents is not respected on any
platform, and optimizations for opaque widgets is not implemented on
Cocoa.
Task-number: QTBUG-73117
Change-Id: I48b7b0c4436da5a609fdbe51bb1c9789a2a059bd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QWidget::setParent might be called to change the window flags, without
changing the parent. For those cases, we don't have to clear the focus.
Decouple the newParent state from the wasCreated flag. In most places
where newParent was tested, wasCreated was either tested previously and
can't be false anyway, or the code executed is irrelevant for widgets
that are not yet created (there can't be a paint manager). In the
remaining case, test wasCreated explicitly to maintain existing logic.
Add test for the cases where the previous code broke the focus, both
for QWidget and QDialog.
Fixes: QTBUG-93005
Pick-to: 6.2
Change-Id: I39dc179c2d348054de3927aa8b69eecef4935511
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
The Cocoa QPA plugin no longer tracks popups, but dispatches enter/leave
events when popups show and hide. So the special handling in tests and
QWidgetWindow can go away now.
Change-Id: Ib6ef00689de231996e5e57ecdd8fd0d4c861d68b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since macOS doesn't give us any event when a modal window opens,
we need to do so ourselves explicitly so that the current mouse
window gets a leave event when e.g. a popup opens, and an enter
event when the popup closes again. The case for modal dialogs is
partially handled by QGuiApplication already.
Note: We cannot rely on the transientParent of the opening/closing
window, as it's nullptr for QMenu windows even if the QMenu has
a widget parent.
Add a test for enter/leave events when a secondary window opens,
covering both the dialog and the popup case. For the dialog case,
we sometimes get two Enter events when the dailog closes, which
we have to tolerate for now.
To make the test pass on b2qt platforms, fix the offscreen plugin
to explicitly send enter/leave events in the same way as Cocoa
now does.
Fixes: QTBUG-78970
Pick-to: 6.2
Change-Id: If45e43e625e8362c3502c740154f6a6a8962b9e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Showing, hiding, and showing a window can result in the Xcb QPA plugin
warning about
qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow()
called on mapped window
The point of the test is to verify that we get a paint event on a window
that is shown again after having been hidden, not to verify that async
windowing systems can handle a show/hide/show sequence. So wait for the
window being exposed before we hide it.
Pick-to: 6.2 5.15
Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The test passes consistently in local test runs on macOS 10.15.
Change-Id: I6f05b27d3cbf930475a435c41db267a00b1726b0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It is no longer handled separately from Android.
This effectively reverts commit 6d50f746fe
Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
By going via QWidget::close() we ensure that if there's a QWidgetWindow
backing the dialog (which is almost always the case), we will plumb down
to QWindow::close(), resulting in QEvent::Close events to the QWindow.
Since we don't want QDialog subclasses to receive a call to a closeEvent
override that they didn't receive before (and which they might interpret
as rejection or cancellation), install a temporary event filter that
eats the QCloseEvent resulting from the call to close().
Task-number: QTBUG-53286
Change-Id: Ie8f6f0cb3160acfd5865dc74f0a7b6d87f838724
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Move the status setting and resetting back into handleClose so that we
don't end up with it being set if handleClose is never called in response
to a close attempt. This can happen when QWindow's platform window has
already been destroyed.
Since QWindow::close handles that case gracefully and returns true,
we can safely call it multiple times.
Add test coverage to verify that we get exactly those close event
calls that we want.
Change-Id: Ica77bf17c26d923c3b79b1e5a688addbc88a6277
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The test was failing because it didn't account for the platform behavior.
Task-number: QTBUG-30040
Pick-to: 6.2
Change-Id: I7c523c06f0bfa459c1532cee721718bebc1858c4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The system behavior is to not show these kinds of dialogs as modal,
and we've documented that for QMessageBox.
However, calling show() instead of exec() is not enough, as the
default constructor of QMessageBox will set the modality of the
widget to application-modal. We need to explicitly override this.
[ChangLog][macOS] QMessageBox::about(Qt) now shows dialog non-modal,
as documented.
Pick-to: 6.2
Change-Id: I6bb59efb81feb23122276a9eede71b2f20c9d7c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This reapplies the fix from 1ecf2212fa,
using QApplication::translateRawTouchEvent to dispatch the touch event
received by the QGraphicsProxyWidget to the relevant child widgets
under each touch point.
In addition, limit the implicit grabbing of each touch point before
sending the event to those cases where we have to: touch pads, and
if the target widget comes from a closest-widget matching. And don't
call the QTouchEvent override of QEvent::setAccepted() on QTouchEvent
instances in QGraphicsView classes, as this will override each event
point's acceptance state.
This way, we can identify which touch points have been accepted after
event delivery, any only implicitly grab those points that were.
Otherwise, touch points not accepted by a proxied widget hierarchy
will still be part of an accepted event, and be grabbed by the
viewport of the QGraphicsView. This would then lead to infinite
recursion when the QGraphicsProxyWidget passes the TouchUpdate event
on to each touch point's grabber.
Re-activate the test case, and extend it with more combinations.
Refactor touch-event recording to make it easier to test multi-touch
scenarios.
Task-number: QTBUG-45737
Fixes: QTBUG-67819
Pick-to: 6.2
Change-Id: Id5611f4feecb43b9367d9c2c71ad863b117efbcb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Counting repaints is unreliable on macOS.
Pick-to: 6.2
Change-Id: Ifa1cf516a2cab94540bea005354d8311a2651d64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Also when closed by destruction, which as of today doesn't call
QWidget::close and therefore also not QWindow::close.
Pick-to: 6.2
Change-Id: I426255e2274eae9262243c769df2264fbaa915b0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QDialog today only hides itself during reject and accept, it doesn't
close itself properly. This is problematic, as it doesn't close the
QWindow.
However, fixing this behavior must not result in duplicate calls to
virtual function, or additional calls to virtual functions (such as
closeEvent) without explicitly flagging the change in the changelog.
Add more tests to document existing behavior so that we can identify
such changes and verify the desired side effects.
Pick-to: 6.2
Change-Id: I1f30701cd766eb3c7957751b51e8579d4542dd16
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When showing a messagebox that has already been show we don't want to
keep around the clicked button of the previous invocation.
Pick-to: 6.2
Change-Id: Ib6f6293d40ab338c550ea344094db871ccf45c46
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We want to close the window, end full screen mode on macOS, and free
platform resources. This is all done by QWindow::close. QWindow::close
closes the platform window, triggering a closeEvent to QWidgetWindow,
which then calls QWidgetPrivate::close_helper.
This way, closing a window via QWidget::close, QWindow::close, or
interactively by the user are all equivalent.
The QCloseEvent generated by the widget needs to be spontaneous for
window-system generated events (i.e. the user clicked the close button),
and non-spontaneous if the window closes because of a call to
QWindow::close. To keep track of whether the event originated in an
explicit call to QWindow::close, add a boolean to the QWindowPrivate.
Add a test case that verifies that the window resources is destroyed,
and that events are delivered as they should.
Done-with: Morten Johan Sørvig <morten.sorvig@qt.io>
Fixes: QTBUG-46701
Pick-to: 6.2
Change-Id: Iacb6a2c8d5e880b16b0c8f0c9257ed94bed36f5b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
After the last row is moved, 0 will be returned when obtaining
row and column data. At this time, QListView::doitemslayout will
not call d->doitemslayout, so the QBspTree data structure will
not be cleaned up, leaving a stale tree structure behind. This
will trigger an assert during paintEvent handling if QListView is
set to IconMode
In QListView::ListMode the test for a valid model index doesn't
use an assert.
Call QListViewPrivate::clear explicitly if the column count is 0
so that the QBspTree and other data structures are cleared.
Add a test case that simulates this scenario by implementing a
model that returns a 0 column count for an index after the model
structure was changed through a move of rows.
Done-with: Volker Hilsheimer
Fixes: QTBUG-95463
Pick-to: 5.15 6.1 6.2
Change-Id: I36419be5459b8ced930c619f538482ea1db4ad03
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Replace the “size() / devicePixelRatio()” pattern with
a call to deviceIndependentSize().
Change-Id: I9d9359e80b9e6643e7395028cd43e3261d449ae7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This reverts commit 1ecf2212fa.
The fix is not correct after all. TouchBegin goes to the correct
widget with the fix, but following TouchUpdate and TouchEnd events
now go to the viewport, as QApplication::translateRawTouchEvent always
gives precedence to the widget that Qt recorded to be the touch
grabber, which is the viewport. This results in infinite recursion,
as the proxy widget trying to send the touch events to the embedded
widget (expecting that translateRawTouchEvent will split it up) ends
up sending the events back to the viewport.
Leave the added test case as QEXPECT_FAIL, reactivate the (never run,
hence unnoticed) test that the fix broke.
Pick-to: 6.2 6.1
Task-number: QTBUG-45737
Task-number: QTBUG-67819
Change-Id: I4810affb3cd066743ae94ab7beb2f0c06b60d211
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The test case was previously disabled, so tests were added to the
QGraphicsView test instead. With the QGraphicsProxyWidget test active
again, move the test cases where they belong.
Amends 1ecf2212fa,
01aeb5f7e4, and
06235d36ae
Pick-to: 6.2
Change-Id: I208b8a418653cf0640c2e7c9f716fa69538ad7e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
They were de-facto disabled in the qmake build system, and didn't make
it into the cmake build system either. The dependency to the fusion
style is not a build-time dependency since the test uses the
QStyleFactory to create the style, and if that fails, tests can be
skipped at runtime.
As a consequence of not being executed in CI for a long time, many
tests failed. Also, many tests were commented out or skipped as
broken, ambivalent, or nonsensical. Remove that dead code. The
QGraphicsWidget::initialShow test doesn't test anything that initialShow2
doesn't test, but makes incorrect assumptions, so remove it and rename
initialShow2 to initialShow.
Failing tests frequently left QWidget objects undeleted, causing all
subsequent tests to fails as well. Fix that with std::unique_ptr.
Some tests are still unstable and fail on some platforms, handle that
using QEXPECT_FAIL. The forwardTouchEvent test fails due to a bug
in Qt introduced recently. Skipping it for now.
Pick-to: 6.2
Change-Id: I405122ea9d4d150bd1d505d40b83fe39604de0f9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Just sending the event to the embedded widget is not enough, we
have to perform hit-testing for the different touch points, and
send the event to the child widget under the point. Fortunately,
QApplicationPrivate::translateRawTouchEvent provides the logic
that generates multiple events for groups of touch points.
Since that helper always sent events spontaneously, add an
optional parameter to allow sending of non-spontaneous events.
Add a test case that simulates touch events to different widget
configurations inside a QGraphicsProxyWidget.
Fixes: QTBUG-67819
Task-number: QTBUG-45737
Pick-to: 6.2 6.1 5.15
Change-Id: Iffd5c84c64ee2ceadc7e31863675fdf227582c81
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The nested widget might be a QGraphicsView as well (documented to be
supported), and QGraphicsScene maintains it's own activation status by
counting Window(De)Activate events. We need to make sure that the
embedded widget is informed about its activation status so that deeper
nested children can receive focus.
Forward WindowActivate/Deactivate events to the nested widget, which
will pass it on to all its children. Add test case, which without this
fix fails when verifying the inner scene's isActive state, or later
when testing that focusInEvent is delivered to the embedded widget.
Fixes: QTBUG-94091
Pick-to: 5.15 6.1 6.2
Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When forcing software scrolling through QScroller::scrollTo,
it will start from (0, 0). QGraphicsViewPrivate::canStartScrollingAt
should consider the locationof points, not just the flags of item.
Fixes: QTBUG-70255
Pick-to: 5.15 6.1 6.2
Change-Id: Iebdd5568baa3bdb41c705204dadb2895cfe9c0e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
ImAbsolutePosition was added in f8dbed1226,
based on requirements on Android, but without an implementation for
QLineEdit. It would seem sensible to fall back to the cursor position
in this case, as QLineEdit doesn't support multiple blocks.
Pick-to: 6.2
Change-Id: Iff1255270ceef069f03ce457df633d7b675f1a28
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove SRCDIR defines from tests that don't use them. There is a
standard define called QT_TESTCASE_SOURCEDIR that is available to all
tests and serves the same purpose.
Pick-to: 6.2
Change-Id: I2aa237739c011495e31641cca525dc0eeef3c870
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In order to fix QTBUG-95552 properly we have to add APIs to
QGraphicsSceneWheelEvent that informs QGraphicsProxyWidget about
whether the event is a high-precision event where Qt grabs the
wheel.
If it is, then the wheel grabber will be the QGraphicsView's viewport,
and any wheel event sent to any widget will be grabbed by it. This
results in infinite recoursion, partly fixed in change
I78400ceae8da7a4e22a988c06ed58f99f1a979f4.
The proper fix is to re-grab the wheel by the embedded widget
if it (or any of its children) accepts the ScrollBegin event (and if
not, return the grab to the QGraphicsView).
This fixes the scenarios that failed in the test case, so now scrolling
through nested widgets and scrolling in nested widgets works as the
user would expect.
Fixes: QTBUG-95552
Pick-to: 6.2
Change-Id: I3e1f31cbff999c70f8c63c034f77cd2ae567d7e3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
For high-precision wheel scrolling sequences, the widget that gets
the first (typically ScrollBegin) event grabs the wheel. Qt directs
all future wheel events within the same sequence (i.e. until ScrollEnd)
to that widget.
QGraphicsView passes wheel events through to the item under the mouse,
and QGraphicsProxyWidget implements wheelEvent to forward a synthesized
QWheelEvent to the embedded widget. Since QGraphicsView's viewport has
already grabbed the wheel, any forwarded event would end up back in
QGraphicsView, resulting in infinite recursion (if the assert doesn't
fail first in debug builds).
The correct fix requires that QGraphicsProxyWidget knows that this is
a high-precision wheel event, allowing it to adjust the wheel grabber
temporarily to the embedded widget. However, QGraphicsSceneWheelEvent
doesn't provide this information.
To fix the infinite recursion, mark the generated event as synthesized
by Qt (but still send it spontaneously to enable propagarion within
the proxy widget hierarchy). In QApplication's notification routine,
interpret such events then to override the wheel grabber.
Add a test case for the various scenarios. This 6.1 compatible fix
does not pass all situations. A follow up commit that introduces the
missing APIs to QGraphicsSceneWheelEvent then fixes those as well.
Task-number: QTBUG-95552
Pick-to: 6.1 6.2
Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Changing the screen orientation will cause the menu position to be
displayed incorrectly. When the screen is rotated, the geometry of
the application changes. We can refer to the handling of the menu
on Android or IOS. Close the popup window when the screen
orientation changes.
Fixes: QTBUG-95607
Pick-to: 6.2
Change-Id: I55e1cd6a8b89e375c6714a9163dfb1902d52f101
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Replace custom SRCDIR define with QT_TESTCASE_SOURCEDIR. The latter is
automatically available to all tests to use and serves the same purpose
but is not terminated by a slash.
Change-Id: I62896d0fd84ac63ac1b74a459ec1646c6bde0a46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The Qt style sheet reference claimed that Length properties can be
specified in 'em' or 'ex' units, but that was never implemented.
Add the missing implementation. Since the sizes depend on the size of
the font of the current element, we cannot convert the units in the CSS
parser, but have to do so in the QRenderRule constructor, where we can
make a decision about which font to use if the style sheet itself doesn't
specify a font. Fall back to the widget font if possible; otherwise it
will be the application default font.
The implementation translates em into QFontMetrics.height, identical to
what is already done in the QCssParser. This is in line with the CSS
specification, but contradicts our previous documentation which stated
that 'em' means "width of M". Fix the documentation.
Fixes: QTBUG-8096
Pick-to: 6.2
Change-Id: I145e2504ae3b19101a0d0dd63653466b6c2cec1d
Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Unlike an acceptable effect in QTableView + QTreeView
setAdjustPolicy(QAbstractScrollArea::AdjustToContents)
unfortunately didn't work for QListViews (and QListWidget).
This patch corrects QListViews AdjustToContents
behavior.
[ChangeLog][QtWidgets][QListView] A more correct implementation
of QListView::viewportSizeHint has been made. That
implies that setting the sizeAdjustPolicy to AdjustToContent
on QListView and QListWidget will now cause the view to
size after the contents and avoid scrollbars.
Pick-to: 6.2
Task-number: QTBUG-58749
Change-Id: I1675115f2348e2fcf0b2c39b451ef337e10eb872
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The QtTest best practices documentations recommends using output
mechanisms such as qDebug() and qWarning() for diagnostic messages,
and this is also what most of our own tests do.
The QWARN() macro and corresponding internal QTest::qWarn() function
was added when QtTest was first implemented, but was likely meant as
an internal implementation detail, like its cousin QTestLog::info(),
which does not have any corresponding macro.
This theory is backed by our own QtTest self-test (tst_silent)
describing the output from QWARN() as "an internal testlib warning".
The only difference between QWARN() and qWarning(), besides the much
richer feature set of the latter, is that qWarning() will not pass
on file and line number information in release mode, but QWARN() will.
This is an acceptable loss of functionality, considering that the user
can override this behavior by defining QT_MESSAGELOGCONTEXT.
[ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning()
Pick-to: 6.2
Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The plan for QObject::connect() (perfect) forwarders, such as
QWidget::addAction(), was to just use a variant of the Detection Idiom
to see whether QObject::connect() with the arguments as given would
compile and SFINAE out the forwarder otherwise.
It turns out that the "functor" overload of QObject::connect(), in
particular, is severly underconstrained and accepts e.g. QKeySequence
as a function object, only erroring out via a static_assert() in the
body of the function, and thus at instantiation time and not, as
needed, at overload resolution time.
At the same time, we don't really want QObject::connect() to SFINAE
out on argument mismatches between signal and slot, because the
resulting error messages would be ... unkind to users of the API. We
would like to keep the static_assert()s for easier error reporting.
Reconciling these two contradicting requirements has so far eluded
this author, so for now, to unblock progress, we explicitly black-
and, in one case, white-list possible arguments. Because QKeySequence,
in particular, is implicitly constructible from int(!), and therefore
any enum type(!), incl. Qt::ConnectionType, we need to do way too much
coding in the addAction() constraints. Hopefully, we'll be able to fix
the issue at the root cause, in QObject, before Qt 6.3 is out, but
until then, this is an ok-ish stop-gap measure.
Add thorough overload set checks (positive ones only, for now) to
tst_qwidget and tst_qmenu.
Change-Id: Ia05233df818bc82ecc924fc44c1b349af41cbbf1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QAbstractButton::setChecked is not virtual, so QToolButton cannot
override to synchronize the default action's checked state. This resulted
in button and default action not being in sync when the checked state
of the button was changed programmatically, while changing the checked
state on the action kept the button in sync.
Connect to the button's own toggled signal instead to keep the state of
the default action in sync. Make it a unique connection to allow multiple
calls to setDefaultAction, which are used by QToolButton to keep the
button updated if properties of the default action change.
Add a test that confirms that button and action are synchronized both
ways, and that we only get single signal emissions when changing either
programmatically.
Fixes: QTBUG-95255
Pick-to: 6.2 6.1
Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
layoutAboutToBeChanged must be called before
persistentIndexList as the user might create persistent indexes
as a response to the signal
Fixes: QTBUG-93466
Pick-to: 6.2 5.15
Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4
Reviewed-by: David Faure <david.faure@kdab.com>
Declaration::lengthValue only supported 'px' sizes, but one can transform
any 'pt' value into 'px' by multiplying with 1.33.
Notes: this ignores display DPI, and instead follows the W3C definition
of 'pt' and 'px' as absolute lengths [1].
[1] https://www.w3.org/TR/css3-values/#absolute-lengths
1pt = 1/72th of 1 inch
1px = 1/96th of 1 inch
so the conversion is px = pt * (72/96).
Add unit test that verifies this using QPushButton's icon-sizes property,
also with changed font in preparation of adding support for 'em' and 'ex'
units in a follow up commit.
Task-number: QTBUG-8096
Pick-to: 6.2
Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>
Change-Id: I58782e7ad0e2ff9d89ed695f8a23b1e584cfed64
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
For SingleSelection, removing the selected item will select the nearest
item and, if autoScroll is enabled, ensures that the newly selected
item is visible in the viewport. This may result in scrolling.
For Multi- or ExtendedSelection, this should not happen, as having no
selection is perfectly fine in those modes.
However, QListView still tried to scroll to the current item in response
to the currentIndexChanged signal. Since the currentIndex is at this
point already hidden, the rectangle for it became invalid, and the
attempt to scroll resulted in a one-pixel up-movement of the viewport
(since the invalid rectangle has width == height == -1).
Fix this by not scrolling if the rect for the index is invalid. Note that
the index is still valid at this point, so we can't shortcut the call
stack earlier. Add test that exercises the different combinations of
ViewMode and SelectionMode, and demonstrates the one-pixel
movement without the fix.
Fixes: QTBUG-94788
Pick-to: 6.2 6.1 5.15
Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
They're now in QWidget itself. Remove them from the API, but not the
ABI.
The QToolBar case is straight-forward. QMenu is a bit more complicated:
Since QT_CONFIG(shortcut) builds changed the signature of an existing
function instead of adding/removing an overload, we have to deal with
two cases: In a QT_CONFIG(shortcut) build, these overloads that take a
trailing QKeySequence parameter have been deprecated and therefore
cannot be removed. In a !QT_CONFIG(shortcut) build, the same functions
are 1:1 copies of QWidget functions and can be removed (from the API).
[ChangeLog][QtWidgets][QMenu/QToolBar] The addAction() functions have
been moved down into QWidget.
Change-Id: I49997b3440c137a1d4e3858d1d27d34a191e1eed
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QTableView stored the current row/column selection start in an own
variable instead using currentSelectionStartIndex. This leads to an
inconsistent behavior when the selection is done with a click on the
header and then in a cell (and the other way round)
Fixes: QTBUG-92561
Change-Id: I4c8bda3a938de451b6eff2819141e86a6870fbef
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends c0b3c06a7d.
The QCompleter used by QFileDialog uses starts-with matching of
the path parts, for all parts of the path. It uses the EditRole of the
underlying model for the data to match.
The path parts used for a path on Windows are "C:", "Users", "etc...",
and then finally whatever input has been typed so far. If we try to
match that against a starts-with rule against "Local Disk (C:)", then it
will fail and the completer will never have anything to show.
So, for the EditRole, return just the volume drive letter as we did before
c0b3c06a7d, not the volume name. Neither
can be edited anyway. This happens to then match the native file dialog
behavior, which doesn't complete "L" to "Local Disk (C:)" if the Computer
contents (ie. volumes) are shown.
Augment the QCompleter test case to cover that scenario (it already has
everything set up for this particular combination, even though we are
actually testing QFileSystemModel returning the correct data).
Fixes: QTBUG-94799
Task-number: QTBUG-78043
Pick-to: 5.15 6.2 6.1
Change-Id: I14844d91601e9b16dc07cff2ca48713acb7cdd09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
After dc794f7622, side widgets only got
space if they were not fading out, but the logic was not correctly
accounting for side widgets that never fade, such as buttons added via
QLineEdit::addAction.
Fix this to give visible widgets space, unless they are fading out. That
was the intent of the original change. Rename the variable to make its
purpose clearer, and reset it at the end of the fade-out animation.
Add a much-needed test that relies on private APIs to verify that the
effective margins are calculated correctly.
Fixes: QTBUG-94824
Pick-to: 6.2 6.1 5.15
Change-Id: If2ee6be52be9e4f9be1e91f72f27681ce27def6d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In the unit tests, two times a validator was used without a parent,
which led to memory leaks. This patch changes this: The
validators are initialized with the widget they are meant for
as parent. This fixes the memory leaks.
Pick-to: 6.2
Change-Id: I480c0c5104cbe60159fad49df28cbb6240e7ce68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
If a child widget that is affected by the parent's style sheet is
polished (because it's been shown explicitly, for instance by a layout),
then it must be repolished when the parent's style sheet changes, even
if the parent itself has not been polished yet.
Since the style sheet is set on the parent widget, we must repolish the
parent (which will repolish the entire widget tree), not just the
individual children and grand children.
Fixes: QTBUG-76945
Task-number: QTBUG-39427
Task-number: QTBUG-18958
Change-Id: I7bca9ee1badc07202fa05dc97f440f4ca6c9517d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This should reduce the amount of fall-out from DST complications.
Also document the assumptions of QDateTimeParser's two fromString()
methods (and fix the punctuation on the QDateTime parameter).
Adjusted some tests to match.
Since only QDateTime-returning methods will show the difference, and
it's at least somewhat odd to be using those on QDateEdit or
QTimeEdit, this should have little impact on API users.
[ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now
operate in UTC, to avoid spurious complications arising from time-zone
transitions (e.g. DST) causing the implicit other half to combine with
the part being edited to make an invalid result. Returns from their
dateTime() and other methods returning QDateTime (max/min) shall thus
be in UTC where previously they were in local time. QDateTimeEdit
continues using local time. The default can be over-ridden by
setTimeSpec(), as ever.
Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QDTP's absoluteMax(), setDigit() and getDigit() simply treated
day-of-week as synonym for day-of-month.
Consequently, QDTE::stepBy() did the same.
This meant that wrapping happened at the month boundary, so would jump
within the week if it wrapped around, otherwise the up/down arrow
would "jam" at a particular day of the week when further steps would
leave the month. Instead, when wrapping, wrap round the week while
still moving the day-of-month to match, jumping back or forward a week
to stay within the month on hitting a month boundary; otherwise, stop
backwards stepping on hitting the locale-specific day of the week, or
forward stepping when the step would be to or past this first day.
Fixed various bugs found in the course of testing this.
[ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays.
Previously, changes to the week-day were simply changes to the day of
the month. Weekday fields are now handled as such: changes to them do
change the day of the month, but a change that would step past the end
(or start) of the month is adjusted to the relevant day of the nearest
week within the month. When wrapping is disabled, the locale-specific
first and last days of the week are the bounds. Formats which specify
day of week but not day of month will now preserve day of week when
changing month or year, selecting the nearest day of month that
matches.
Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
... even though the documentation states that the action takes
ownership of the widget.
Change-Id: Ie5520fbda295a5a2774ff8b82165070e9d49e310
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Changing anything on a QWindow's QSurfaceFormat has zero and null
effects once the underlying native window has been created. Letting
QWidget update the format is wrong in this case, because we always
expect that the value returned from QWindow::format() reflects
reality.
(reality being the settings with which the underlying native resource
was created, which is typically frozen after QWindow::create(), not
the state of some QWidget attribute. There are certain exceptions to
this, such as when preparing to recreate the underlying native window,
in which case one will want to update all relevant fields of the
format based on the current values of the widget attributes, which is
exactly what QWidgetPrivate::create() implements, and that's good.)
Such a mismatch can have fatal consequences when OpenGL and friends
are involved, but this always depends heavily on the platform and
windowing system. For example, claiming that the alpha buffer size is
0 when the native window was created with 8, or vice versa, can break
OpenGL-related code (both in Qt itself and in applications), that
tries to create a QOpengGLContext configured based on what
QWindow::format() returns. If that format describes settings that are
incompatible with the actual underlying native window, we end up with
the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors.
This is exactly what is happening when a QOpenGLWidget (or
QQuickWidget) is placed in a QDockWidget where one of the ancestors is
forced to native (winId() was called or WA_NativeWindow was set). When
undocking, various code paths in QWidget will try to update the opaque
flag of the widget, which in turn calls updateIsTranslucent. Now, if
this function unconditionally changes the alphaBufferSize in the
QWindow's QSurfaceFormat (even though this is completely futile to do,
it has no visible effect in practice), we get the problem described
above: rendering breaking down due to OpenGL contexts created with a
pixel format incompatible with the native window.
Prevent all this by not touching the format once the QWindow has a
QPlatformWindow. This is the right thing to do, regardless of the bug
in question: a window's (or context's or any other native resource
wrapping class's) format must describe the underlying native resource
and must never deviate, unless we are preparing to create a new native
resource underneath.
When it comes to the autotest, this changes the test added in
555661b625: the autotest logic is
inverted because what we should test for is that the QSurfaceFormat
stays untouched once the application makes a - futile - attribute
change on the widget.
Fixes: QTBUG-85714
Pick-to: 6.2 6.1
Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When calling `setStyleSheet` with property `qproperty-styleSheet`,
`QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`.
This causes the recursive call to crash.
Fixes: QTBUG-94448
Pick-to: 5.15 6.2
Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This test failed when checking for a pre-condition of the tested scenario,
so skip the test if that condition isn't met, as the test won't test
anything.
Amends b1fdcc8c0f.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-64543
Change-Id: I135cd5b45efcae111305b9be338eb5429d3b97d5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
A mouse press that transfers focus from an open editor back to the view
will close the editor. To prevent that the corresponding release then
opens the same editor again we need to know that the closeEditor call
was caused by the mouse press. Since Qt first generates the focusOut
event, and then delivers the mouse press, we have to start a zero-timer
to check whether we are in the same event delivery process. If so, ignore
the corresponding release.
Add test case that simulates that chain of events.
Fixes: QTBUG-20456
Pick-to: 6.2 6.1
Change-Id: I28fa32bfbc776db207c594c329961f575ae58ea9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if QStyle::PM_ScrollView_ScrollBarOverlap
returns true, the text displayed an empty line.
Fix this by not reserving the width of the vertical scrollbar
if the flow is TopToBottom and the vertical scrollbar, and QStyle
returns true for PM_ScrollView_ScrollBarOverlap. Amends
aeef92c3c3
Pick-to: 6.1 6.2
Fixes: QTBUG-94248
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I4d47c7e86bbb86474cb1a99bb26d8b67f0e8a7e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When pressing an index in order to start a flick gesture, QAIV sets
the current index. When QScroller changes state to Dragging, then
QAIV restores the current index to what it was before the press, as
the user is clearly scrolling the view. With autoScroll enabled, this
will produce an ugly jump if the old current index is no longer in
the viewport.
To prevent this, disable autoScroll before restoring the currentIndex.
Fixes: QTBUG-64543
Pick-to: 6.2 6.1 5.15
Change-Id: I3e0a18a6a179d80b9d810fce5aa658f0cfff9a29
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When finding the index we need to scroll to, use the one where both start
and end of the tab rect are outside the currently visible section.
Otherwise we wouldn't scroll when the left-most index ends outside the
visible section.
Add test, which requires that the scroll buttons have object names.
Fixes: QTBUG-70498
Pick-to: 6.2 6.1 5.15
Change-Id: Id153c77dd5fca146612375e0ff39bd1f3e0536b1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Since 0f1008a593, views record if they
moved the item in the model, and prevent the deletion of the source item
in QAbstractItemView by setting the dropEventMoved private data member.
However, QListView in icon mode is special: it doesn't rearrange the
model, it repositions the icons in the view. While the dropEventMoved
logic was applied to the drag event filter to prevent deletion, the
variable was never set in the filterDropEvent handler. The drop event got
ignored, breaking rearranging of icons.
Fix this by setting the dropEventMoved member in filterDropEvent.
Fixes: QTBUG-94226
Pick-to: 5.15 6.1
Change-Id: I963f5db0f81bcd0d25eef05d9a265be00a5871f6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
In MultiSelection mode, items are by default toggled on press, which
follows the example of standard Windows controls. However, when dragging
is enabled, then the press might be the beginning of a drag'n'drop
operation, and deselecting the item on press breaks the selection and user
experience.
Don't toggle the selection for presses on an already selected item that
might get dragged; instead, wait for the release event.
Extend the test case slightly to cover the special case. Dragging a
selection in a drag-enabled and MultiSelection item view wasn't possible
before either.
Fixes: QTBUG-59888
Change-Id: Ibd3e95a71ea63dd1e9bc3c8a723eafa9a1c21afa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
In ExtendedSelection mode, a Ctrl+Press might be both the start of
a selection toggle, or the start of a Ctrl+Drag operation.
If we already toggle on the press, then it's impossible to drag the
existing selection while the Control key is pressed. Ignore Ctrl+Press
events and let the corresponding release event toggle the selection.
Adjust the relevant test cases accordingly. The QItemDelegate test
case used a click+control event incorrectly, such an event doesn't
change the clicked state and should not be eaten, and now it does
change the selection, so fix the test.
Task-number: QTBUG-59888
Change-Id: Ia76126e31c28bc97d3e93e54965bdb1d0b8ac6a4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Covers all selection modes and various combinations of mouse press, click,
drag, with or without modifiers.
Task-number: QTBUG-59888
Change-Id: Ib8ddc319a89649338d55fbc47e5a7ccfed338af9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
After d6551fe125 it was no longer possible to start a drag with a
double click (where the first click selects an item, and the second
press+move starts the drag). Resetting the pressedItem variable to block
the emission of the clicked() signal had this unwanted side effect.
Instead, use an explicit boolean to store that the next release event
will be the result of a double click, so that the clicked() signal is not
emitted again (preventing the double-emission was the purpose of change
d6551fe125).
Task-number: QTBUG-77771
Fixes: QTBUG-94087
Pick-to: 6.1 5.15
Change-Id: I082c5169d89eb980dcd7985ef3d302b6ff060fb9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Olivier BARTHELEMY <perso.olivier.barthelemy@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Test would previously have leaked on failure.
While checking for other uses of delete-after-checks, simplify one
place that tested deleting a calendar widget lead to recreation.
Pick-to: 5.15 6.1
Change-Id: I9524902a02dd42793bcf71113c6799dc925ac4a0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
When the PageDown is pressed, the current's rect cannot be
used to match the item, because we don't know the size of
the rect. Move the rect by the height of the viewport, and
then move the rect upwards until it matches the
button <= viewport's bottom of the item
Fixes: QTBUG-92583
Pick-to: 6.1
Change-Id: I210edc0e8b942984f3fc20e7752c6e1315152ea1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When changing the style of the combobox, the change will not propagate
to the internal container widget, so the changeEvent handler won't be
called. This is correct (as per QWidget::setStyle documentation).
QComboBoxPrivateContainer asks the combobox style for relevant settings,
such as the frame style, which is then used for sizing and positioning.
If the combobox's and container's settings become inconsistent, then the
combobox popup will not get the correct size and/or position.
Move some of the style-dependent changes into a separate function and
call it when the QComboBox::changeEvent handles the style change so that
both widgets have a consistent set of settings.
Add a test case that verifies that the style is asked for the relevant
setting when the style changes.
Note: QComboBox does a lot of style-dependent setup work in different
places, which is quite messy and complex. Trying to consolidate that
further breaks tests though, so this change is doing the minimum
necessary to fix the reported issue.
Pick-to: 6.1 5.15
Fixes: QTBUG-92488
Change-Id: Ia957d504b2d800add26fc0565be727b5c08a5358
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
child->widget() returns null if the layout item is not a widget.
Thus, calling removeWidget(nullptr) will remove all non-widget items
such as layouts or strechers.
Change-Id: I772c1158d0f7e8e2850b6e571b0405a2896f09b8
Pick-to: 6.0 6.1 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
When the listview setWordWrap is true and ScrollBarPolicy is
ScrollBarAsNeeded, if the text needs a newline display and the
vbar is not shown, the width of the item was subtracted from
the width of the scrollbar.
In most cases, the listview needs to reserve the size of the scrollbar.
But if the flow is TopToBottom and the vertical scrollbar is not
visible, the width of the vertical scrollbar cannot be reserved.
Fixes: QTBUG-92366
Pick-to: 5.15 6.0 6.1
Change-Id: I73cce691099a253d409019dbb3fe9a16e1830bb1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If a tab has a font assigned to it through a style sheet, then take the
font size into account when calculating the contents rectangle.
Add a test, which hardcodes the windows style to avoid flaky behavior
when e.g. macOS lays tabs out in the center.
Fixes: QTBUG-92988
Pick-to: 6.1
Change-Id: Ifb0ac97db7647cc25367972737be8878e50f6040
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When trying to find the original window title, check for another
maximized sub window and use its title. Protect the calls to
setWindowTitle to prevent the original title from being cleared.
Pick-to: 6.1 5.15
Fixes: QTBUG-92240
Change-Id: I55175382ab261b4cf8b5528304adaaec4fbe2c31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Those tests don't fail anymore and show in CI as BPASS, so we
can safely, hopefully, unblock them
Task-number: QTBUG-87429
Fixes: QTBUG-68974
Fixes: QTBUG-69166
Fixes: QTBUG-87403
Fixes: QTBUG-87411
Fixes: QTBUG-69083
Fixes: QTBUG-69084
Fixes: QTBUG-87426
Pick-to: 6.1
Change-Id: I831b955116c0f465319b9c5fc726dd98804d1c00
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
For items that are children of other items, removeRows calls
beginRemoveRows directly and then once again inside takeChild()
The signal blocker that dates back to the monolitic import from Nokia
prevents the model from emitting extra signals
but the persistent indexes are corrupted nonetheless.
Fixes: QTBUG-90030
Pick-to: 6.1 6.0 5.15
Change-Id: I5bc4b2598bf13247683b113faeec22471f1f04a4
Reviewed-by: David Faure <david.faure@kdab.com>
Those overloads have been documented as obsolete, but never been deprecated.
Add the deprecation macros to trigger warnings as of Qt 6.2.
The overloads taking a single StandardButton should not be deprecated until
Qt 7, as otherwise porting from old to new API will require an unnecessary
cast to StandardButtons for calls with only a single enum value.
The unit test explicitly tests the deprecated members, so disable warnings
there.
Fixes: QTBUG-92483
Change-Id: I283ddce4681eafda2378607f999946e56bbb777e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
contentsMargins is a Q_PROPERTY on a QLayout. Qt 6.1 introduced
QLayout::unsetContentsMargins() to reset the contents margins to the
"default" ones (that the user can't know); that's the textbook
description of a RESET function for the property.
Add some tests also for unsetContentsMargins.
[ChangeLog][QtWidgets][QLayout] The unsetContentsMargins() function now
acts as the RESET function for the contentsMargins property.
Change-Id: I463d88363c11f4a15ad3d6af71401d8698de1d41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Setting a cancel button on QProgressDialog more than once caused the layout
to be invalid. The layout was only applied when the dialog resizes or the
style changes, but not when a new cancel button is set.
The solution is to update the layout() before showing the dialog when adopting
new child widgets.
Fixes: QTBUG-19983
Pick-to: 6.0 6.1
Change-Id: Id8fb1ac56e94a9bd97d4559a2e8d4835856fd7d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.
[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.
Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In case of a read-only text editing widget it was imposibble to copy text
from it. In QtWidgets you could not even see the selection handless.
Text selection in QtWidgets module was filtered depending on readOnly
property of the widget. Additionally, in InputMethod the read-only state
was translated into disabled.
Patch also makes the edit menu to be aware of the read-only status of
the control - the menu items are different for rw and ro controls.
Task-number: QTBUG-91417
Change-Id: Ic7b27f78678eeaa87a38607af787f254db1383b8
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
376e3bd8ec added the new class for Qt 6.1,
but during header review we concluded that using a class introduces
complexity wrt instance ownership and API design that can be avoided by
using a std::function instead.
The functionality is tied to QTextDocument, so the type definition and
the default provider API is added there.
Since std::function is not trivially copyable, the atomicity of the
previous implementation is not maintained, and concurrent modifications
of and access to the global default provider from multiple threads is
not allowed. The relevant use case can be supported by implementing a
resource provider that is thread safe.
Task-number: QTBUG-90211
Fixes: QTBUG-92208
Pick-to: 6.1
Change-Id: I39215c5e51c7bd27f1dd29e1d9d908aecf754fb7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
While the class name is now a bit more than a mouthful, it's purpose
is very narrowly tied to QTextDocument, so don't use a very generic
name for it. That resources are provided based on a URL is to some
degree an implementation detail, and URLs are resource locators so
we don't need that in the class name.
Address code review comment for 6.1. Add documentation and links to
existing APIs with a similar purpose.
Task-number: QTBUG-90211
Task-number: QTBUG-92208
Pick-to: 6.1
Change-Id: I4f09057cc2f53a5595513c1c9422e6ccaad6ca13
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
QGridLayout::takeAt() and QLayoutItem *itemAt() only check the upper bound.
If the index < 0, these function will return invalid pointer.
Fixes: QTBUG-91261
Pick-to: 5.15 6.0 6.1
Change-Id: Idfb9fb6228b9707f817353b04974da16205a835c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The calculation rounds early and often, which is intentional. Add
unit test to make sure we don't regress.
Fixes static analzyer report about incorrect rounding in
c903a34347776fe3b89785faa35c446d.
Address some outdated comments and documentation. The property
is read only and calculated, so don't imply that it can be changed
from its default value.
Change-Id: If2dbd9890e533dfccda3eae4cbc96db4f1246f4d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The tst_QPushButton::sizeHint() test was leaking top level
windows and confusing the other tests, as they may end up
becoming active.
This also re-enables tst_QPushButton::setAccel() since I
cannot reproduce the failure with that, so maybe that was
related to the leaking widgets.
Task-number: QTBUG-91418
Change-Id: I33f4a12bf67f784c5d6a06b2407d067e804d766f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
There is something wrong with dock widget positioning on Wayland.
In the interest of getting tests running at all, we skip the
test for now, like we already do with a few others.
Task-number: QTBUG-91418
Task-number: QTBUG-91483
Change-Id: I44f5fa0e4d0a43a46ce24a61a899bfcc03787f28
Reviewed-by: Liang Qi <liang.qi@qt.io>
Wayland doesn't support explicit window activation, so the
qWaitForWindowActive() function won't actually wait for the
window to be active.
On platforms like this, we just QTRY_VERIFY() for the window
activation instead.
Task-number: QTBUG-91418
Change-Id: I5f728e6a6bcaac283c026b60e6378b9d5aaf1be5
Reviewed-by: Liang Qi <liang.qi@qt.io>
The test assumed that a window was registered as the active
one immediately when it was exposed. This created a race
condition on Wayland, where we would often get the wrong
active window when simulating the events.
Task-number: QTBUG-91418
Change-Id: Ie41fe5adb339bbb43d5ee5db400a198e479de386
Reviewed-by: Liang Qi <liang.qi@qt.io>
Several tests failed due to side effects of client side
decorations. We explicitly disable this when initializing
the test to make things go smoother.
In addition, the setToolTip() test tries to set the mouse
cursor position programmatically, which is not possible
on Wayland.
And finally, the qWaitForWindowActive() falls back to
qWaitForWindowExposed() on platforms where explicit window
activation is not supported. This fixes a few issues, but
in cases like focusProxy(), it means we aren't actually
waiting for the WindowActivation event. Instead of testing
for exposed twice on such platforms (Wayland), we replicate
the logic from qWaitForWindowActive() instead and rely on
automatic window activation. If it fails, we do a QSKIP, so
this shouldn't cause any flaky test failures at least.
Task-number: QTBUG-91418
Change-Id: I767c881e7cdc91f43ad357294a2c6240ab1af43c
Reviewed-by: Liang Qi <liang.qi@qt.io>
This reverts commit 6269438af9, and adds a test.
This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The
code already interprets the textAlignment values from the rule, also if no
icon is set. Adding the same, or some default textAlignment to the text flags
if there is no icon doesn't work.
Fixes: QTBUG-91735
Task-number: QTBUG-86857
Pick-to: 6.1 6.0 5.15
Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The test assumed that dialog.move() would actually move
the dialog box to the requested location, which is an invalid
assumption on Wayland.
Since the objective of the test is not to check if move() works
this way, but to check whether the dialog box shows up in the
same location when it is re-shown, we actually fetch the pos
after showing it the first time, rather than assume this is the
same as the requested one.
Task-number: QTBUG-91418
Change-Id: Ifa21fa08429f198988f90d7ee328e4f35a4764c2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
If we only wait until the window is shown before testing the
event delivery, we may be getting a WindowActivation event
and subsequent paint event after we start testing. This can
cause a shift in the paint events, so that we end up with an
unexpected paint event at the end.
We should wait until the window is active before we start
checking the response to updates, to be sure nothing is pending
on the queue still.
Note that you'd expect QTest::qWaitForWindowActive() to do this,
but this actually falls back to qWaitForWindowExposed() when
the platform does not have WindowActivation capability. While
there is no real link between WindowActivation capability and
waiting for a window to be active, changing the behavior of that
function would be too scary, so we just implement an explicit
wait in the functions that depend on this.
Task-number: QTBUG-91418
Change-Id: Iee40dcfa1377f543ea05042cc5a972270b346708
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
QTreeView's drawTree implementation performs lazy layouting
when calling itemDecorationAt. If animations are enabled,
this can change the list of items, and invalidate the copy
made earlier.
Don't copy the list of items, use a reference instead so that
code iterating over the items later operates on valid data.
Add an assert in the private itemHeight method, it must not
be called with an index that is out of bounds.
Fixes: QTBUG-42469
Pick-to: 6.0 6.1 5.15
Change-Id: Ifdb782881447912e00baffd1c407de10a1d8d0d4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>