Commit Graph

55150 Commits

Author SHA1 Message Date
Andreas Buhr
21ce257b6c Repair tst_qcoreapplication to not segfault on Android
tst_qcoreapplication.cpp is used both in tst_qcoreapplication and
tst_qguiapplication. To distinguish these two compilations,
the define QT_GUI_LIB was used. This led to an error on Android,
where Qt::Gui is always linked, because the Qt Android Platform
Plugin needs it.
This patch introduces the preprocessor define QT_QGUIAPPLICATIONTEST
which is to be used only in the compilation of tst_qguiapplication.
This is then used instead of QT_GUI_LIB.

Change-Id: Ifa5bfacb197d68365288c1da85573106515fc6c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-15 09:10:59 +01:00
Joerg Bornemann
da27a95aab Compile QNetworkAccessDebugPipeBackend only in developer builds
This fixes a moc warning in non-developer builds.

Change-Id: I879a17715fd682382ce47ce4cfd7e162f8ceb2de
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-15 09:10:59 +01:00
Björn Schäpers
c6808d4296 configure: Fix -redo when configure line contained equal sign(s)
If the original configure arguments contained equal sign(s) like in
    configure ... -- -DQT_BUILD_SUBMODULES=qtbase;...

The following error message was printed:
    =qtbase was unexpected at this time.

The reason is that the conditional
    if "%rargs%" == ""
would expand to something like
    if ""-DQT_BUILD_SUBMODULES=qtsvg"" == ""
which is invalid, because the equal sign is used outside of a string
literal.

Use delayed expansion in the conditional to fix this.

Pick-to: 6.2 6.3
Change-Id: I8c40d799db2c5aae8cba190ed31804c71a605935
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-15 08:08:48 +00:00
Marc Mutz
3ec76f82ba QBitmap: de-inline dtor
The destructor of this polymorphic class was incorrectly marked for
removal in Qt 6, and, unfortunately, that was carried out. Now it
delivers one of the most-duplicated vtables across all of Qt (at least
four duplicates), and we can never add anything to it until Qt 7
(because existing code de-virtualized it as a no-op).

Task-number: QTBUG-45582
Pick-to: 6.3
Change-Id: I85bd3b13dca9f1fc8cb62ca079a1168a33f71323
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-15 09:08:16 +01:00
Marc Mutz
9b6c288281 De-duplicate vtables, 2022 edition
This de-inlines destuctors of classes whose vtables are proven to be
duplicated even within the set of Qt libraries.

Since these are all private API classes, we can pick all the way back
to 6.2, and we don't need the comment that the dtor must always stay
empty, like for public classes.

As a drive-by, also de-inline the QPaintDeviceWindowPrivate ctor.
That's just code hygiene, it doesn't partake in vtable duplicating.

Pick-to: 6.3 6.2
Task-number: QTBUG-45582
Change-Id: I3477063d6f42edc9a5d352c47900366fd50c3ef6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-02-15 09:08:16 +01:00
Yin Jie
60a67dc41e Position QCompleter popup based on the widget's screen geometry
If adding a QLineEdit to a QGraphicsScene as a QGraphicsProxyWidget, the popup
completion of that QLineEdit is drawn in the wrong location. When the completer
getting the rect of screen, it gets the rect of the QGraphicsScene where
QLineEdit is located rather than the rect of the screen, resulting in an error
in the following calculation.

Note that as long as the completer popup is a toplevel widget not parented
to the target widget, it will not be automatically embedded into the graphics
view via QGraphicsProxyWidget. So with multiple views for a scene, or in views
that use transformations, the geometry will still be off.

Pick-to: 6.3
Task-number: QTBUG-20531
Change-Id: If5d8a707ca35a9e4709117b077978145c6143e46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-15 01:28:30 +00:00
Andreas Buhr
936771d901 Activate tst_QFutureWatcher for Android
tst_QFutureWatcher was deactivated for Android. This patch activates it.

Fixes: QTBUG-88136
Change-Id: Iead82e22d73eb15c9ecd2756eb33925910bbffc0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-02-15 00:42:29 +01:00
Tatiana Borisova
23fd249b85 Exclude denormal test cases if system doesn't support it
- current INTEGRITY development pack don't support denormals for float and double.
  All values are rounded to 0.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Iaaacdc4210c7ac2ec3ec337c61164a1ade0efb01
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-15 00:48:23 +02:00
Viktor Arvidsson
7794421bea Windows QPA: Correct mistake when calculating minmaxinfo
Amends 46e9852a1d

