Commit Graph

11763 Commits

Author SHA1 Message Date
Andreas Buhr
97a8727f0e Port of QDBusServiceWatcher::watchMode to new property system
Port watchMode in QDBusServiceWatcher to the new property
system. This is the easiest part.

Task-number: QTBUG-85520
Change-Id: I588212af205e77765862b8fecdbdcbf871717142
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-19 15:18:46 +02:00
Qiang Li
777053cfff Re-layout QProgressDialog when setting the cancel button
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>
2021-04-19 09:22:04 +00:00
Andrei Golubev
7b7a6050e7 Inline test cases in tst_qlist
QList tests have mostly a scheme of:
void opInt() { op<int>(); }
void opMovable() { op<Movable>(); }
void opCustom() { op<Custom>(); }

As a drive by, move the leak checking into a separate struct/macro

Change-Id: I7cdda3a6c2aa324968aa26594da9f9eafbd49a0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-17 12:24:14 +02:00
Qt CI Bot
042e728752 Merge integration refs/builds/qtci/dev/1618599897 2021-04-16 22:01:34 +00:00
Qt CI Bot
09d99a8d5f Merge integration refs/builds/qtci/dev/1618592683 2021-04-16 19:56:04 +00:00
Fabian Kosmale
e835bccb1e QPropertyBinding: Add sticky mode
A sticky QPropertyBinding is a binding that does not get removed when a
write occurs. This is used in the QML engine to implement support for
the QQmlPropertyData::DontRemoveBinding flag.

Task-number: QTBUG-91689
Change-Id: Ib575b49abe634215318ccc7ba46212cc21eb4dad
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-04-16 20:33:02 +02:00
Giuseppe D'Angelo
a794c5e287 Unicode: fix the extended grapheme cluster algorithm
UAX #29 in Unicode 11 changed the EGC algorithm to its current form.
Although Qt has upgraded the Unicode tables all the way up to
Unicode 13, the algorithm has never been adapted; in other words,
it has been working by chance for years. Luckily, MOST
of the cases were dealt with correctly, but emoji handling
actually manages to break it.

This commit:

* Adds parsing of emoji-data.txt into the unicode table generator.
  That is necessary to extract the Extended_Pictographic property,
  which is used by the EGC algorithm.

* Regenerates the tables.

* Removes some obsoleted grapheme cluster break properties, and
  adds the ones added in the meanwhile.

* Rewrites the EGC algorithm according to Unicode 13. This is
  done by simplifying a lot the lookup table. Some rules (GB11,
  GB12, GB13) can't be done by the table alone so some hand-rolled
  code is necessary in that case.

* Thanks to these fixes, the complete upstream GraphemeBreakTest
  now passes. Remove the "edited" version that ignored some rows
  (because they were failing).

Change-Id: Iaa07cb2e6d0ab9deac28397f46d9af189d2edf8b
Pick-to: 6.1 6.0 5.15
Fixes: QTBUG-92822
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-04-16 20:31:39 +02:00
Qt CI Bot
5839dee30f Merge integration refs/builds/qtci/dev/1618585460 2021-04-16 18:14:35 +00:00
Giuseppe D'Angelo
b9d0fd3a09 tst_qcborstreamwriter: don't pass char8_t strings to QByteArray
There isn't a QByteArray constructor taking a char8_t*. (I am not
sure if there should be one; QByteArray is not going to anything
special about that information anyways.)

Change such strings to be "ordinary" narrow string literals.
There should be no problems at doing so, as by default we build in
UTF-8 mode under all compilers.

Pick-to: 6.1 6.0
Change-Id: Ia200ec6e3b0453bad033d5d8ff34c013bb27abd1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 18:48:28 +02:00
Qt CI Bot
931929865f Merge integration refs/builds/qtci/dev/1618564901 2021-04-16 15:28:18 +00:00
Lars Knoll
fdedcb6ec6 Add support for grouped property changes
Add Qt::begin/endPropertyUpdateGroup() methods.
These methods will group a set of property updates together and delay
bindings evaluations or change notifications until the end of the update
group.

In cases where many properties get updated, this can avoid duplicated
recalculations and change notifications.

Change-Id: Ia78ae1d46abc6b7e5da5023442e081cb5c5ae67b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-16 16:49:29 +02:00
Lars Knoll
bb44c18b67 Don't emit change notifications more often than required
When a property value changes, first update all dependent bindings to
their new value. Only once that is done send out all the notifications
and changed signals.
This way, if a property depends on multiple other properties, which all
get changed, there will only be one notification; and (potentially
invalid) intermediate values will not be observed.

Fixes: QTBUG-89844
Change-Id: I086077934aee6dc940705f08a87bf8448708881f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-04-16 16:49:29 +02:00
Lars Knoll
cf42a0fe5e Remove lazy binding evaluation
Too much of the existing code in Qt requires eager evaluation without
large scale modifications. Combined with the fact that supporting both
eager and lazy evaluation has a high maintenance burden, keeping lazy
evaluation, at least in its current state, is not worth it.

This does not diminish other benefits of the new property system, which
include
- a C++ API to setup and modify bindings and
- faster execution compared to QML's existing bindings and the ability
  to use them without having a QML engine.

We do no longer benefit from doing less work thanks to laziness. A later
commit will introduce grouping support to recapture some of this
benefit.

[ChangeLog][Import Behavior Change][QProperty] QProperty uses always
eager evaluation now when a dependency in a binding changes.

Change-Id: I34694fd5c7bcb1d31a0052d2e3da8b68d016671b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-04-16 16:49:29 +02:00
Qt CI Bot
07d4a981a2 Merge integration refs/builds/qtci/dev/1618561273 2021-04-16 14:49:26 +00:00
Qt CI Bot
7e15d57eb4 Merge integration refs/builds/qtci/dev/1618515869 2021-04-16 10:08:31 +00:00
Edward Welbourne
b4a875544b Extend time_t-based handling all the way to the end of time_t
At least some modern 64-bit systems have widened time_t to 64 bits
fixing the "Unix time" problem. (This is even the default on MS-Win,
although the system functions artificially limit the accepted range to
1970 through 3000.) Even the 32-bit range extends into January 2038
but the code was artificially cutting this off at the end of 2037.
This is a preparation for using the same also all the way back to the
start of time_t.

In the process, simplify and tidy up the logic of the existing code,
update the docs (this includes correcting some misinformation) and
revise some tests.

Fixes: QTBUG-73225
Change-Id: Ib8001b5a982386c747eda3dea2b5a26eedd499ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:22:27 +02:00
Edward Welbourne
c3aa4cf952 Catch invalid offset returns from QTimeZone backends
If the backends run into an error in computing the offset, they return
INT_MIN; but they are valled via the front-end, which returns zero
when the zone is invalid. So treat INT_MIN returns from the backend
the same as the case of being invalid.

