Commit Graph

63146 Commits

Author SHA1 Message Date
Edward Welbourne
54c2383e81 Add _tzset() call before mktime() on MS
Add a change-of-zone manual test, based on a bug-report by Felix
Kälberer. This failed: debugging revealed that MS's mktime() doesn't
pick up a change to system zone.

Fixes: QTBUG-83881
Change-Id: I9b86398ef870627a059e269f85a0f5d9d9de284b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-05 22:41:35 +02:00
Edward Welbourne
648f648258 Revise new-in-CLDR v43 enum entries to say new in 6.6, not 6.7
After the v43 update landed, a bug surfaced that was fixed by it, so
it has been picked back to 6.6, in which it has landed before 6.6.0
branched. Consequently the new enum members are in fact [since 6.6],
not [since 6.7], so update the documentation to reflect reality.

(They may also be in 6.5.3, subject to ongoing debate, but they were
not in 6.5.0 so are not [since 6.5], even if 6.5's branch does end up
describing them as [since 6.5.3].)

Pick-to: 6.6
Change-Id: Ida938fc3e3575d6e45d61449123464ebb5b6638c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-05 22:41:35 +02:00
Volker Hilsheimer
e73f35d9c6 QPrintDialog on macOS: Don't crash when parent is not a window
The test case is an incomplete version of the test that will be added to
verify the fix for the referenced bug report. The test crashes already
when showing the dialog without this fix.

Task-number: QTBUG-116277
Pick-to: 6.6 6.5 6.2
Change-Id: I969a723157f6453b78bafae5cb24a6b37b1eea50
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-05 22:41:35 +02:00
Anton Kudryavtsev
5fa4ce03f0 qDecodeDataUrl: use QL1S more
Avoid tmp QBA creation, just wrap QBAV to QL1S for QSB expression

Change-Id: I8395bd2db2aab29a6b4965071b022c0487bddcb6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-05 18:58:47 +00:00
Anton Kudryavtsev
4bd3567484 QDecompressHelper: uncache acceptedEncoding
The only user already has its own cache of transformed copy of acceptedEncoding list since 43d15dd572

Change-Id: I485b41555f327c6ff39dd48347240a725f00e09b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-05 18:58:47 +00:00
Dennis Oberst
b134718c11 QString: use new assign() in operator=({QByteArray, QChar, char *})
operator=(~) and assign() share similar names but, until now, have not
shared the same functionality. This patch introduces the usage of
QString::assign() within the non-sharing assignment operators to
effectively boost efficiency by reusing the available capacity.

Since we're re-using the capacity we update the test case in places
where they don't hold true anymore.

Since these assignment operators are frequently used in many places,
both within Qt and non-Qt code, this patch comes with benchmarks.

The preview of the benchmark results are compared with this patch and
before this patch. The results show a boost in performance for the
QByteArray and 'const char*' overload. The QLatin1StringView overload
already preserved the capacity and has a better performance than the
assign() alternative, so don't us it there.