The previous code would fail if the windows taskbars are placed
to the top or left on the screen. The mistake was missed because
Windows seems to adjust the window position automatically
in case the window handles WM_NCCALCSIZE and returns 0,
which was the case for me.

Task-number: QTBUG-51327
Pick-to: 5.15 6.2 6.3
Change-Id: I38ef974f7518be63a0bacf080f3359c219284078
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-02-14 23:48:23 +01:00
Øystein Heskestad
c6958cbbd6 Add new third party SHA-3 implementation to replace old obsolete one
[ChangeLog][Third-Party Code] Added new SHA-3 implementation to Qt Core.
The code is available under BSD 3-Clause "New" or "Revised" License.

Task-number: QTBUG-71327
Change-Id: Ib1f1003b0ef7e6f6c3787cbbd45f3f06fc667b7e
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-02-14 17:32:14 +01:00
Andreas Buhr
d456102962 Make Droid Sans Mono available as fixed font for all Android styles
Fixes: QTBUG-87405
Change-Id: I54ebc06c82c32acd0383ea5fedf78acce4e11977
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-14 16:22:28 +01:00
Marc Mutz
40e2bf3495 QFlatMap: temporarily disable some code
... which implements or assumes something about the
broken^Wnon-STL-compliant insertion behavior.

Once this has integrated into all module dependencies, we can
re-implement these APIs using STL-compatible semantics.

Task-number: QTBUG-100092
Change-Id: I54f4f5ce7addd9543866d2c399f48aff50983b88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-14 13:20:03 +01:00
Dimitrios Apostolou
c37d0e84bc Clean up QNX platform configs and improve testrunner scripts
QNX requires its own TESTRUNNER script in order to SSH to the QEMU guest
and run the tests. Simplify it a lot and fix the way it passes arguments
so that they retain spaces and quotation.

Also wrap it with the generic TESTRUNNER script for CI, which is
qt-testrunner.py, so that tests can re-run in case of flakiness.

Delete prefix.sh as the environment variables are now properly set in
the Coin platform config files.

Avoid executing extra chmod commands to make scripts executable,
but use the right Coin instruction for that. For reference, we
use 493 for file mode which equals to 755 in octal, as Coin expects
the file mode in decimal.

Change-Id: Ife4d1caef606f48b92ba1da1cfb14ec0dea11ef2
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
2022-02-14 12:56:06 +01:00
Eskil Abrahamsen Blomfeldt
d6c4a3edf9 Fix integer overflow for broken QPainterPaths
With some bogus input, we can end up with NaN in the
bounding rects of the control points. This in turn
causes problems later when it is converted to ints
and used in code. To avoid it, we exit early if the
rect is invalid (negative or NaN size).

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-100217
Change-Id: Idbc6700b85cb30198d69fedbf8f3be3e1ab65e40
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-02-14 12:51:10 +01:00
Kai Köhne
8275611766 Core: Remove 'properties' feature
Even QtCore alone cannot be built without the properties feature since
Qt 5.5. While fixing this is easy, other modules like dbus,
networking are also using QObject::property() and friends liberally.

All in all I doubt that anybody will miss the feature (otherwise it
would have been fixed in the last decade).

Change-Id: Iaf3cc20bda54ee2ff3b809fac8fa82b94ecc88c0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-14 12:50:59 +01:00
Ivan Solovev
b99fdae5f5 Android A11Y: populate child elements when constructing node info
This commit partly reverts 020a6f0dae.
It restores the code that is responsible for filling the children
for individual elements. Without this code, we have only top-level
element and its children in our accessibility hierarchy.

Fixes: QTBUG-100545
Pick-to: 6.3 6.2 5.15
Change-Id: I0604bbf5f1bdb0b3998a25fec7ed0a1fe554da8d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-14 09:34:36 +01:00
Marc Mutz
c8e03f129e QHashSeed: remove 'pure' attribute on globalSeed()
While 'pure' in GCC is weaker than Stepanov's Regular Procedure from
Elements of Programming (equal result for equal inputs), it does not
allow accesses to volatile memory:

> functions declared with the pure attribute can safely read any
> non-volatile objects

The globalSeed() function reads from an atomic variable that can be
changed at any time from another thread.