Change-Id: Ic3c4dfe964dbfba4030c770213eca8a63e84736d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:20:11 +02:00
Qt CI Bot
455994c2ee Merge integration refs/builds/qtci/dev/1618512247 2021-04-16 07:57:01 +00:00
Alex Trotsenko
063cdb9870 QWindowsPipe{Reader|Writer}: restructure signals
For QProcess, there is no point in suppressing recursive
QWPR::readyRead() emission, as the former manages this logic itself. On
top of that, the non-recursive nature of QWPR::readyRead() indirectly
disallowed reading from the channels inside
QProcess::waitForReadyRead(), if that is called from a slot connected
to QProcess::readyRead().

QWPW had two signals, one allowing recursion and one not.

This commit allows recursion of QWPR::readyRead() and
QWPW::bytesWritten(), and moves recursion suppression to the higher-
level classes. This makes the code more uniform and efficient, at the
cost of a few duplicated lines.

Change-Id: Ib20017fff4d92403d0bf2335f1622de4aa1ddcef
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-04-15 19:00:42 +00:00
Joerg Bornemann
d437a0bfca Remove Qt dependency from some test helper executables
pro2cmake did not take into account the
   QT -= qt
bit of the .pro files.

Fixes: QTBUG-91676
Change-Id: If1373ee966312e4246490bd7389d75be9fa739cb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-15 20:38:44 +02:00
JiDe Zhang
50a7eb8cf7 Add the "Territory" enumerated type for QLocale
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>
2021-04-15 20:17:49 +08:00
Qt CI Bot
1d59fe368a Merge integration refs/builds/qtci/dev/1618405176 2021-04-14 16:39:38 +00:00
Qt CI Bot
5341569b41 Merge integration refs/builds/qtci/dev/1618401544 2021-04-14 15:08:32 +00:00
Qt CI Bot
fb0fcd7fe3 Merge integration refs/builds/qtci/dev/1618397939 2021-04-14 14:29:23 +00:00
Qt CI Bot
3766cd6ff5 Merge integration refs/builds/qtci/dev/1618392398 2021-04-14 13:33:24 +00:00
Assam Boudjelthia
1359238572 Replace conversion operator by operator* in QJniEnvironment
Since conversion operators do implicit conversion that might bring
some potential issues while using the API, let's stick to having
an operator* instead.

Pick-to: 6.1 6.1.0
Change-Id: Ie7ad5537958944b8d1c11d69fbd30284b4b0344d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-14 12:38:20 +00:00
Eirik Aavitsland
f4d791b330 Avoid processing-intensive painting of high number of tiny dashes
When stroking a dashed path, an unnecessary amount of processing would
be spent if there is a huge number of dashes visible, e.g. because of
scaling. Since the dashes are too small to be indivdually visible
anyway, just replace with a semi-transparent solid line for such
cases.

Pick-to: 6.1 6.0 5.15
Change-Id: I9e9f7861257ad5bce46a0cf113d1a9d7824911e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-04-14 13:52:37 +02:00
Mårten Nordheim
a7dac8e35b QNetworkCookie: Rename sameSite to sameSitePolicy
As suggested in the API review.
Amends 37bd7b5733

Pick-to: 6.1 6.1.0
Change-Id: Ic3e8567f349568dc3b4dbf79be27c304b39480cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-14 13:44:26 +02:00
Edward Welbourne
964f91fd25 Make POSIX transition rule parser more robust
The POSIX rule parser used by QTzTimeZonePrivate recklessly assumed
that, if splitting the rule on a dot produced more than one part, it
necessarily produced at least three. That's true for well-formed POSIX
rules, but we should catch the case of malformed rules.

Likewise, when calculating the dates of transitions, splitting the
date rule on dots might produce too few fragments; and the fragments
might not parse as valid numbers, or might be out of range for their
respective fields in a date. Check all these cases, too.

Added a test that crashed previously. Changed
QTimeZone::offsetFromUtc() so that its "return zero on invalid"
applies also to the case where the backend returns invalid, in
support of this.

Fixes: QTBUG-92808
Pick-to: 6.1 6.1.0 6.0 5.15
Change-Id: Ica383a7a987465483341bdef8dcfd42edb6b43d6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-04-14 12:57:30 +02:00
Mårten Nordheim
e875c071ec QNetworkInformation: delete the instance as a post-routine
On Windows, on exit, the backend will deref (and then implicitly start
deletion of) a COM object. This object tries to communicate with an
object in another thread, though it seems this other thread quits before
the main thread in _most_ cases.

To get around this we move the deletion to earlier in the program. While
this is only reported as a Windows issue it makes for more consistent
behavior if all platforms behave the same.

Document and test that recreation of QNI works as expected after the
destruction (and recreation) of QCoreApplication.

Amends: 0875626e22

Fixes: QTBUG-92568
Pick-to: 6.1 6.1.0
Change-Id: Iffc07f38673019aa059efd4d64d2ad706a03f6fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-04-14 10:47:20 +02:00
Fabian Kosmale
d5b79e876e QBindable: Mark non-modifying methods as const
A few methods in QBindable which do not modify anything were not marked
as const so far. This adds the missing const, and a test to verify that
they work.

As all methods are fully inline, this does not cause any binary
compatibility issues.

Fixes: QTBUG-89508
Change-Id: If06d33bc405232887b8c371c268840ba34dbadf6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-14 09:24:33 +02:00
Heikki Halmet
409443a376 Extend blacklisting of tst_gestures including all RHEL's
These are also failing in RHEL 8.2

Task-number: QTBUG-52523
Change-Id: I1448124376a2b415351d1a755043431050808e38
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-04-13 08:20:48 +03:00
Alexey Edelev
fcb766f588 Add test of the static plugin with resources
The test follows up the discussion about tests related to the static
plugin resources:

https://codereview.qt-project.org/c/qt/qtbase/+/341203/6/tests/auto/other/init_resources_static_plugin/CMakeLists.txt#1

It emulates the static plugin that contains resource files. Since the
test already exposed few issues related to the resource object linking
it makes sense to have it in test set.

Change-Id: I62621c2db1eae6ae5842ba52035774a662d93423
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-12 17:19:41 +02:00
Qt CI Bot
6d624ab01a Merge integration refs/builds/qtci/dev/1618224780 2021-04-12 13:55:09 +00:00
Mårten Nordheim
bb85831e4d QtFuture::connect: disconnect signals first
During reportFinished we may call a continuation which might end up
triggering one of the signals.