(x86_64-little_endian-lp64 shared (dynamic) release build (O3); by
gcc 13.2.1, endeavouros ; 13th Gen Intel(R) Core(TM) i9-13900K

benchmarks executed with -perf -iterations 1000000

  * The last value at the EOL represent the string size.

QString &operator=(const QByteArray &a) (current)
  64.3  cycles/iter; 300  instructions/iter; 17   nsec/iter (5)
  65.8  cycles/iter; 366  instructions/iter; 12   nsec/iter (10)
  62.9  cycles/iter; 301  instructions/iter; 11.5 nsec/iter (20)
  61.3  cycles/iter; 315  instructions/iter; 11.1 nsec/iter (50)
  71.4  cycles/iter; 386  instructions/iter; 13   nsec/iter (100)
  136.9 cycles/iter; 811  instructions/iter; 24.5 nsec/iter (500)
  245.8 cycles/iter; 1394 instructions/iter; 42.5 nsec/iter (1'000)

QString &operator=(const QByteArray &a) (before)
  78   cycles/iter; 399  instructions/iter; 15.3 nsec/iter (5)
  82.3 cycles/iter; 465  instructions/iter; 15   nsec/iter (10)
  76.7 cycles/iter; 400  instructions/iter; 14   nsec/iter (20)
  79.5 cycles/iter; 414  instructions/iter; 14.5 nsec/iter (50)
  91.4 cycles/iter; 485  instructions/iter; 16.7 nsec/iter (100)
  189  cycles/iter; 910  instructions/iter; 34.4 nsec/iter (500)
  320  cycles/iter; 1666 instructions/iter; 56   nsec/iter (1'000)

QString &operator=(const char *ch) (current)
  70  cycles/iter; 317  instructions/iter; 12   nsec/iter (5)
  71  cycles/iter; 383  instructions/iter; 12.3 nsec/iter (10)
  64  cycles/iter; 318  instructions/iter; 11.1 nsec/iter (20)
  69  cycles/iter; 340  instructions/iter; 12   nsec/iter (50)
  77  cycles/iter; 419  instructions/iter; 13.5 nsec/iter (100)
  141 cycles/iter; 899  instructions/iter; 24.4 nsec/iter (500)
  280 cycles/iter; 1518 instructions/iter; 48.4 nsec/iter (1'000)

QString &operator=(const char *ch) (before)
  86.7  cycles/iter; 416  instructions/iter; 15   nsec/iter (5)
  87.8  cycles/iter; 482  instructions/iter; 15.7 nsec/iter (10)
  82.4  cycles/iter; 417  instructions/iter; 14.3 nsec/iter (20)
  90.2  cycles/iter; 443  instructions/iter; 15.6 nsec/iter (50)
  101.4 cycles/iter; 518  instructions/iter; 17.7 nsec/iter (100)
  204.4 cycles/iter; 994  instructions/iter; 36.5 nsec/iter (500)
  337.9 cycles/iter; 1789 instructions/iter; 58.9 nsec/iter (1'000)

 * current implemented as: assign(other)
QString &operator=(QLatin1StringView other) (current)
  47.4 cycles/iter; 237 instructions/iter; 8.2  nsec/iter (5)
  46.2 cycles/iter; 237 instructions/iter; 7.9  nsec/iter (10)
  46.8 cycles/iter; 255 instructions/iter; 8    nsec/iter (20)
  59   cycles/iter; 273 instructions/iter; 10.2 nsec/iter (50)
  55   cycles/iter; 300 instructions/iter; 9.5  nsec/iter (100)
  94.3 cycles/iter; 525 instructions/iter; 16.3 nsec/iter (500)
  166  cycles/iter; 804 instructions/iter; 28.7 nsec/iter (1'000)

QString &operator=(QLatin1StringView other) (before)
  14  cycles/iter; 79  instructions/iter; 2.5  nsec/iter (5)
  14  cycles/iter; 79  instructions/iter; 2.6  nsec/iter (10)
  16  cycles/iter; 97  instructions/iter; 3    nsec/iter (20)
  19  cycles/iter; 115 instructions/iter; 3.5  nsec/iter (50)
  23  cycles/iter; 142 instructions/iter; 4.2  nsec/iter (100)
  91  cycles/iter; 367 instructions/iter; 16.6 nsec/iter (500)
  131 cycles/iter; 646 instructions/iter; 23.4 nsec/iter (1'000)

Task-number: QTBUG-106201
Change-Id: Ie852f6abd1cf16164802acddb048eae5df59758f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-05 20:58:47 +02:00
Anton Kudryavtsev
76e56eb164 QNetworkAccessCacheBackend: reduce allocations
Use CaseInsensitive compare more.

Change-Id: I2f6d19fd63ac2e06c5b0dcb285a578f9ed61c6ab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-05 21:58:47 +03:00
Edward Welbourne
833ed75b65 Update datastream converter to use Qt_6_0 instead of Qt_5_0
It was added in 5.12 and we've had a few upates since then.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Iacb5368d4baa7d25f981bb0b8bd8d68b5461e17d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-05 16:50:53 +02:00
Edward Welbourne
670f66eed3 Core serialization examples: spacing-only clang-format changes
Marc disagreed with clang-format on some, which are thus excluded.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1402274635dba866a8160a68211874cb11dcfa61
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-05 16:40:47 +02:00
Giuseppe D'Angelo
30be644053 QCoreApplication::requestPermissions: honor QT_NO_CONTEXTLESS_CONNECT
Hide the overload that doesn't take a context object.

Change-Id: Ibf8a46ad514b00be855be6fd7c72d6464881bb25
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-05 16:34:28 +02:00
Giuseppe D'Angelo
552dc1ecfe QHostInfo::lookupHostImpl: code tidies
Since a non-null `member` implies a non-null `receiver`, streamline
the redundant check(s). While at it, introduce a simple boolean that
conveys the meaning of what we're checking for.

Change-Id: Ib9be162075771de74b1a6bc4426008b7c194df3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-05 16:34:20 +02:00
Giuseppe D'Angelo
c63de2cda3 QHostInfo::lookupHostImpl: add another precondition check
If `member` is set it means that the caller wants us to connect
to a slot using string-based connections. That means `receiver`
must be non-null as well. Check for it.

Change-Id: I6b3542855147e95fecbf4c645b556c2047a1ed69
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-05 16:34:13 +02:00
Alexandru Croitor
afe158b936 CMake: Don't add no-prefix define to qconfig_p.h
It's unlikely that C++ code needs to query that feature. It also
causes full rebuilds of Qt if the feature's value is toggled.

Remove the no-prefix define from qconfig_p.h.

Pick-to: 6.5 6.6
Task-number: QTBUG-116689
Change-Id: I7d968b1c3d6bff3653e1233cea09a36579776347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-05 16:33:40 +02:00
Marc Mutz
5a96d13bb5 QCheckBox: add new checkStateChanged(Qt::CheckState) signal
... to replace the old stateChanged(int) one, which a) had the wrong
name and b) the wrong argument type.

Mark the old one as \obsolete, so new users don't see it
anymore. Prepare for deprecation in the test, but don't actually
deprecate, yet (this author does not know how to deprecate signals).

Found in API-review.

Amends 37b47ebf94.

As a drive-by, replace explicit qWait() calls with QTRY_COMPARE().

[ChangeLog][QtWidgets][QCheckBox] Added new
checkStateChanged(Qt::CheckState) signal, obsoleting
stateChanged(int).

Fixes: QTBUG-104688
Change-Id: I01791fd003b752c47d99bea65151202be9175c21
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-05 13:43:44 +00:00
Giuseppe D'Angelo
4367abb75a QHostInfo::lookupHost: enable QT_NO_CONTEXTLESS_CONNECT
QHostInfo::lookupHost uses some QObject private APIs in order to have a
invoke a slot/function when the lookup is finished. The overload that
simply takes a function (and not a context object) was still available
even under QT_NO_CONTEXTLESS_CONNECT, because indeed the implementation
bypasses the public QObject::connect API. Hence, explicitly the overload
that doesn't take a context object.

Change-Id: Ibf5b0efc49b7f9c8d045862ae061f4e05ee1b769
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-05 15:00:38 +02:00
Dennis Oberst
c8be7c6a6c tst_QString: assign(it,it) add test-cases for empty range
Pick-to: 6.6
Change-Id: Iaf2ddb247aa279166110ad8793b1e37e66e8b11b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-05 15:00:38 +02:00
Marc Mutz
1c1d7ab486 Clean up inline keyword use in qstring.h
If an inline member function is defined outside of its class' body,
its declaration must have the inline keyword. Otherwise, in certain
situations, MinGW complains like this:

   qstring.h:1118:13: error: 'void QString::clear()' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]

Fix all instances in qstring.h by

- adding the inline keyword where it was missing on the definition
  (except constexpr functions, which are implicitly inline)

- removing the inline keyword from all out-of-class-body definitions

While the latter isn't necessary for fixing the MinGW
warning-turned-error, the churn is warranted: It's enlisting all
platforms' help in checking for inline consistency (by causing
"multiple-definition errors" at link time or "inline function never
defined" at compile time when we get it wrong). If we kept the inline
keyword on the definitions, only MinGW would continue to warn, and only
in some, as of yet not fully understood, situations, so we'd have no
control over when these warnings pop up in user code.

Pick-to: 6.6 6.5 6.2
Change-Id: I0ae78f1d8f1fa4eaec0b162ea16013669370eead
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-05 13:00:38 +00:00
Dennis Oberst
3652cdf6c7 Update bundled zlib to version 1.3
zlib 1.3 has been available since August 18, 2023.

Version 1.3 now defines the following:

 #  define crc32_combine_gen     z_crc32_combine_gen
 #  define crc32_combine_gen64   z_crc32_combine_gen64
 #  define crc32_combine_op      z_crc32_combine_op

We patched those in manually with qtpatches.diff, so we update it to
reflect these changes.

Updated the diff with 'git diff --relative > qtpatches.diff' from within
the 3rdparty/zlib directory.

Since updating zlib always requires some manual intervention add a
minimal guide that will be printed on using import_from_zlib_tarball.sh.

As a drive-by fix an error in import_from_zlib_tarball.sh where passing
in a path already containing a backslash as:

 import_from_zlib_tarball.sh zlib-1.x/ ./

would append another backshlash to that path (zlib-1.x//). Furthermore
add the '-v' flag to the copy command to make it more verbose.

[ChangeLog][Third-Party Code] zlib was updated to version 1.3.

Task-number: QTBUG-116236
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ib7c8698035e1e049b455308c5774fcaf88b7622a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-05 13:42:50 +02:00
Christian Strømme
9c3c87f6d0 Add enablers to expose semi-public APIs for QtQuick3D
Follow the same patterns as for qpa and rhi. Semi-public APIs will be
put under the "namespace" ssg which is short for Spatial Scene Graph.

Taks-number: QTBUG-116570
Change-Id: I38887f129ec90e67f6a929a0d8ea5ea8b8c49ee8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-05 13:42:50 +02:00
Ilya Doroshenko
1eb15adee3 Add stereo support for DirectX12 and Vulkan backends
Change-Id: Id12723d6c392e25935ccb265c58af91aff968984
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-09-05 10:28:42 +00:00
Giuseppe D'Angelo
91dcc76fc1 QProcess: zero-fill a struct sigaction
Otherwise valgrind (rightfully) complains:

==75693== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
==75693==    at 0x597E5F3: __libc_sigaction (libc_sigaction.c:58)
==75693==    by 0x5105CE4: QtVforkSafe::change_sigpipe(void (*)(int)) (qprocess_unix.cpp:145)
==75693==    by 0x51083AA: (anonymous namespace)::QChildProcess::startProcess() const (qprocess_unix.cpp:911)
==75693==    by 0x5106442: (anonymous namespace)::QChildProcess::startProcess(void*) (qprocess_unix.cpp:330)
==75693==    by 0x5A61BB3: clone (clone.S:100)
==75693==    by 0x1FFEFFE3DF: ???
==75693==    by 0x857E86F: ???
==75693==    by 0x1FFEFFE3EF: ???
==75693==    by 0x5102C09: std::tuple_element<0ul, std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > >::type const& std::get<0ul, QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> >(std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > const&) (tuple:1796)
==75693==  Address 0x1ffeffe148 is on thread 1's stack
==75693==  in frame #0, created by __libc_sigaction (libc_sigaction.c:43)
==75693==

Change-Id: Ib5a18fb76f2b7c2c1604e73ff64a251a0418c63c
Pick-to: 6.6 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-05 12:28:42 +02:00
Jaishree Vyas
ce47799de6 Doc: Add example categories for qtopengl
Task-number: QTBUG-116069
Pick-to: 6.5 6.6
Change-Id: If675124e538c197d3b446f09da0620718b7b7118
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-09-05 12:28:42 +02:00
Santhosh Kumar
4cf92d83c3 Reset palette resolve mask in windows vista style
The palette set by windows vista style during polish doesn't allow style-
sheet style to override it.

This patch reset resolve mask for the palette set by windows vista style
and thus it can be overridden.

Fixes: QTBUG-115511
Pick-to: 6.6 6.5
Change-Id: Ifcaf441f806cfa0273599b3dce83fdfaec3f5a66
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-09-05 10:59:00 +02:00
Mats Honkamaa
7ef93cbf68 Doc: Add example categories to Qt Widget examples
Added example categories and fixed some minor typos as well.

Task-number: QTBUG-116359
Pick-to: 6.5 6.6
Change-Id: I2e270a1919003f4cea233666b64437e4c2b77121
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-05 07:47:49 +03:00
Ahmad Samir
0ce51dee0e tst_QDnsLookup: fix typo in CMakeListst.txt
There was an extra `q` before dnslookup.

Found while trying to build tst_qdnslookup, the target wasn't seen by
CMake/Ninja.

Pick-to: 6.6
Change-Id: Id594aab30dc9081fc269541561e0f2db5e615657
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-04 14:17:12 -07:00
Ilya Fedin
d524f0a756 QGenericUnixServices: ensure xdg activation token callback is called
The callback doesn't get called if the signal is emitted immediately
or if hitting the early returns

Fixes: QTBUG-113995
Pick-to: 6.6 6.5
Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8
Reviewed-by: David Redondo <qt@david-redondo.de>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-09-05 00:57:47 +04:00
Ahmad Samir
9b40272562 tst_QDnsLookup: skip a unittest on Windows
See code review 496440 on Gerrit for the details.

Change-Id: Ibd32a44cf7e2e07f36687cc2f0eeaf3008f64e73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 22:40:35 +03:00
Ahmad Samir
909893344c tst_qeventdispatcher: port to QDeadlineTimer
Easier logic for these use-cases.

Change-Id: I97a18c45d9bd8cfcfee5d379d271366276d5a435
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-04 22:40:35 +03:00
Anton Kudryavtsev
6d4385b697 qplatformpixmap: use rvalue overload more
to reuse internal buffers

Change-Id: I7cfd6b599912cc38f796356197748f97da3eb47d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-09-04 18:16:47 +03:00
Anton Kudryavtsev
470fab51fb Tidy up QAuthenticatorPrivate::calculateResponse
call toBase64() with temp value

Change-Id: Idedfd91f60900ec51923803a6bb9ed6631e64d94
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-09-04 18:16:28 +03:00
Anton Kudryavtsev
b4f6399a51 qauthenticator: use QBAV more
Change-Id: Iaa208785f6e1dc8eb5f32ab5e099c8df277bb2f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:16:11 +03:00
Anton Kudryavtsev
50fa7996d0 qhttpnetworkconnection: extract method makeAcceptLanguage
and micro optimize it:
- avoid allocation in case of C locale
- don't call replace in case of C locale

Change-Id: I9afefd53b673e5f1236afdb3130d77779614acc7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:16:08 +03:00
Anton Kudryavtsev
43d15dd572 qhttpnetworkconnection: cache acceptedEncoding header
Encodings are configured at compile time, so no need to re-create acceptedEncoding header for every request, just cache it.

Change-Id: Ibfaf7cdec0504cf90c4b6a59848e7c945d060ebe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:16:06 +03:00
Anton Kudryavtsev
5f032cdeff QDecompressHelper: port some methods to QBAV
Change-Id: I907019f19cbf4f6086fd6480ea9e01f5ab63b004
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:16:03 +03:00
Anton Kudryavtsev
d9620f0660 qnetworkcookie: reduce allocations
Use CaseInsensitive compare more.
While touching code, replcace QBA literal with QBAV

Change-Id: Iecd2740c995f1e24b4285440b9440e4745f93208
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:16:00 +03:00
Anton Kudryavtsev
4ee081c2f7 qauthenticator: reduce allocations in parseHttpResponse
by QBAV usage. While touching code, port index based loop to range based

Change-Id: I06a784b94678b901d1074cca224c926e8534bd8e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-09-04 18:15:48 +03:00
Ievgenii Meshcheriakov
a296f091c5 QDBusConnectionPrivate: Remove duplicated public sections
Seeing a public keyword may make the reader mistakenly
believe that the section above is not public.

Change-Id: I074d54ed5f6a5b5911d4c6038d33e14d2c58abe0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-04 12:03:07 +02:00
Mårten Nordheim
6577242adf tst_QString: deduplicate datatags
By saying what's special about some of them

Pick-to: 6.6 6.5
Change-Id: I17bf2e12a27bf55f621020ddf3819ee9e606847d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-04 12:00:48 +02:00
Laszlo Agocs
7fbccd1900 QOpenGLWidget: Call glClear in the default paintGL implementation
Amends 8cc8bbb466.

With the referenced patch framebuffer invalidation is preferred
over clearing with a wider range of OpenGL implementations.
This is good and is in line with the documentation. If an existing
application does not do glClear() in their reimplemented paintGL(),
that we cannot fix, and the docs never actually promised that a
glClear() is done automatically.

However, there is a special case: when one does not reimplement
paintGL(). A QOpenGLWidget is expected to be usable without
reimplementing any of its virtuals (i.e., QOpenGLWidget is
constructible as-is without subclassing). It is then ideal
if this does not lead to showing rendering artifacts due to
having potentially random content in the (invalidated,
not cleared) color buffer. This problem was never encountered
before due to hitting the invalidate-instead-of-clear code path
on a limited set of platforms (like with OpenGL ES) only.

Do a glClear() in paintGL(). This won't effect the vast majority
of applications, that reimplement this function, but plays nice
for when it is not.

It is in fact also in line with Qt 4's QGLWidget: that also used to
do a glClear() in the default paintGL() implementation.

Change-Id: I117ce1d3340f6d4d82cde1f52769a3b13ce367fb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-09-04 11:46:29 +02:00
Laszlo Agocs
9505305c40 Use linear filtering again when QT_WIDGETS_HIGHDPI_DOWNSCALE
In ec27b99c2a the filtering mode is
changed from Linear to Nearest since users encountered obscure cases,
in particular when multisampling with large sample counts got enabled,
where the different filtering mode becomes noticeable. (Qt 5 and Qt 6
up until 6.4 uses Nearest, whereas the OpenGL -> QRhi migration
introduced using Linear in 6.4)

Meanwhile, the as of now undocumented high DPI downscaling feature
got introduced, and that prefers linear filtering. (since that's
definitely not a 1:1 mapping when it comes to texture size and the
on-screen quad) To reconcile the differences, add support for both
kind of samplers, and choose based on the sizes.

This should have no effect when not running with the env.var.
QT_WIDGETS_RHI=1 QT_WIDGETS_HIGHDPI_DOWNSCALE=1 set, but should
restore the pre-6.5.2 look when they are set.

Pick-to: 6.6 6.5
Fixes: QTBUG-115461
Change-Id: I42eb8526cb7f74236b5550e26c4570771d2fbfb4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-09-04 11:46:13 +02:00
Thiago Macieira
961620824c QArrayData: make calculateBlockSize() account for the extra null element
Instead of adding it after the block size was calculated. This makes no
difference for non-growing (exact) blocks. For growing blocks, this
means we take that extra element into account before rounding to the
next power of two, instead of after. That results in a change of the
thresholds of when a block grows and also what capacity it will
contain.

For example, for a QString growing to 22-25 elements:

      Request     |       Previously        |           Now           |
elements |  bytes | malloc()ed | capacity() | malloc()ed | capacity() |
    22   |    44  |        66  |        24  |        64  |        23  |
    23   |    46  |        66  |        24  |        64  |        23  |
    24   |    48  |        66  |        24  |       128  |        55  |
    25   |    50  |       130  |        56  |       128  |        55  |

To avoid wasting elementSize - 2 bytes in this footer, we only include
this footer if elementSize <= 2. Thus, for a QList<int> growing to 11-13
elements:

      Request     |       Previously        |           Now           |
elements |  bytes | malloc()ed | capacity() | malloc()ed | capacity() |
    11   |    44  |        66  |        12  |        64  |        12  |
    12   |    48  |        66  |        12  |       128  |        28  |
    13   |    52  |       130  |        28  |       128  |        28  |

In both cases, we now only allocate powers of two while growing, which
may be beneficial to some allocators.

Pick-to: 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177dcb96e251d0a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-03 17:43:24 -07:00
Ivan Solovev
d752da1857 QAnyStringView: fix construction from QL1SV for bootstrapped builds
The SizeShift was not taken into account when constructing QASV from
QL1SV. This is not an issue in normal Qt builds, because SizeShift == 0
there.
But in bootstrapped case (and in future Qt 7) SizeShift changes to 2,
and the bug becomes visible.

The added test-cases do not really reveal the issue, because we do
not run tests in bootstrapped builds, but at least they will help
to prevent the issues in Qt 7.

Pick-to: 6.6 6.5 6.2
Change-Id: I337b37b5230323a5357f48fd1c9bf799ca507d52
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-03 18:22:06 +02:00
Ivan Solovev
d85663ced8 QDBusServiceWatcher: fix binding loops
This class has two bindable properties - watchedServices and watchMode.
What makes this class non-trivial is the fact that these properties
depend on each other - setWatchedServices() need an up-to-date
watchMode to set up the services, and setWatchMode() needs an
up-to-date list of services in order to update the mode on them.

Update the setters in such way that they remove the bindings from
the updated property, and at the same time trigger the re-evaluation
of the property they depend on.
This includes refactoring of the helper setConnection() method in such
way that it does not cause property re-evaluation, and also update
of the {add,remove}Service() helper functions to take the watchMode as
an input parameter.

The public {add,remove}WatchedService() methods were updated similarly.
The logic of the removeWatchedService() method was additionally
updated to do some changes to the properties only if the
service-to-be-removed actually existed in the list.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: If46cf926c7ace9dc4893d8daaef088f61e41c21a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:21:18 +02:00
Ivan Solovev
1ad424aed5 QLocal{Socket,Server}: extend the test coverage for property bindings
The pre-existing test for QLocalServer was testing only a minor subset
of cases, so replace it with the call to
QTestPrivate::testReadWritePropertyBasics.

The test for QLocalSocket's bindable properties was missing, so add
it.

The new tests didn't reveal any problems.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I695bb050d39eeae9ffb84c097c36601a4ca89af6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:20:59 +02:00
Ivan Solovev
96a62cd1f5 tst_QDnsLookup: extend test coverage for property bindings
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I51a17974a7f5bec3c969fcb55b6f28e3e9218eb5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-03 18:20:56 +02:00
Ivan Solovev
ac59fcdab8 QStandardItemModel: extend the test coverage for property bindings
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I360614a40fe2bacb796051607ed67e7e666b4f22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:20:54 +02:00
Ivan Solovev
7d70edd31c QTimer: extend property tests and fix binding loop
The bindable property tests were not using the QTestPrivate helpers, so
add a new test which uses them.

The new tests revealed a binding loop for the interval property.
Fix it in a usual way by explicitly removing the binding and using
{set}ValueBypassingBindings() in the setter.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: If94f57938da449a68e3527aead5ebd55ba410adb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-03 18:20:51 +02:00
Ivan Solovev
cdb50edc98 tst_QMovie: extend the test coverage for property bindings
The old tests were not using the test methods from QTestPrivate, so
add another test case.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I291ede26461e79a615630f1decad2ad7549b4dd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:20:48 +02:00
Ivan Solovev
2ef65f895b QSortFilterProxyModel: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: Ibbad552fa1e611f4bb704b4e47667df5f328f152
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:20:45 +02:00
Ivan Solovev
6a873778b9 QAbstractProxyModel: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

This commit is mostly trivial.
Had to change the template parameters in the unit-test, because the
updated QTestPrivate::testReadWritePropertyBasics() creates an instance
of the TestedClass, and QAbstractProxyModel cannot be instantiated,
since it has pure virtual methods.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I0cae29263ea9bb92c9de06891b0ba8633fb9fd72
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-03 18:20:33 +02:00