Atomics, while not volatile objects in the sense of the keyword, must
fall under the pure attribute doc's exclusion criterion:

The difference between a volatile and an atomic access, while
important for the implementation of the function, is indistinguishable
to the caller of the function: both volatile and atomic objects can
change value without the current thread of execution changing them,
with no way for the caller of the function to distinguish which one
occurred.

Therefore, globalSeed() should not be pure.

5.15 is not affected, as qGlobalQHashSeed() is not marked as pure.

Task-number: QTBUG-62185
Pick-to: 6.3 6.2
Change-Id: I6fc52e2bd41ef4aa3f8039072b47c7a1314b98fa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-12 12:39:52 +01:00
Marc Mutz
b5c4d1f50b QPkmHandler: make const what it never modified
Pick-to: 6.3 6.2 5.15
Change-Id: I0bda0d93ebe60d4923f3e9eb059cddb61192b1b5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-12 12:39:52 +01:00
Marc Mutz
f482e2a456 QDesktopServices: fix ABA problem in QOpenUrlHandlerRegistry
The registry is designed to be thread-safe, as is openUrl(), and
handlers are required to be thread-safe, too: "the handler will
always be called from within the same thread that calls
QDesktopServices::openUrl()".

The handlerDestroyed() slot was invoked using AutoConnection
semantics, which, if the registry and the handler happen to not be on
the same thread, is QueuedConnection, which means there's a window in
which the handler is destroyed, but it's still listed in the registry,
and a call to openUrl() may make a call to the (deleted) handler.

Worse, if a handler is deleted and new one registered they may end up
on the same address (ABA, or rather, AA problem), and then the delayed
call to handlerDestroyed() may remove the entries to the new handler,
as well as those to the old.

Fix by using Qt::DirectConnection. This fixes the ABA problem, but
doesn't completely fix the partially-destroyed problem, since
QObject::destroyed() is simply too late. We need to require explicit
unsetUrlHandler() calls, which should happen before destruction of the
handler object starts.

[ChangeLog][QtGui][QDesktopServices] Fixed a bug where destroying and
re-creating a handler object in quick succession could cause the
registration for the handler to be lost.

Fixes: QTBUG-100778
Pick-to: 6.3 6.2 5.15
Change-Id: I76fd81724504cc7f38ac262b43e3e9539fe5ebca
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-12 11:39:52 +00:00
Marc Mutz
42e13b7c61 QDesktopServices: fix UB (data race on handlers)
The handlerDestroyed() function is connected to the handler QObject's
destroyed() signal and removes all entries from the registry for which
the destroyed object was listed as the handler.

While handlerDestroyed() is always executed in the context of the
thread owning QOpenUrlHandlerRegistry-as-a-QObject, the documentation
explicitly states that "the handler will always be called from within
the same thread that calls QDesktopServices::openUrl()", implying that
calling openUrl() from a non-GUI thread is supported. The presence of
the mutex also indicates that this should work.

But then the unprotected access to the handlers variable in
handlerDestroyed() is a data race, because nothing prevents a handler
object from being destroyed concurrent to an openUrl() call.

Fix by locking the mutex.

Fixes: QTBUG-100777
Pick-to: 6.3 6.2 5.15
Change-Id: I9ef857efa609b4d16ee21063ccccd316e119576b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-12 12:39:51 +01:00
Thiago Macieira
4fd4082c3a QStringView: add missing constexpr so we can use is_constant_evaluated
GCC 12 -std=c++20 says:

 qstringview.h:155:39: error: ‘std::is_constant_evaluated’ always evaluates to false in a non-‘constexpr’ function [-Werror=tautological-compare]

With this, it's possible to declare:

  constexpr QStringView sv = u"Hello, World!";
  QStringView f() { return sv; }

And GCC will generate:

        movl    $13, %eax
        leaq    .LC0(%rip), %rdx
        ret

Writing simply
  QStringView f() { return u"Hello, World!"; }

Causes GCC to emit a comparison loop (the std::char_traits::length
function), but at least there's no function call in either C++17 or
20. Clang 13 is able to reduce the loop to a constant and produces the
same code as the constexpr variable in either mode.

Pick-to: 5.15 6.2 6.3
Change-Id: I74249c52dc02478ba93cfffd16d282fa35a5b883
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-12 07:59:32 +00:00
Mårten Nordheim
98de89cc15 tst_QSystemSemaphore: give proper path to test-helper
Amends 29fceed2ff