Pick-to: 6.0 6.1
Change-Id: I19546fcca12be71cd536e4287eb5eddd9d236830
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-12 12:37:40 +02:00
Volker Hilsheimer
019f35524d Fix compiler warning on platforms without QRhiNativeHandles
Pick-to: 6.1
Change-Id: I61254290853cadf3b1edf6e7b0f82bba9e8d2efe
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-04-12 10:41:50 +02:00
Volker Hilsheimer
5f31da62bb Disable warnings for tests using QSqlQuery assignment
Copying is deprecated as of 14f9f00fdb.

Pick-to: 6.1
Change-Id: I235d45ff6769a29a4fdfd888c20dd9fe2fe81346
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-11 23:08:32 +02:00
Volker Hilsheimer
ed8429495e Fix gcc warnings from having only one of assignment/copy
For example:
warning: implicitly-declared
‘constexpr Complex& Complex::operator=(const Complex&)’
is deprecated [-Wdeprecated-copy]

Pick-to: 6.1
Change-Id: I7598e821acb7cb7bf17776d693af62778185afc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-11 19:53:51 +02:00
Volker Hilsheimer
fa3b672f99 Mark variables that might be unused under some configurations
Silence compiler warnings.

Pick-to: 6.1
Change-Id: I857cf2ee177eecf305e4fa14f6b69b019ce85468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-11 19:53:43 +02:00
Volker Hilsheimer
65e3dc5eac Fix warnings about lossy double/float conversion in tests
QVectorND, QQuaternion, and QColor all operate on floats rather than
qreal or double, so explicit use float literals in the tests.

Pick-to: 6.1
Change-Id: If12cc12ddd9cd8219f3d78bf24e1400921e26c2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-11 19:53:32 +02:00
Qt CI Bot
33edff40e4 Merge integration refs/builds/qtci/dev/1617884275 2021-04-08 17:03:20 +00:00
Mårten Nordheim
d32b93afb3 tst_qsslkey: Clean up #if-ery
It was more complex than needed in a few places.

Change-Id: I0609423f82420f72c65637cf398ccd7694ee85e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-08 12:42:26 +01:00
Alexey Edelev
70464b355e Specify QT_TESTCASE_BUILDDIR for Qt::Test users implicitly
QT_TESTCASE_BUILDDIR was implicitly defined by Qt::Test target for
library users in Qt5. By default, this definition will point to
CMAKE_CURRENT_BINARY_DIR. This logic works similarly to qmake logic.

From user's perspective it might be useful to not rely on standard
search paths, but specify own. This can be done by setting the
QT_TESTCASE_BUILDDIR property for the user's target. CMake will
substute the value of the QT_TESTCASE_BUILDDIR property into the
QT_TESTCASE_BUILDDIR definition.

The implicit QT_TESTCASE_SOURCEDIR also seems to be useful. According
to the current logic, it points to CMAKE_CURRENT_SOURCE_DIR.

Fixes: QTBUG-92079
Change-Id: I8a9065f08e859c713b3c8cc08142a9ced0677770
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-08 13:16:41 +02:00
Milla Pohjanheimo
9224f8e99f Add binary compatibility files for Qt 6.0.0
Binary compatibility files added.

Pick-to: 6.0 6.1
Change-Id: I89fe7daae970af697ec57a414e3c90b24d4f9a86
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-08 06:34:13 +00:00
Qt CI Bot
b187ce87f9 Merge integration refs/builds/qtci/dev/1617813097 2021-04-07 21:01:58 +00:00
Qt CI Bot
fecba62d32 Merge integration refs/builds/qtci/dev/1617798649 2021-04-07 16:50:55 +00:00
Alexey Edelev
cbdce59cd2 Add the SIMULATE_IN_SOURCE argument to _qt_internal_test_expect_pass
test_QFINDTESTDATA builds the project in the source tree, this is
necessary because the test requires relative paths to the source file
names. This function could be useful for other tests, so it makes sense
to extend the _qt_internal_test_expect_pass/fail macros to support
build in the source tree.
Note that, the SIMULATE_IN_SOURCE argument doesn't build the test in
the existing source tree, but copies source files to the build tree
first to do not litter the source directory.

Change-Id: I16e790d74be2a0c5ca0593e0f88580dbe09882b9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-07 17:56:57 +02:00
ChunLin Wang
b8802071ed Fix get out of bounds index in QSortFilterProxyModel::filterAcceptsRow
Before calling the index function, we need to check the validity of the parameters.

Fixes: QTBUG-91878
Pick-to: 5.15 6.0 6.1
Change-Id: I9ec7265fff3f81b8a288c4ba8fae606a2ec808a6
Reviewed-by: David Faure <david.faure@kdab.com>
2021-04-07 19:30:08 +08:00
Alexandru Croitor
d0c2425d79 CMake: Choose better defaults for qt_add_plugin STATIC/SHARED
There was a recent behavior change where the public CMake API
qt_add_plugin API took into account the value of BUILD_SHARED_LIBS
to decide whether the plugin should be a static or shared library.

Instead, use the following new behavior

 - If no explicit option STATIC / SHARED option is passed, default to
   whatever flavor Qt was built as.
   Aka if Qt was configured with -shared, qt_add_plugin defaults
   to creating shared plugins. If it's a -static Qt, create static
   plugins.
 - If an explicit STATIC / SHARED option is set, override the default
   computed value with the given value.

As a result BUILD_SHARED_LIBS does not affect Qt plugins anymore. This
is more in line with Qt expectations.

Add SHARED as a new valid option to pass to qt_add_plugin (it wasn't
before).

Add tests to check for the above behavior.

Amends aa4a1006cb

Pick-to: 6.1
Fixes: QTBUG-92361
Task-number: QTBUG-88763
Change-Id: Iae806024ddd5cf10cfe58ddbcebd2818084b0bd7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-07 10:10:55 +02:00
Qt CI Bot
604087361c Merge integration refs/builds/qtci/dev/1617702467 2021-04-06 14:51:16 +00:00
Fabian Kosmale
595b4e1a9b QList: Satisfy contiguous_range requirements
With C++20, there is a new iterator_category: contiguous_iterator, for
containers whose elements are stored contiguously in memory. In Qt 6,
QList satisfies this requirement.

However, we still need to tell the standard machinery about it. Step one
is to mark the iterators as contiguous_iterator; as that exists only in
C++20, we have to ifdef accordingly.
We also have to ensure that the iterators satisfy pointer_traits by
defining element_type due to how contiguous_range is specified. As this
runs afoul of LWG 3346, we check for known bad _GLIBCXX_RELEASE
versions.

Change-Id: I8c134544e694ba937e4d912393eb72fa75b49e3d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-04-06 11:35:35 +02:00
Alex Trotsenko
72d1a54763 QWindowsPipeReader: determine pipe state before signaling
The 'pipeBroken' flag must be updated before emitting the readyRead()
signal to avoid deadlock of waitForReadyRead() inside slot connected
to readyRead().

