The QHoverEvent ctor takes two points: pos and globalPos; pos is then
passed as both the scene and global pos to the QSinglePointEvent ctor,
which calls QMutableEventPoint::setScenePosition() on the persistent
QEventPoint instance and then detaches befeore setting ephemeral state.
Therefore, we must construct QHoverEvent with scene position first, not
local position, so that the right value is persisted; it's better to set
local position after the detach(), whereas it's too late to fix the
persistent point then.
Pick-to: 6.4
Fixes: QTBUG-106918
Change-Id: I45726a9ec05bba2fe0cde6f5fb87c269105caca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-1 is the default value for QSurfaceFormat::alphaBufferSize. Changing it
to 0 may result an unexpected pixel format change by ARB OpenGL
extension.
Pick-to: 6.4
Fixes: QTBUG-107629
Change-Id: Ia6a1b90fba6c43b6872b406f4fd946d937135cf8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
QWindow::requestActivate() is not supported.
This function crashed very often in ci/coin when system is busy.
Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I82523080db40bddce9c9dc000433117d8ef74847
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QWindow::requestActivate() is not supported.
This function failed in test vm in coin manually very often.
Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I013651b0e5e7618c29742effd85a091ca95a7414
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
setFocus() was called on a double spinbox without calling show()
first. That causes flakiness on XCB when checking focus afterwards.
The test can still fail, when focus is acquired by e.g. a system
popup.
This patch adds a show() call before setFocus() to stabilize normal
behavior. In case the double spin box is shown, but cannot acquire
focus, the test is skipped.
Fixes: QTBUG-70088
Change-Id: If02e88800a31b09a1da63dcc074eb8bb1b0df391
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Allocate the QSplitter on the stack so that it and its child widgets are
cleaned up when the test function finishes.
As a drive-by, replace QString usage with QByteArray to avoid unneeded
conversion from and to latin1, and modernize list construction and for loop.
Pick-to: 6.4 6.2
Change-Id: I2e29961edbab1ec88be356fca6bc100f08894e82
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
None of these users require C++20 constexpr or C++23 noexcept, the
only remaining difference between std::exchange and qExchange.
This leaves a single qExchange() user, in QScopedValueRollback, that
requires the constexpr version, only available from C++20, and thus
remains unported.
Task-number: QTBUG-99313
Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Skip tests that depend on programmatic window activation on platforms
where this is not supported, such as Wayland.
- Change tests that don't rely on the window being activated to use
qWaitForWindowExposed() instead.
Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ieb4280343a725a2cbdc46a8ac5c657beeb2e7e57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
focusProxyAndInputMethods tests focus acquisition and inheritance with
a toplevel widget, acting as a focus proxy for a child.
X11 window managers are set to be bypassed, programmatic focus is set
with QApplicationPrivate::setActiveWindow().
The test is flaky on Linux/XCB, and therefore blacklisted on most
Linuxes.
This patch removes focusProxyAndInputMethods, considering that
- focus proxying is tested in tst_QWidget::focusProxy()
- window activation and focus inheritance are tested in
tst_QWindow::isActive()
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I510fd935399d9ad0b6cd76f1bd5db0811e0702f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.
Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Prior to 5.12, the placeholder text color was hardcoded to be the same
as the text color, but with an alpha of 128, i.e. semi-transparent. In
5.12, it instead got its own ColorRole in QPalette. So behavior
changed (In some cases in 5.12 and later, consistently from Qt 6):
placeholder texts no longer got a "light" (semi-transparent) version
of the css-styled color, but just the default gray/semi-transparent
black. That problem was reported as QTBUG-89815. However, the fix for
that bug did not apply the semi-transparency, but only used the same
color as the text. That caused a confusing visual expression, as
actual and placeholder text would look the same. This commit fixes
that.
The problem was made worse since there is no way to specify the
placeholder text color from css, i.e. to style it independently. A
follow up commit will aim to add that.
Fixes: QTBUG-92199
Task-number: QTBUG-93009
Pick-to: 6.4 6.2 5.15
Change-Id: I9e6698d34eba91cbf65c4da07aa5ac6d9f96a9ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QDockWidgetLayoutState::itemRect() has been used to calculate a dock
widget's size when unplugging from the main window. This method is meant
to calculate the size of the rubber band, showing the dock widget's
dock area.
The rubber band is by QDockAreaLayout::sep wider (top or bottom dock)
or higher (left or right dock) than the respective dock widget. This is
to make sure the rubber band is never fully covered by the dock widget.
By wrongly using itemRect() also for the dock widget's size after
unplugging, the dock widget grows in size each time it is unplugged.
This patch passes an invalid QRect to QDockWidgetPrivate::unplug(), in
order to prevent resizing.
tst_QDockWidget::unplugAndResize() is extended to check size
consistency after unplugging (corrected for frame margins).
Fixes: QTBUG-106531
Pick-to: 6.4 6.2
Change-Id: I1cf9f695691b0e165a5cb2881781602426e5d587
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Synthetic mouse events are not reliable, as the platform might restrict
synthetic mouse moves. In addition, the WM might automatically activate
the window when the other window is hidden, which makes the EXPECT_FAIL
flakey.
Since the test was not written to test window activation, let's just
explicitly activate the window.
Fixes: QTBUG-23699
Pick-to: 6.4
Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
For some reason when running this test on macOS 13 in the CI the window
is activated, as on other platforms, but this is not reproducible
locally, so we can't just remove the QEXPECT_FAIL.
Task-number: QTBUG-104210
Task-number: QTBUG-23699
Change-Id: Ib1cacb36d90d2be357756c82af2427f2b3ab9999
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
And include qcore_mac_p.h where needed.
Task-number: QTBUG-99313
Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The function is used the internal window activation machinery and
should not be called by user code.
Many tests still use this function, and should be ported over to
QWidget::activateWindow(). For now they are using the private
helper in QApplicationPrivate, so that we can progress with the
public API deprecation.
Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Logging category lcQpaDockWidgets was used in both dock widget test
and implementation. This dual use caused static builds to fail.
This patch replaces lcQpaDockWidgets with a test specific logging
category in tst_QDockWidget.
Pick-to: 6.4 6.3 6.2
Change-Id: I02cdfdaee9c1c1840126d803139b3d271aeac236
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Implement auto test for (de)serialization of dock widget properties.
Test settings compatibility by importing a hard coded byte array.
Test serialization format and sequence by comparing expected and real
serialization output.
Test dock widget closing behavior (QTBUG-103474) to ensure that
no closing inconsistency is caused by serialization incompatibility.
Extensively document/comment the test to ensure failures can be easily
interpreted in the future.
Task-number: QTBUG-103474
Change-Id: I3c1589c2c291b2ed56334d09b85536d4c7388f92
Pick-to: 6.4 6.3 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
An item delegate might override destroyEditor to merely reparent the
existing editor out of the item view for later reuse, rather than
actually destroying the editor.
As of d0dffdfc01, the code calling
closeEditor() - which calls destroyEditor - might explicitly set focus
back to the item view parent of the editor. This needs to handle that
the parent of the editor might no longer be valid after the closeEditor
call returns, and rather store the old parent widget explicitly.
Add a test case that segfaults with nullptr access without the fix.
Fixes: QTBUG-105231
Pick-to: 6.4 6.3 6.2
Change-Id: I04a355673823c4941865f7a575864e991ceeb5f0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The value will be propagated from Qt build.
Task-number: QTBUG-104858
Change-Id: Iae2c32c3037438f41b92f9ee28004f30eb4e3210
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Wrap some tests that specifically test deprecated APIs
into #ifdefery
* Refactor some tests to use available methods
Task-number: QTBUG-104858
Change-Id: I03e318004ce1c2718ee574bf11e00df9bc04bcaa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If restoring a QHeaderView state from a data stream with version Qt_5_0,
check alignment and resize mode properites for out-of-bound values.
If out of bounds, try QDataStream version Qt_6_0, which is used by KDE
apps compiled with 5.15.2 or 6.2.3.
QFileDialog stores settings in the same settings file across different
Qt versions, using different QDataStream versions. That makes
QFileDialog vulnerable to the issue (QTBUG-104962). A respective auto
test is added with this patch.
Fixes: QTBUG-104962
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104425
Change-Id: I666207fca7ab837ad27a247e504a40757ee8afab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Q_DECLARE_EXPORTED_LOGGING_CATEGORY is available from 6.5 only, hence
cherrypicking this solution fails.
Change-Id: Ib3351a8846bb5cf6047cd2d13c9f7cd242df9c93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If an included header brings in MacTypes.h it will cause issues,
so rename the enum to be on the safe side.
Pick-to: 6.4 6.3 6.2
Change-Id: I29ec795be74a65d4f2267d8121a514bf192cf969
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The new name describes the behavior in a better way.
[ChangeLog][Build System] The QT_DISABLE_DEPRECATED_BEFORE macro is
renamed to QT_DISABLE_DEPRECATED_UP_TO. The old name is deprecated, but
is still recognized if it is defined during configuration and the new
name is not defined.
Task-number: QTBUG-104944
Change-Id: Ifc34323e0bbd9e3dc2f86c3e80d4d0940ebccbb8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Windows VMs are provisioned with shared folders that are available as
\\${COMPUTERNAME}\testshare(writable)
so we don't need to access a remote SMB server over network anymore just
to test whether our string-parsing code handles UNC paths correctly.
Add a QTest::uncServerName() helper function to the shared filesystem.h
header and use that instead of QtNetworkSettings::winServerName. The
latter is now only used in tst_NetworkSelfTest::smbServer().
Pick-to: 6.4
Change-Id: Id0da66369ad0f4a980d612de2a31a391f1192253
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>