Pick-to: 5.15 6.2 6.3
Change-Id: Ie386d3af68e4dff84ae893cd24cb96caf2d8e08e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-12 00:01:08 +01:00
Ilya Fedin
bc3723d462 Make indicator-application hack work in flatpak
Flatpak doesn't share $XDG_RUNTIME_DIR with the host making
QSystemTrayIcon not to work on Xubuntu/Ubuntu MATE/Ubuntu Budgie.

Although, it shares a subfolder, according to
https://docs.flatpak.org/en/latest/sandbox-permissions.html

Amends 0baa26638d

Pick-to: 6.3 6.2 5.15
Change-Id: I2d0043fc5a4c2c51e8fa1a920f3cada3b07eba6d
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
2022-02-12 03:01:08 +04:00
Viktor Arvidsson
46e9852a1d Windows QPA: Fix frameless maximize on secondary screens
Frameless windows shouldn't cover the taskbar when maximized.
This has been fixed for the main screen in the past but did not
work for secondary screens. According to the code the MINMAXINFO
is only available for the main screen but I believe this is a
misunderstanding of the Windows documentation.  Besides
we use QScreen::availableGeometry() which seems to be correct.

Fixes: QTBUG-51327
Pick-to: 5.15 6.2 6.3
Change-Id: Ib2205c480359d1a870dcfcf0312fbe417f650e28
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-02-11 23:05:20 +01:00
Christian Heimlich
cc70c397ce Update MSVC qmake mkspecs to make -std:c++20 available for VS2019 16.11+
Set QMAKE_CXXFLAGS_CXX2A variable to -std:c++20 while building projects
with qmake and MSVC 16.11 or greater (_MSC_FULL_VER >= 192930133), when
c++2a is specified in the project config.

Pick-to: 6.2 6.3
Change-Id: If9a48d1ed16cb05c5cc01414ce8a4344e22438fe
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-02-11 22:05:20 +00:00
Allan Sandfeld Jensen
c0af004d74 Fix build with C++20 on macOS
The macOS standard library doesn't have std::contiguous_iterator yet, and
it doesn't seem like libc++ has it either.
Checking __cpp_lib_concepts for the C++20 official version appears to work.

Pick-to: 6.3 6.2
Change-Id: I8c31cd64de24c03b3a3f37cb393bb2f9b55a834d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-11 22:56:35 +01:00
Allan Sandfeld Jensen
a0d1f6b5aa Remove documentation of non-existing QAccessible state
invalidEntry is commented out

Pick-to: 6.3 6.2 5.15
Change-Id: Iffb661ec85b1b633f56c9aba94c1f0727a93c987
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-11 22:56:35 +01:00
Thiago Macieira
47cf674477 QTimerInfo/Unix: Fix roundToMillisecond when it's already rounded
Don't add 1 ms when it's rounded to 1 ms.

Found when running unit tests on QNX, where the clock did not update
between two subsequent calls to clock_gettime().

All of this ought to be refactored to use std::chrono::nanoseconds.

Fixes: QTBUG-100438
Pick-to: 6.2 6.3
Change-Id: I47dc6426c33d3a66dec946ae3589694745ed1835
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-11 13:02:35 -08:00
Sona Kurazyan
407d076124 Remove mentions of QtConcurrent::runWithPromise from docs
cf043a785a unified QtConcurrent::run() and
QtConcurrent::runWithPromise(). Remove the last mentions of
runWithPromise. Also did some minor cosmetic improvements.

Pick-to: 6.3
Change-Id: Ie3b39600978ccfa4a009d3ff68567a348dc7b166
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-02-11 22:02:35 +01:00
Alexey Edelev
815bc61626 Cleanup tests that add test data to resources explicitly
Remove Integrity and Android specific code that explicitly adds
test data to the resource files. qt_internal_add_test functions
implicitly adds test data to resources for Android and Integrity
platforms by default.