Change-Id: Ie393fdd594c6691da6609ea18307589b7157c624
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-04-06 11:27:41 +03:00
Alexandru Croitor
0e6c4224f0 CMake: Build minimal subset of tests in desktop static builds
Add new configure option -make minimal-static-tests and CMake option
QT_BUILD_MINIMAL_STATIC_TESTS. In conjunction with QT_BUILD_TESTS
it will enable building a minimal subset of tests when targeting
a static desktop Qt build.

In qtbase the minimal subset includes all the auto tests of testlib,
tools, corelib and cmake. In particular this will also do cmake build
tests and qmake build tests (tst_qmake)

Adjust CI instructions to enable building a minimal subset of static
tests when a platform configuration is tagged with the
MinimalStaticTests feature.

Fix and skip a few tests that were failing.

Pick-to: 6.1
Task-number: QTBUG-87580
Task-number: QTBUG-91869
Change-Id: I1fc311b8d5e743ccf05047fb9a7fdb813a645206
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-06 09:15:37 +01:00
Heikki Halmet
c87847db87 BLACKLIST tst_qfont for Red Hat
Task-number: QTQAINFRA-4363
Task-number: QTBUG-84248
Pick-to: 6.1
Change-Id: I791aba3bf2b26f9c90201b1dcd67c2a85d28f08b
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-04-06 07:35:24 +03:00
Ivan Solovev
33786e7b02 Fix Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS when using the signal
This commit amends 4ceaf22bed.
Signal parameter was not actually used, even is the signal was
specified.
This patch fixes it and also introduces unit-tests for this issue.

Change-Id: I029d413644eb6a72af3bdce27cc5f5bcadfe946a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-03 17:21:30 +02:00
Samuel Gaist
bc00daae71 Add support to set thread priority to QThreadPool
Currently, QThreadPool's generated threads inherit the priority from the
thread they are created and that cannot be changed. This merge request
adds a property to QThreadPool so that the priority of the threads can
be different.

The default behavior does not change.

[ChangeLog][QtCore][QThreadPool] QThreadPool can now be configured to
use a different thread priority when creating new threads than the one
it inherits from the thread it was created in. This will only apply to
the threads started after the property is changed.

Fixes: QTBUG-3481
Change-Id: Ic98d4312d055a3357771abb656516ebd0715918d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-03 09:14:55 +02:00
Qt CI Bot
bf6f0c6cac Merge integration refs/builds/qtci/dev/1617264361 2021-04-01 10:32:08 +00:00
Fabian Kosmale
4ceaf22bed QObjectCompatProperty: Emit signal in notfiy
There is no need to write emit and notify at the same time, as not
emitting after notify does not make sense.
This naturally only applies to properties with a changed signal.

Change-Id: I99ff7863a509262ad9d4f7c9c5afbc66fd37001c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-04-01 10:04:31 +02:00
Fabian Kosmale
2ffb91ac59 QObjectCompatProperty: Require explicit notify
For QObjectCompatProperty, which allows to do basically anything in its
setter, it is actually easier to manually specify when the change should
become visible. This is in line with manually writing emit calls in the
old property system, and allows the preservation of class invariants.

Change-Id: I585bd3f25d722ca3fd721ead85fe73dbee26c5f6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-04-01 10:04:27 +02:00
Piotr Mikolajczyk
2e3f48637e Linux: Add abstract address support for QLocal{Socket,Server}
Takes advantage of Linux's and Android's support for abstract namespace
when binding sockets, which is independent of the filesystem (see man
entry for unix domain sockets).

To make QLocalServer and QLocalSocket use an abstract socket address,
one needs to set the socket options to QLocalServer::AbstractNamespaceOption.

Fixes: QTBUG-16090
Change-Id: Ia9f9c9cc1ac5c28f9d44b0a48d854a7cfbd39b11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-01 06:57:04 +01:00
Volker Hilsheimer
15b0809f06 Remove QEXPECT_FAIL for tests that pass now on Android
Fixes: QTBUG-69214
Fixes: QTBUG-69218
Fixes: QTBUG-69220
Change-Id: I8b780db8d9dad1a877bc16e802e6ae92de0c8f23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-03-31 17:31:12 +02:00
Qt CI Bot
293d556fb4 Merge integration refs/builds/qtci/dev/1617183127 2021-03-31 11:47:55 +00:00
Andreas Buhr
2b8f7c9b15 Fix some warnings
Change-Id: Ief00228f83e16421fb4eec4c678632d5c996624f
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2021-03-31 10:51:50 +02:00
Volker Hilsheimer
83d4ca3f66 Remove QEXPECT_FAIL from passing test
The test is blacklisted in dev and 6.1, let it fail properly. We can
watch the history of the test and remove the blacklisting if/when it
passes consistently on supported macOS versions.

Pick-to: 6.1
Task-number: QTBUG-20984
Change-Id: I3211ecf565995578c83a092c637890c0e8bfd766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-31 10:20:07 +02:00
Qt CI Bot
ae0fe7d4da Merge integration refs/builds/qtci/dev/1617116580 2021-03-30 17:19:59 +00:00
Qt CI Bot
5d5cc3c7c7 Merge integration refs/builds/qtci/dev/1617109351 2021-03-30 16:02:41 +00:00
Laszlo Agocs
7ccd2d0246 rhi: Add support for custom bytes-per-line for uncompressed raw data
Fixes: QTBUG-90770
Change-Id: Icba328c417bcce256e7b44f1d540af7f8e83376b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-03-30 16:43:35 +02:00
Qt CI Bot
31c81e08c6 Merge integration refs/builds/qtci/dev/1617098611 2021-03-30 13:30:26 +00:00
Giuseppe D'Angelo
0e778b96f1 tst_qobject: enable some tests for narrowing
Compilers are catching up, so some #if 0 codepaths can now be
conditionally enabled.

Change-Id: Ia9e87a096bc2ae4789ab390a9170d9c1eb9690d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 13:27:14 +01:00
Andrei Golubev
c34f51d58c Remove meaningless QT_NO_UNICODE_LITERAL check in QString literal tests
This check doesn't really do anything useful anymore: QStringLiteral
is used in Qt without any extra QT_NO_UNICODE_LITERAL #if-ery

Additionally, clean the related (and outdated) comment in
{QString, QByteArray}::literals()

Change-Id: I65b1eac33c5470508997be24f9ba6cf56d8578ea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-03-30 10:37:13 +01:00
Andrei Golubev
b1377ed02d Add literal operators for QString and QByteArray
[ChangeLog][QtCore][QString] Added literal operator
u"..."_qs that converts a char16_t string literal to QString

[ChangeLog][QtCore][QByteArray] Added literal operator
"..."_qba that converts char string literal to QByteArray

Change-Id: I4aa59b28cc17bff346b378eb70008fb8185d21ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-30 10:37:07 +01:00
David Faure
b4aac2af19 QAbstractItemModelTester: fix false positive when model has zero columns
Regression introduced by me in commit 72e0d699ce

Fixes: QTBUG-92220
Change-Id: Ic7dd4eda0a1993f9763933882baf928bfc83b08b
Pick-to: 6.1 6.0 5.15
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 10:36:06 +02:00
Piotr Mikolajczyk
c80f262258 Android: Add select and copy capability to read-only text widgets
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>
2021-03-30 10:35:59 +02:00
Volker Hilsheimer
ccf1a1a953 Replace QTextDocumentResourceProvider with a std::function
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>
2021-03-30 08:11:27 +02:00
Volker Hilsheimer
5925daf969 Silence a bunch of gcc warnings for the moc test
We deliberately expose moc to warning-worthy C++, but we don't want the
compiler warnings coming from those.

Change-Id: I09c36d7c8bfbb88f7bde61fa7bcc52a5adde81da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-29 15:59:48 +02:00
Volker Hilsheimer
c8f6f8a222 Rename QUrlResourceProvider to QTextDocumentResourceProvider
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>
2021-03-29 15:59:40 +02:00
Alex Trotsenko
d8c6052815 Repair tst_qwineventnotifier
- add missing include
- fix platform detection in CMakeLists.txt

Change-Id: If7d04765eb40310d2841e792e8f80e083e067ad2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-29 15:54:05 +02:00
Laszlo Agocs
9e662a0baf Skip a tst_QRhi test case with the Android emulator
Pick-to: 6.1
Task-number: QTBUG-92211
Change-Id: I63ff17b226d502189bc769b0b28640b849b8d39a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-29 09:57:48 +02:00
Giuseppe D'Angelo
8b9c8d417b tst_qobject: fix the detection for GCC
Q_CC_GNU is defined on compilers that masquerade as GCC (Clang, ICC),
so using it to work around GCC-specific bugs is wrong. Introduce a
local define for _only_ GCC and use it in place of Q_CC_GNU.

Drive by: version-fence a test we now know it's been fixed upstream,
and correct the link to the corresponding bug report.

Pick-to: 5.15 6.0 6.1
Change-Id: I9059d6e6bf86157aca71590ac22afb1a1c114313
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-26 14:57:45 +01:00
Giuseppe D'Angelo
0b4ccbf81e QPainterPath: fix handling of fill rules
fillRule() contained a major blunder: instead of checking if the
d-pointer was allocated, and return a default value if it wasn't,
it checked whether the path contained any points. This means that

  QPainterPath p;
  p.setFillRule(x);
  Q_ASSERT(p.fillRule() == x);

was failing.

As a drive-by to test this change, fix another mistake in clear():
clear is documented to clear the elements in a path, but instead
it also changed the fill rule.

This commit partially reverses 697910e5fb.

Change-Id: Ieb8145694b672439c3380d9ccb87d1206a2dd115
Pick-to: 5.12 5.15 6.0 6.1
Done-with: Milian Wolff
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-26 10:45:46 +01:00
Assam Boudjelthia
b9f27335e7 Rename QJniEnvironment exceptionCheckAndClear to checkAndClearExceptions
Address feedback from header view.

Task-number: QTBUG-90211
Pick-to: 6.1
Change-Id: Iad2b609598b16f66fd6ab09484fe6e6899981263
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-26 09:29:18 +00:00
Fabian Kosmale
cb43aaca11 Introduce QMetaObject::metaType
This function returns the metatype corresponding to the metaobject, or
an invalid metatype for namespaces.

This works as follows: First we increment the metaobject revision for
new metaobjects. Metaobjects with older revisions are handled by doing a
lookup by name. That fallback is also used for dynamic metaobjects (from
QtDBUS and those created by QMetaObjectBuilder).
For new metaobjects, we store the metatype in its metatype array, behind
the property metatypes. This avoids any changes to the property and
method metatype extraction logic: For properties, the metatype access
does not change, as the new metatype is after their metatypes. For
method metatypes, we already have an indirection layer (using offsets),
so by adjusting those offsets by one, the same logic keeps working.

To distinguish between namespaces and dynamic metaobjects, namespaces
store the metatypeinterface pointer for void in the metatype array,
whereas dynamic metaobjects store a nullptr.

One nice additional benefit is that this simplifies the generator logic
in moc, as the metatype array is now never empty.

Task-number: QTBUG-92077
Change-Id: Id3f920f28553f12032a71a1a87dad29e5374dbe7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-03-25 17:33:07 +01:00
Qt CI Bot
9145650302 Merge integration refs/builds/qtci/dev/1616671507 2021-03-25 15:25:08 +00:00
Qt CI Bot
14eeb52085 Merge integration refs/builds/qtci/dev/1616667899 2021-03-25 13:40:30 +00:00
Andreas Buhr
d4fd996363 Adapt Catch2 to Apple Silicon
We are still using Catch2 2.11.3 which is not adapted to Apple
silicon yet. This patch backports the required change
from Catch v3.0.0-preview.3.

Change-Id: Ifa14a1fdd6cd1f661c94a0a78648cb01bd9699c1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-25 12:06:31 +01:00
Fabian Kosmale
ce83e56cfe QTypeInfo: Handle T::value_type being equal to T
Fix operator checks for containers whose value_type equals themselves.
It does  not make sense to recurse on value_type in that case. Thanks to
std::disjunction having short-circuiting semantics, we can avoid that
issue by checking first whether T is T::value_type.

As a drive-by, check for value_type typedef before checking for
begin/end in is_container. This works around an issue in gcc <= 8.1,
which fails to correctly SFINAE the case where begin and end are private
methods.

Pick-to: 6.0 6.1
Fixes: QTBUG-89456
Change-Id: I27305a7cfe050f13a279c07f00bc229c01daa25b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-03-25 11:22:29 +01:00
Joni Poikelin
e287582cba Fix removing columns when QSortFilterProxyModel has not been sorted yet
Fixes: QTBUG-91788
Pick-to: 6.1 6.0 5.15
Change-Id: Iddcafd3171f0f3703b94893a32b4ccaaeea9e713
Reviewed-by: David Faure <david.faure@kdab.com>
2021-03-25 11:32:22 +02:00
Qt CI Bot
65b4937f34 Merge integration refs/builds/qtci/dev/1616419842 2021-03-22 19:25:52 +00:00
Qt CI Bot
e8c3fc7c43 Merge integration refs/builds/qtci/dev/1616410126 2021-03-22 15:22:00 +00:00
Allan Sandfeld Jensen
c32cd44d34 Fix alpha handling of QImage::setPixel
It was treated differently depending on format, made it consistently
behave the same for all formats (following the behavior of the primary
formats).