Change-Id: Ia1d58755b47442e1953462e38606f70fec262368
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-11 21:54:44 +01:00
Alexey Edelev
fdf5d11ff6 CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test
Multiple tests use qt_internal_add_resource that copies the
functionality that is already implemented inside the
qt_internal_add_test function. Simplify these test by replacing
the qt_internal_add_resource call with the new BUILTIN_TESTDATA
option.

Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-11 21:54:44 +01:00
Mårten Nordheim
52492ff720 HTTP: Make redirect response parsing more generic
To enable its use in the http2 protocol handler.
This factors out the error-reporting code for HTTP 1, which in
any case has to be done differently for HTTP 2, saving duplication
and simplifying the redirect handling code.

Task-number: QTBUG-100651
Pick-to: 6.3 6.2 5.15
Change-Id: I4b470646a9ad5ee702c9b1921d115e137d3d5b8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-11 21:54:44 +01:00
Alexey Edelev
eab5ec5a37 Strip the ending slashes for resource folders
Setting a value for the QT_RESOURCE_ALIAS source file property on a
path ending with a slash (a directory) is not handled properly by
CMake. This leads to unpredictable values being set for multiple
directories. Fix this by stripping the the final slash from the file
path, which makes CMake think it's a file rather than a directory.

Change-Id: I7a39be68e6f58bf2726c80108da9947057e7add6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-11 21:54:44 +01:00
Allan Sandfeld Jensen
ace9764c99 Fix tst_qmath when compiled with C++20
On several platforms std::bit_ceil() returns 1 for input values that
would overflow the output. Our test expects 0 though. Since the value
is documented as undefined, avoid it.

Pick-to: 6.3 6.2
Change-Id: I00556893a8f0e1e24f08f73cd112b56148bc5bd0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-11 20:47:21 +01:00
Ievgenii Meshcheriakov
4082fe8a39 Make QProcessEnvironment(Initialization) noexcept
Use default noexcept constructor to initialize `d` member.
Document Initialization enum.

Fixes: QTBUG-100695
Pick-to: 6.3
Change-Id: I7585ad154a9be40021a205b515ffa7b14f188d67
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-11 20:47:21 +01:00
Morten Johan Sørvig
5958c28d9f wasm: improve qstdweb::EventCallback
We are storing a copy of the this pointer in the constructor,
and later deference it to access EventCallback object
memebers. This makes the class noncopyable: delete
the copy constructor to make sure it isn’t.

Also change the callback API to propagate the event
to the event callback.

Change-Id: Ida4bb192b3e905b260ebeec30293aad71b7d8c49
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-02-11 18:15:26 +01:00
Pino Toscano
7c54988b1b Avoid a stack buffer when not needed
Allocate a PATH_MAX-sized buffer on stack only in case we are not using
realpath(X, null), i.e. on platforms with older POSIX versions, macOS,
or Android.

This fixes the build on platforms that do not have PATH_MAX (e.g.
GNU/Hurd), and it provides a minor optimization on realpath(X, null)
platforms.

Change-Id: Icd92a1b15ec18c5eef8113408e9610dfac774101
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-11 15:36:02 +01:00
Christian Ehrlicher
15f7ef26b8 QMdiSubwindow: respect minimum size of subwidgets when shown maximized
Size a QMdiSubWindow is no real toplevel widget, QLayout::activate() did
not properly set the minimum size based on it's children. Fix this by
treating a QMdiSubWindow as a toplevel widget during the calculation.

Fixes: QTBUG-100494
Change-Id: Ia2e6c519c7214c36383facd244711bd932231d40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-11 07:03:24 +01:00
Qiang Li
d54bb53247 QPlainTextEdit: fix the visibility of placeholderText
If one calls setPlainText("") before setting a placeholder text,
the placeholder visibility is not updated, and the placeholder is not
visible. Fix it by updating placeholderVisible properly.

Fixes: QTBUG-96212
Pick-to: 5.15 6.2 6.3
Change-Id: I1bd3f0cb4c59973a847bcf3787e35d7c17b6d673
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-11 02:01:03 +01:00
Thiago Macieira
81b9ee66b8 QLibrary: Suppress GCC 12 warning about dangling pointer access
Introduced in commit d07742f333. Reported
by GCC 12:

qlibrary.cpp:672:9: error: dangling pointer to ‘candidates’ may be used [-Werror=dangling-pointer=]
  672 |         if (isValidSuffix(*it++))
      |         ^~