Pick-to: 6.1 6.0 5.15
Change-Id: Ie24e19957d076fdf3ebd333074e26ede187489eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-22 14:29:14 +01:00
Zhang Yu
c47bb4478a Fix invalid pointer return with QGridLayout::itemAt(-1)
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>
2021-03-22 18:47:36 +08:00
hjk
8403fc7796 Make it even more obvious on what to do when tst_toolsupport fails
Triggered by 6778b247.

Pick-to: 6.0 6.1 5.15
Change-Id: Ic8e7136cd82eb8d3891450cfa8994f43b7cc09fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-22 09:56:51 +01:00
Giuseppe D'Angelo
14f9f00fdb QSqlQuery: make it a move only type
QSqlQuery is a broken value class. Copying one object would mean
copying database state (the result set, the cursor position, etc.)
which isn't generally available for all database drivers.
For that reason, the current implementation does not honor value
semantics -- modifying a QSqlQuery object has visible side effects
on its existing copies (!).

The correct solution is to accept that QSqlQuery is a move only
type, not a value type. Add move semantics to it, and deprecate
its copies.

(We can't just *remove* copies in Qt 6 due to SC/BC constraints).

[ChangeLog][QtSql][QSqlQuery] QSqlQuery copy operations have
been deprecated. QSqlQuery copy semantics cannot be implemented
correctly, as it's not generally possible to copy a result set
of a query when copying the corresponding QSqlQuery object. This
resulted in modifications on a QSqlQuery having visible (and
unintended) side effects on its copies. Instead, treat QSqlQuery
as a move-only type.

Fixes: QTBUG-91766
Change-Id: Iabd3aa605332a5c15c524303418bf17a21ed520b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-21 10:16:56 +01:00
Fabian Kosmale
411ab34c96 QMetaObjectBuilder: remove unused serialization code
Change-Id: I73a13265a69079581d2974400b3311d3fdfda2d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-20 10:24:27 +01:00
hjk
b38b9e2bb0 Merge "Tests: Clarify the course of actions when touching tst_toolsupport" 2021-03-19 14:35:26 +00:00
hjk
8b5561c7ee Tests: Clarify the course of actions when touching tst_toolsupport
Change-Id: Ifc9caa8f1b05cd642c1bb57b0f37866de97ca2c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-19 13:07:03 +01:00
Laszlo Agocs
19384f2e8f rhi: Make it possible to clone a QRhiRenderPassDescriptor
Pick-to: 6.1
Task-number: QTBUG-91888
Change-Id: Ib6d2e639e6c24f3e9a733c6563dc8a6d6da47719
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-03-19 10:46:23 +00:00
Thiago Macieira
969337bcfd QHostAddress: prepare moving NetworkLayerProtocol from QAbstractSocket
This can only be completed in Qt 7, due to BC guarantees. I've only
updated the source code for QHostAddress and its unit test and even then
I did not touch the documentation. This needs to be completed in Qt 7.0

Change-Id: I26b8286f61534f88b649fffd166b695882f8f3b5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-18 19:54:01 -08:00
Volker Hilsheimer
180f78d126 QDial: use qRound to round
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>
2021-03-18 22:34:13 +01:00
Edward Welbourne
9d3a7c72ad Extend system zone test to check it matches LocalTime
Test we get the same starts of various days. Some coming changes shall
break some of these, but they should all be back to working by the
time we're taking account of DST before 1970 as well as after.

The first two or three test-cases work by accident in most zones, at
present, due to the zone-based code-path ignoring the LMT period
before the zone's first transition; but Europe/Helsinki had a renaming
transition in 1878, so does see its pre-zone offset between then and
the switch to UTC+2 in 1921, leading to failures in exactly the zone
Coin tests.  So suppress these three test-cases pending later fixes.
On Windows, the next text (still pre-epoch) gets bogus zone data for
its LocalTime, so suppress that likewise.

Task-number: QTBUG-80421
Change-Id: I2264e0e436d92112b03264faa410e30057b8f73b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-18 15:30:48 +01:00
Andrei Golubev
f49c6a5672 Merge "Rename QList test to something meaningful" 2021-03-18 10:10:23 +00:00
Andrei Golubev
a2b362f2db Rename QList test to something meaningful
qtbug_xxxxx is a fairly ambiguous test name

Change-Id: I4b407160464c9b8300d3683549b0ede837161e7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-18 08:31:38 +01:00
Eskil Abrahamsen Blomfeldt
d860aaa200 Disable two tests in tst_QAccessibility on Wayland
These two tests (applicationTest() and mainWindowTest())
require QApplication::setActiveWindow() to work, which it
does not on Wayland.

Task-number: QTBUG-91418
Change-Id: I0e7b4e24050684b437de63d19bd885bab53d36b9
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2021-03-18 07:58:42 +01:00
Volker Hilsheimer
48ce0bed62 Merge "QSqlError: protect against self-assignment" 2021-03-17 19:51:49 +00:00
Volker Hilsheimer
5a2ee82f2c Disable security warnings from MSVC in tests
MSVC generates the following for those tests:
warning C4996: '_open': This function or variable may be unsafe. Consider using _sopen_s
instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online
help for details.

We need to set the define before any C runtime headers are included, so
do it right away, it doesn't do any harm on other compilers.

Change-Id: Ia25afb87934058c3f27e63820eeb2db063a627f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-17 17:22:00 +01:00
Timur Pocheptsov
b477d823ad Convert QSslSocket(Backend)Private into plugin
All backend-specific code is now separated and removed
from QSslSocket(Private) code. The original code is mostly
preserved to avoid (as much as possible) regressions (and
to simplify code-review).

Fixes: QTBUG-91173
Task-number: QTBUG-65922
Change-Id: I3ac4ba35d952162c8d6dc62d747cbd62dca0ef78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9391ba55149336c395b866b24dc9b844334d50da)
2021-03-17 16:25:37 +01:00
Alexey Edelev
fac23d695f Merge "Rework the failure macros in the Qt CTest kit" 2021-03-17 15:15:38 +00:00
Alexey Edelev
fec5b8e81c Rework the failure macros in the Qt CTest kit
The _qt_internal_test_expect_fail macro fails when the test fails
during the configuration step. Rename this macro to
_qt_internal_test_expect_build_fail and add
the _qt_internal_test_expect_fail macro that expects inverted test
result.