qlibrary.cpp:634:29: note: ‘candidates’ declared here
  634 |         const QLatin1String candidates[] = {
      |                             ^~~~~~~~~~

This is a false positive report because the lambda does not return a
pointer or iterator. But it's a good update anyway to keep the array
outside the lambda, so it won't be recreated every time.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104492

Pick-to: 6.3
Change-Id: I74249c52dc02478ba93cfffd16d230abd1bf6166
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-11 00:19:57 +00:00
Pino Toscano
0a41399c2d CMake: enable machine_tuple also on GNU/Hurd
On the Hurd there is the standard GCC toolchain, so it is possible to
query GCC for -dumpmachine.

Change-Id: Idc8e80c0937147a8ea656bc0320a83d647278455
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-11 00:31:30 +01:00
Alexandru Croitor
a844695e64 CMake: Fix incorrect link to 'Using qt.conf page'
Pick-to: 6.3
Change-Id: I469fc4adb8982e2bd3d38807950eb0c324c481a6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-10 20:45:38 +01:00
Thiago Macieira
5be4c5aa0f QHash: mark murmurhash() and siphash() hot and never-inline
Don't allow the compiler to inline them in qHashBits() because they
require a lot of register use and add to the hot code path to aeshash().

Now all calls in this function are tail calls.

Change-Id: I54f205f6b7314351b078fffd16cf7f2f97d99144
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-02-10 11:40:48 -08:00
Thiago Macieira
708de710f1 Disable URL support in the CBOR-JSON conversion in bootstrapped mode
We don't need it.

Pick-to: 6.3
Change-Id: I74249c52dc02478ba93cfffd16d1dfc0e88f55ef
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-10 11:40:48 -08:00
Thiago Macieira
5e378aaff6 QStandardPaths/Win: fix build with old MinGW SDK
...that may lack GetCurrentProcessToken. The definition in the new SDKs
is:

  FORCEINLINE HANDLE GetCurrentProcessToken (VOID)
  {
    return (HANDLE)(LONG_PTR) (-4);
  }

This is a partial revert of ae7e11e5c6.

Pick-to: 6.3
Change-Id: I74249c52dc02478ba93cfffd16d23c487229f95d
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2022-02-10 11:03:09 -08:00
Edward Welbourne
abf4175436 Use function-style casts in preference to C-style ones
In one case, cast an int to qsizetype rather than the other way round,
in order to compare them.

Change-Id: Id8dffe61f9565040f1a5ee24867956397f814a55
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
3acaf3160d Convert some if/else-if/else chains into switch()es
Some of the else if lines exceeded 100 characters, so should have been
split; and some lines already were split. So each whole chain should
have had braces on its bodies. Instead make it a switch, as this makes
it more evident what's going on in any case.  Furthermore, as each
branch did the same thing with dbType-specific strings, change to just
setting QLatin1String variables, so that the rest of the code needn't
be duplicated in each branch; it can simply be done once after the
switch, using the string's .arg() to embed fragments. In the process
break up the SQL query strings more gracefully, purge spaces just
inside C++ parentheses.

Change-Id: Ie26166e098ad74720bb6d7c4d9fe47718c33a13c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
35ec6283dc Convert some QVERIFY2() with useless messages to QVERIFY()
Telling us the condition tested should have been true is what
QVERIFY() does anyway, so don't go to the whole trouble of saying the
same thing - and wrapping it in in a QString() merely in order to then
qPrintable() it back out again, pointlessly converting a C-string to
unicode and back again.

At the same time, skip one other qPrintable(QString("...")) without
.arg() formatting; and change the check it's the message for to use
QL1S::arg() instead of QString::arg().

Change-Id: Ie71a79da8017916d301a38b69fc422e55a5a3649
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
3253037329 Suppress, and thus verify we do get, two warnings in tst_QSqlQuery
Expected warnings are clutter for anyone reding the output, so
suppress them when they're correct behavior.

Change-Id: Idf47ba4fab8069237067d9b20afef3041e0c2f8c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00
Edward Welbourne
9030ffdffb Use qScopeGuard() to take care of post-test tidy-up
Doing the tidy-up after the last check has the problem that it gets
skipped if any check fails, as the premature return skips the tidy-up.
In the process, added the missing tidy-up to prematureExec().

Repackage the code for one tidy-up as a named lambda so that the
duplicate can share it with the scope guard. Made some existing scope
guards const, while I was about it, so that the one that isn't -
because it gets dismiss()ed - stand out.

Change-Id: I96d6834d5d7675f15018169a7093b0211db6f8a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-02-10 19:20:59 +01:00