Change-Id: I4635e99152f7a32f5c48202e84fec59800453d34
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-17 13:34:39 +01:00
Volker Hilsheimer
5c396be4e3 Port away from deprecated QVariant::type
Use QMetaType instead to silence compiler warnings.

Pick-to: 6.1
Change-Id: Ic28b3406ddcd51935f42779e7708ea8a459d3a9e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-17 12:57:39 +01:00
Eskil Abrahamsen Blomfeldt
6b82a3287f Fix tst_QPushButton tests on Wayland
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>
2021-03-16 08:08:49 +01:00
Eskil Abrahamsen Blomfeldt
75c1038311 Skip tst_QDockWidget::restoreDockWidget on Wayland
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>
2021-03-16 08:08:43 +01:00
Morten Johan Sørvig
f9f9004b40 Add auto-test for QT_USE_PHYSICAL_DPI
Test that setting QT_USE_PHYSICAL_DPI uses physical
DPI instead of logical DPI.

Change-Id: I7f89cf1af5e013454cc3d8ec3559f2719514fea3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-15 11:49:59 +01:00
Morten Johan Sørvig
f0bf7667a9 Auto-test some high-dpi env variables
Add auto-tests for QT_SCALE_FACTOR and QT_SCREEN_SCALE_FACTORS

Change-Id: I57bffa266be910f2ba26cb1a870e09ae202fcae0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-15 11:49:56 +01:00
Eskil Abrahamsen Blomfeldt
a5573cfbd5 Merge "Fix tsts_QShortcut::keys on Wayland" 2021-03-15 09:57:01 +00:00
Eskil Abrahamsen Blomfeldt
fe54c879cc Fix tsts_QShortcut::keys on Wayland
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>
2021-03-15 08:21:40 +01:00
Eskil Abrahamsen Blomfeldt
2bf9061760 Skip tst_qwindow test when running on Wayland
The tst_qwindow test failed with a warning that programmatically
moving the mouse cursor is not possible with Wayland.

Task-number: QTBUG-91418
Change-Id: I02ceb2af43fbc83a4e6ae09718315f5f79ff8285
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-03-15 08:17:41 +01:00
Eskil Abrahamsen Blomfeldt
5552d3d446 Fix tst_qwidget_window::mouseMoveWithPopup on Wayland
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>
2021-03-15 08:17:34 +01:00
Eskil Abrahamsen Blomfeldt
22ff16dc72 Make tst_qwidget pass on Wayland
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>
2021-03-15 08:17:31 +01:00
Andrei Golubev
f226854d25 Fix QMultiHash::count(key) crash
As QMultiHash uses a pointer for the data, nullptr dereference is a
thing, so check for valid d before doing anything in count()

Fixes: QTBUG-91704
Pick-to: 6.0 6.1
Change-Id: Ia20440cd7bdc03cb09c77f796fb9c5b52765eac5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-12 08:38:42 +01:00
Volker Hilsheimer
674747bac1 Revert "QPushButton: fix support of style sheet rule for text alignment"
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>
2021-03-11 22:30:22 +01:00
Fabian Kosmale
e8b7e4e96a QObject: remove QAbstractDeclarativeData::parentChanged
The code in qtdeclarative did not do anything at all anymore.

Change-Id: Idd97145cb74aeb4f43dfce2f282a765e90945073
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-03-11 14:53:26 +01:00
Mårten Nordheim
f274f91ceb QEventDispatcher(Win): Always honor interrupted status to avoid races
There may be a race where e.g. thread 'B' is woken up by a queued invoke.
At the same time thread 'A' asks 'B' to quit, which will set various
atomics (some important ones are 'interrupt' in the dispatcher and
'exit' in the event loop), but it does _not_ try to send another wake
since there is already an unhandled wake triggered by 'B' itself.
Sadly 'B' reads the 'exit' atomic before 'A' updates it.
Then, slightly before, 'B' sets 'interrupt' back to 0, 'A' write 1 to
it, meaning 'A's interrupt is ignored. Then, since there is no
interrupt, 'B' goes back to waiting for events, leaving the thread alive
and running instead of quitting.

Maybe this has unforeseen consequences (one consequence is that it will
return and re-enter the event dispatcher once more, possible
unnecessarily)

Fixes: QTBUG-91539
Pick-to: 6.1 6.0 5.15
Change-Id: Ie6f861f42ffddf4817d5c8af2d764abe9d9103c2
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-11 12:11:18 +01:00
Eskil Abrahamsen Blomfeldt
d16b171f1b Make tst_shortcut pass on Wayland
There was a race condition in the test, since the window
might be exposed before the event to activate the
application has been received. And the short cut is not
triggered before the application is active, which
means it could just be discarded and the window would
never be closed.

This happened consistently when testing on Wayland.

Task-number: QTBUG-91418
Change-Id: I40cb143985175f5f2b5405e9502a48475c93074a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2021-03-11 11:59:14 +01:00
Eskil Abrahamsen Blomfeldt
ea310c1d0f Fix tst_QDialog::keepPositionOnClose on Wayland
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>
2021-03-11 11:59:02 +01:00
Eskil Abrahamsen Blomfeldt
30245c8515 Skip tst_QOpenGL::glxContext test on Wayland
This test depends on XCB, but is only protected by a build-time
flag, so it will be executed as long as XCB is available at
build-time. Do as with the offscreen backend and just skip it
when a different platform plugin is in use.

Task-number: QTBUG-91418
Change-Id: Ida076dc81d0740af2cec164bd40ca10d16345f05
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2021-03-11 11:58:42 +01:00
Eskil Abrahamsen Blomfeldt
100840a4fb Fix tst_qgraphicseffect on Wayland
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>
2021-03-11 08:04:21 +01:00
Eirik Aavitsland
bea214e765 Fix: QBrush autotest failure on Android and Wayland
Since Qt 5.5, brush textures are stored as QImages. If the texture has
been set as a QPixmap, the conversion to QImage may change its pixel
format, depending on the native system format. That is acceptable.

Fixes: QTBUG-69193
Task-number: QTBUG-91418
Change-Id: Ic4dbeaa552b1f2183774a011e38414855a9dc4b1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-11 07:03:45 +00:00
David Faure
1d567eb63d Merge "QConcatenateTablesProxyModel: skip dataChanged in hidden columns" 2021-03-09 15:32:01 +00:00
David Faure
f6efbd23b5 QConcatenateTablesProxyModel: skip dataChanged in hidden columns
When the source models don't have the same number of columns, the proxy
keeps only the smallest number of columns across all source models.
Afterwards, if a source model emits dataChanged in a column past
that number (a "hidden" column), the proxy needs to ignore it rather than
assert.
But also, if the source model emits a dataChanged signal across both
visible and hidden columns, then the last column number needs to be
adjusted so that the signal is correctly processed and forwarded.

Task-number: QTBUG-91253
Pick-to: 6.1 6.0 5.15
Change-Id: I939e8ec0faf41370472f86785851292e4372f72c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-03-09 13:39:45 +01:00
Laszlo Agocs
80029e0ca6 rhi: gl: Fix missing uniform data with certain command lists
Following patterns from the other backends is insufficient with OpenGL
because we do not use real uniform buffers. There is currently a
possibility that a shader program will be bound without following it
with setting uniforms. Correct this by having a second level of tracking
of the associated srb object in the pipelines.

Pick-to: 6.0 6.1
Fixes: QTBUG-91630
Change-Id: I74a012daade826dd22c436bde06381c1233bad11
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-09 12:00:48 +01:00
Eskil Abrahamsen Blomfeldt
a6cdf41310 Fix testlib/tst_selftests::keyboard on Wayland
Wayland does not support WindowActivation capability, which
will trigger a warning in qWaitForWindowActive(). Since the
selftests depend on matching the exact output of the tests,
it gets confused by this, even though the tests are passing.

So we suppress the warning when the capability is not
supported.

Change-Id: I1e1f530a7b237183ee4ef123618e868b746ba863
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-09 07:42:50 +01:00
Qiang Li
f140ef04a0 Fix the crashes when animated QTreeWidgetItems are hidden
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>
2021-03-08 12:31:13 +00:00
Morten Johan Sørvig
1471f2ae09 Add deviceIndependentSize() to QPixmap and QImage
This function returns the size in device independent
pixels, and should be used when calculating user
interface sizes.


Change-Id: I528123f962595a3da42438ca560289a29aca4917
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-08 08:27:41 +00:00
Timur Pocheptsov
734ab493f7 Fix a BIC introduced by extending the namespace QSsl in _p.h files
Renamed the private part of the namespace to QTlsPrivate.

Fixes: QTBUG-91531
Change-Id: Id2d9c458d8d958b35e437eee42889177dad0a7a7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e4efa00c72c7011f4e5c27722c2a522b30274610)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-05 20:50:02 +00:00
Andreas Buhr
63b40b962e Merge "Fix warning about virtual override" 2021-03-05 18:09:24 +00:00
Edward Welbourne
a757d7123b Merge "Add more QDateTime test-cases close to the epoch" 2021-03-05 17:22:39 +00:00
Øystein Heskestad
de658d8ca5 Merge "Make qdecompresshelper archive bomb check only trigger for large files" 2021-03-05 16:32:49 +00:00
Edward Welbourne
33ffc27834 Add more QDateTime test-cases close to the epoch
The prior tst_QDateTime::setMSecsSinceEpoch(-1) testcase was the last
millisecond of 1969; which (deep in the relevant function) actually
uses time_t 0 (with the -1 ms offset taken aside to be put back
later); so add the matching -1 second test. At the same time, add +1ms
and +1s checks for symmetry.

Change-Id: Ib487305f6ad81b55563ea59926cae13fb1fde592
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
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>
2021-03-05 16:11:26 +01:00
Andreas Buhr
230f41f670 Fix warning about virtual override
Change-Id: Ia9928c8ef5d1597e55f45c67c462c1e9756ee899
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-03-05 15:51:41 +01:00
Giuseppe D'Angelo
bcedeb6d3d Merge "QPoint(F): declare as PRIMITIVE, not RELOCATABLE" 2021-03-05 14:38:41 +00:00
Øystein Heskestad
be73ca7eb1 Make qdecompresshelper archive bomb check only trigger for large files
This is to avoid false positives.
By default files are large if uncompressed size > 10 MB. Only configurable internally.
Also add auto tests.

Task-number: QTBUG-91392
Pick-to: 6.0 6.1
Change-Id: I32258cb7c957f2a23a05157ba4ed5c0af2ba585e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-05 15:13:53 +01:00
Timur Pocheptsov
684d44024f Merge "tst_qdtlscookie: use a proper 'enterLoopMSecs' instead of 'enterLoop'" 2021-03-05 13:00:56 +00:00
Fabian Kosmale
23636d4281 tst_qmetatype: RELOCATABLE -> PRIMITIVE is binary compatible
Based on the discussion in https://codereview.qt-project.org/c/qt/qtbase/+/336742
changing our types from RELOCATABLE to PRIMITVE is fine.

Change-Id: Ica867203aa813d19fdfd3753fc4ff36ef4332fc3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-03-05 10:19:45 +00:00
Timur Pocheptsov
b262007929 tst_qdtlscookie: use a proper 'enterLoopMSecs' instead of 'enterLoop'
It's a bit weird to calculate timeout in milliseconds and then pass
it as number of seconds ...

Pick-to: 6.1 5.15
Change-Id: I1127163ea06e49ac1b53eea6f60ee8590319bfa1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-03-05 10:34:54 +01:00
Toni Saario
49e93b6e39 Skip globalstatic threadStressTest on QEMU
The test causes frequent failures in the CI. This is the most
subtle fix until it is properly fixed.

Pick-to: 6.1
Task-number: QTBUG-91423
Change-Id: I6499378dcd3ed1c31275db38d83b572e764366cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2021-03-05 08:09:59 +00:00
Allan Sandfeld Jensen
9fb81fc287 Merge "Add QColorSpace::description" 2021-03-05 00:04:34 +00:00
Volker Hilsheimer
d76d8571e2 QMenu test: turn tooltip animations off
QTBUG_89082_actionTipsHide() is very flaky if tooltips fade in, as the
mouse move might happen while the tooltip is still appearing.

Fixes: QTBUG-91532
Pick-to: 6.1 6.0 5.15
Change-Id: I55305927fcf143d99dfff28d0bc70b2e831a139a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-04 22:49:47 +01:00
Allan Sandfeld Jensen
01c55405fa Add QColorSpace::description
A way to read the description of the profile from ICC, or set one
yourself.

Change-Id: I68622e30ee209cac99c41f3df934712c3548c0de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-04 22:37:08 +01:00
Friedemann Kleint
b62725608b Blacklist test QMenu::QTBUG_89082_actionTipsHide() for Windows
Apparently, ba13960392 is not
sufficient.
Amends 3f3d5e6716.

Pick-to: 6.0 6.1 5.15
Task-number: QTBUG-89082
Change-Id: I80a00abb330bebd3be8667762c279c2eef595c7f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-04 08:43:33 +00:00
Friedemann Kleint
65c6fbea24 Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows, take 2
Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.

Amends ba13960392,
3f3d5e6716.

Task-number: QTBUG-89082
Pick-to: 6.0 6.1 5.15
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-03 10:16:30 +01:00