58022 Commits

Author SHA1 Message Date
Andreas Eliasson
58fc19b683 Doc: Only list qt core classes in qt core io group
The group page for Qt core classes related to I/O include classes from
other modules. Remove these classes from the group; it may confuse
the reader.

Fixes: QTBUG-110020
Change-Id: If7df85523ce6b3aa09605bd89d9899ce308d2671
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 76ecff6aebb35f4e39439aab8d18d828c3c8a1fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:52:12 +00:00
Marc Mutz
bb35230991 Q_APPLICATION_STATIC: add missing std::launder()
Unlike Q_GLOBAL_STATIC, a Q_APPLICATION_STATIC can be destroyed and
re-created multiple times (if QCoreApplication is, too). This means
we're basically in the std::optional case and require std::launder()
to avoid UB when the payload type has either of the following:

- a const member
- a reference member
- a vtable and different derived classes might be occupying the same
  space at different times

While we can probably exclude the latter, because we always construct
the same type, PlainType, in the storage, the first two can easily
happen.

Fix by adding the missing std::launder().

As a drive-by, remove the uneeded casting (and now launder()ing) of
&storage when passing to innerFunction(), which anyway takes its
argument as void*.

Amends 81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8, which changed
Q_APPLICATION_STATIC to use inline aligned_union storage instead of
the original implementation's unique_ptr.

Change-Id: I065bd33812a40195109bf11d5bc79975f2f87cd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c53fdcb5ee15c309ba68717fa6564dc1ff4b8618)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:45:40 +00:00
Thiago Macieira
02a03f28f5 QMimeDatabase: don't stat() something that isn't a local file
We must check that the path is an actual file on the filesystem before
using native APIs. This regression was introduced by commit
047d8f36de45ebb318726167f941b0dbc64754ba.

[ChangeLog][QtCore][QMimeDatabase] Fixed a regression from 6.4.0 that
made certain QMimeDatabase functions that inspected file contents to fail
on Unix systems, if the file was not a native file (e.g., a Qt resource).

Fixes: QTBUG-110707
Change-Id: I570832c9ac8b4e03bde8fffd173f7b4c6b164192
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 40dd38813cba4bc8425e846f220e358ffb0d19ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 20:17:36 +00:00
Sze Howe Koh
30786ef596 QAnyStringView: fix MSVC warning C4702
The previous fix attempt at 8ba8d1346a562347c398bdd0529d34f94f2ac698
does not work when C++20 mode is enabled.

MSVC optimizes away the "else" block but triggers warning C4702 on
"return true". Moving the return line into the "else" block ensures that
it is optimized away too.

Change-Id: I9ef02cd3631ff78091530b6fb2b91c2eddcbab5d
Fixes: QTBUG-104836
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
(cherry picked from commit 4bfdf6a3d156184579e9fc66224754a6e66159dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:53:41 +00:00
Samuel Mira
9b8777d493 Android: fix height calculation
The application height calculation relied on the Display.getMetrics to
obtain the size of the current app window. It works properly on stock
android and Samsung devices, but not on some Huawei and it's unknown on
other vendors. This patch changes the way the height and weight are
calculated by using the provided values.

Task-number: QTBUG-107604
Task-number: QTBUG-109268
Task-number: QTBUG-97503
Task-number: QTBUG-107923
Task-number: QTBUG-109351
Task-number: QTBUG-110501
Change-Id: I0b0d1a0e4688f10530054afd26e34f55a92ea2da
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 48ebd4e318d5fb2d7ffe4b8215cd16cf5638215e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 11:40:05 +00:00
Marc Mutz
aaf1381eab SQL/ODBC: fix some users of toSQLTCHAR() to not assume identical UTF-8/16/32 string lengths
We already fixed the implementation of toSQLTCHAR() in
66767eea46bea0f19f8ae5ad6ebc641d86867701 to not assume that a UTF-8 or
UTF-32-encoded string has the same number of code points as the
equivalent UTF-16 string, but it turns out that users of the function,
as well as other code, also failed to account for this.

This patch fixes callers of toSQLTCHAR() to use

    const auto encoded = toSQLTCHAR(s);
    ~~~ use encoded.data(), encoded.size() ~~~

(except we can't make `encoded` const, because the SQL API isn't
const-correct and takes void* instead of const void*) instead of the
anti-pattern

   ~~~ use toSQLTCHAR(s).data(), s.size() ~~~

As a drive-by:
- Extract Method qt_string_SQLSetConnectAttr()
  - skipping an unneeded .utf16() call (a NUL-terminated string is not
    required for calling toSQLTCHAR())
- de-duplicate some code in exec()
  - and make a comment there slightly more informative
- replace
  - NULL with nullptr
  - size() == 0 with isEmpty()
  - C-style with constructor-style casts

Change-Id: I3696381d0a93af8861ce2b7915f212d9e5e9a243
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 46af1fe49f7f419dc1b3231de9860e2da0ea48f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 08:05:39 +00:00
Friedemann Kleint
d4c76a683f Examples: Add missing include guards
Task-number: QTBUG-109394
Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ddb94dd7927126978fc2a620ebd91954e2f96862)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 20:52:02 +00:00
Axel Spoerl
379649dd8b Add right and middle mouse button to tst_QLabel::mouseEventPropagation
The test function used only the left button to test mouse event
propagation.

This patch adds the right and middle buttons to the test data.

Task-number: QTBUG-110055
Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 593ffd3859b2c80c498baf5323906a348de22b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Allan Sandfeld Jensen
802dfb1879 Avoid unneccessarily long text scans
Limit the scans to the processed length.

Fixes: QTBUG-109838
Change-Id: If4b19bf6f97d788d0a227af3a80962bef26016fd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7c84550f3bfdf93cb8a071e6bb23d54d57109e84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Ilya Fedin
a765c10436 Pass short time format to GetTimeFormat from GetLocaleInfo
TIME_NOSECONDS doesn't really switches to short time format,
just removes the seconds from long time format

Fixes: QTBUG-110627
Change-Id: Ie799958f3942c657f00bc8196588258661ddc1d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 763884cfb7be0cadd353cfa3b9b760d521851718)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Tor Arne Vestbø
8eee5acfb2 rhi: Remove manual release of autoreleased NSString
The [NSString stringWithUTF8String:] function returns an autoreleased
object, so we don't need to manually release it. Doing so results in
a crash when the surrounding autorelease pool is drained.

Change-Id: I3dca01e2771d4010e582c2bf770f3d2281343dc3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 780813d9b6bfc58aa45571c367071c3a44fb2b44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 13:46:11 +00:00
Axel Spoerl
28c0af6dc3 Revert "Fix tst_QWidgetRepaintManager on XCB"
This reverts commit f20f1c6b7c65285a78ae7381bd7d2d1a4bdc3d30.

Reason for revert: Intended fix didn't work

Change-Id: I527307ad9c82d2d591e32bea172b6fe54a628008
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-01 13:46:11 +00:00
Marc Mutz
ef3e5f0f98 ODBC SQL driver: fix conversion of QByteArray to QVLA<SQLTCHAR>
The QByteArray is assumed to contain an SQLTCHAR string (so, either
UTF-8, UTF-16 or UTF-32-encoded). Only in the UTF-8 case would the
size of the byte array be the same as the size of the SQLTCHAR string
in codepoints, yet the size in bytes is what the code passed to the
QVLA<SQLTCHAR> append() call, causing it to read past the QByteArray
buffer in the UTF-16 and UTF-32 cases.

Fix by properly calculating the string size from the size-in-bytes and
then memcpy()ing into the QVLA. We use memcpy() and not
QVLA::append(T*, n) because the QByteArray buffer need not be aligned
on an alignof(SQLTCHAR) boundary (certainly not since it gained the
prepend "optimization").

Change-Id: If3838c3dee89e6aca65541242642315b8e1fa6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c445ef0bae8b36ec4a742552f0ebd81a1a90723)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 13:46:11 +00:00
Nicholas Bennett
7253f6cac0 Docs:Android: Add docs notes about support for content Uris
Add some details about the support of Qt apis (QFile, QDir, QFileInfo)
for Android content uris.

Fixes: QTBUG-99664
Task-number: QTBUG-98974
Change-Id: I4b884623702ccad116d47049e34ccddfe21f83ca
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a0ca5f433fdc45e97e461ece2d9839eebd3c7ea0)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-01 13:46:11 +00:00
Tasuku Suzuki
481f1e1a75 Doc: remove {{ }} for an enum value
https://doc.qt.io/qt-6.4/qurlquery.html#encoding

Change-Id: I328274d37182d3884bc65b8bccfec5052c1dce8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b33016a4927e0b7df2b4183583b0b57719060e6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 10:20:54 +00:00
Mitch Curtis
041f440c6a Doc: explicitly mention C++ when discussing linking to C++ libraries
Fixes: QTBUG-108325
Change-Id: I7282c8a8df0bf8f403a4e7a9d4512e7bdf6c9979
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f2b22a2945e19b191a2299bc7d0ebcf4b2bf2c69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 10:20:54 +00:00
Vladimir Belyavsky
b75ab76624 Windows: fix warning on opening FileDialog after changing filters
Destroy native file dialog on Windows as soon as it closes.
Currently the instance of native file dialog on Windows may stay live
even when a FileDialog control was closed and won't be opened anymore
in the app session. At the same time, when the FileDialog is opened
again, the instance of native file dialog is recreated so we don't
need to keep previous instance, because this may lead to situation
when QQuickFileDialog configures old instance of the native dialog,
which is causing problems.

Fixes: QTBUG-61042
Fixes: QTBUG-77211
Change-Id: Ia537264e8494b83dec7d5139744838242b281f1f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de704b633d4f9469a868e86fc22b8d99ef61eacb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Inho Lee
ba259ef0f3 Free the GLX framebuffer configurations
Adds missing XFree for a glXChooseFBConfig

Change-Id: I4c30341f90666170dac5d90b0c65d1deff4e0818
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit da898fca026f629be0ed234f0a89a99bc662385d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Christian Ehrlicher
8be65ba913 QToolButton: Elide text when constraints prevent from showing whole text
Follow-up of b2a282d7c7b8f49819bbc86ed705980438ecb04b - elide the text
also when the QToolButton has no icon (=text only)

Fixes: QTBUG-64132
Change-Id: If4d3758452f37df411931a6628846988a3418d8e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 021906f6c985b838461d28c7f121d4c3bc7e6499)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Shawn Rutledge
cf2f8235d5 Make tst_QFocusEvent::checkReason_ActiveWindow pass on macOS
It seems that on macOS 13.2 and newer, it requires explicit activation,
just as on the offscreen and minimal platforms.

Task-number: QTBUG-110703
Change-Id: I519eec872505ea3673111ae300c2494113f85c36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 78ba5056e63c4fc6f61346807197920fb5049924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 05:23:37 +00:00
Thiago Macieira
e9b42b8579 QRegularExpression: fix count() when the RE matches a surrogate
When the match finds a surrogate pair as the first true Unicode character,
then we need to skip both code units of the pair in order to restart the
search. PCRE2 does not allow us to search for individual UTF-16 code
units.

That actually means that counting "." gives us the count of Unicode
characters.

Fixes: QTBUG-110586
Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b22ae069ac193cfa0479d0bc258a860ef00816b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 03:38:15 +00:00
Yuhang Zhao
63fe358f99 Windows QPA: also consider window flags when judging frameless or not
It's possible that the window has the WS_THICKFRAME flag but the
Qt::FramelessWindowHint is enabled at the same time. That usually
indicates the user is customizing the window, but it will also
confuse QPA's current logic. We can make the logic more roboust
by reading the Qt window flags as well.

Change-Id: I9894e312a92ef7f5fc0aa93974f216b67fe2cf29
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 17ab11ce493477f891916351b6ac0f0a8ad28ca6)
2023-01-26 12:33:09 +00:00
Thiago Macieira
44854ab85c QUrl: restore empty-but-not-null for components that are present
This got lost during the QStringView port that happend in Qt 6.0
(commit 548dcef08976649c820054f3db1ad108c72439cd) because
QString::operator+=(QStringView) does not copy the nullness of the right
side, whereas QString::operator+=(const QString &) does.

Fixes: QTBUG-84315
Change-Id: Ide4dbd0777a44ed0870efffd17399b772d34fd55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a14a3a5487675a231b912e9a5ae575357d1c2cf8)
2023-01-25 09:20:25 +00:00
Marc Mutz
db1ba05320 ODBC SQL driver: deal with different sizes of SQLTCHAR correctly
Neither the UTF-32, nor the UTF-8 recoding of a UTF-16 string is
necessarily of the same length as the input. The UTF-32 version may
be shorter, if surrogate pairs were encountered. The UTF-8 version
will be longer whenever the string contains non-US-ASCII characters.

Split toSQLTCHAR() into three functions, templated on sizeof(SQLTCHAR),
and use QVLA's range-append instead of manual memcpy()s.

This patch specifically doesn't use constexpr-if, as that's not
available until C++17, which Qt 5 doesn't require.

Change-Id: I0bfcb66eb321598908ef00ac34c888fdbccf9316
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66767eea46bea0f19f8ae5ad6ebc641d86867701)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-25 08:46:25 +00:00
Edward Welbourne
87a176a8b3 Restore Android-conditioning on nl_langinfo() definition
QCoreApplicationPrivate::initLocale()'s check that the selected locale
is UTF-8-based was added with an initial work-around for Android,
specific to NDK <= 15, which Qt 5.15 did not support.

Later the Android-specific #if-ery was changed to test for Qt taking
UTF-8 for granted, for a given reason having to do with QNX; and later
the #if-ery for that was removed. However, we still support versions
of Android that lack nl_langinfo(), so restore the Android #if-ery.
It presently seems that NDK 26 (Android 8) does contain nl_langinfo(),
so we should be able to drop the nl_langinfo() kludge for this and
later versions. That way we'll at least use the real nl_langinfo()
where we have it.

In the process, fix the indentation of #if-ery.

Change-Id: Ie9e83c3397955c24cea1e9a9ff6bb0187e47dda2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 10117f78d72498e19683e69b439ca7c931532261)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:31 +00:00
Sze Howe Koh
86abefbf4b Doc: Fix usages of deleted QVariant constructors
Finish the job started at 879d30394a41b7b7124fc8139e787a9bdbe0dfee

Change-Id: I217a4830ac8e17d5d1f8900e2d3134fbabf8b9a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a97dbbd1a023fb4a0b7a518fad0ad9edbf1f23f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:29 +00:00
Assam Boudjelthia
d4d46148b6 Android: add build dirs/files of Android templates to .gitignore
Those files/dirs are only build time generated by IDEs like Android
Studio or gradle builds, so ignore them.

Change-Id: Ib4785f9cc75412825d5be4cb5fe206587f37d193
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b49e2bb0849ed423e68398d5a10a3cc079bff589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 15:01:17 +00:00
Oliver Wolff
3ae0e8a021 Introduce qt_winrtbase_p.h
Due to a bug in earlier Windows SDKs developers have copy paste
a workaround whenever they are including winrt/base.h. In addition to
that our usage winrt API also forces them to include
qfactorycacheregistration_p.h whenever they include that file. To make
things easier all that magic can now be done with one single include of
qt_winrtbase_p.h.

Change-Id: Ic6a80d6d3723af381cf0ecc0f0ab43c2e6839a7d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b2c1237b4512480a17009afe1981af02c2a9869e)
2023-01-24 11:28:53 +01:00
Eskil Abrahamsen Blomfeldt
f6e3ea4f73 Fix assert when resizing text table with percentage widths
Since Qt 6.3.x, qBound() has started asserting that max > min.
This caused a crash in the QTextDocumentLayout code for assigning
widths to table columns that were sized using percentages, which
depended on previous qBound() behavior of just snapping to the
minimum size if max < min.

There are some specific conditions for this to happen: First
of all, the available width in the table must be too small to
fit all minimum widths (which is calculated based on content).
In addition, the requested widths have to be given as
percentages of the table width, and these have to add to
something lower than 100%. With these conditions, you may get
a case where the calculated percentage width of a column is
larger than the minimum width, but lower than the remaining
width in the table, causing the assert in qBound().

We simply accept the minimum width as the rule in these cases,
which matches behavior without the assert and which looks
correct when resizing the window to be smaller than the table.

Fixes: QTBUG-108183
Change-Id: I16d18dd9b2e7a77fe86d1a353b426075b5050b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 84a68ef75ce8a8e5b90d799c90905cc998c7c2f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-23 11:31:36 +00:00
Lorn Potter
43500a1e66 wasm: use uintptr_t for uint32_t
This helps get ready for wasm64

Change-Id: I6db5b93c7ca851cab7fc95701b27a20263c8c0bd
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d3be345a368941cc8e6b13851168d85354cc3e3c)
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-01-23 10:33:35 +02:00
Axel Spoerl
c5479c9b2c QWidgetTextControl: Ignore unconsumed mouse release events
QWidgetTextControlPrivate::mouseReleaseEvent() has early returns
implemented, e.g. when link has been right clicked or no selection
anchor has been found. These early returns, however, still consume
the event.

This leads to events getting lost instead of getting propagated:
As an example, a QLabel with rich text uses QWidgetTextControl. While
it propagates mouse press events back to its parent, mouse release
events get lost. A QLabel with plain text propagates both events
back correctly.

This patch adds QEvent::ignore() to the early return.
Since no test class exists for QWidgetTextControl, it adds a test in
tst_QLabel.

Fixes: QTBUG-110055
Change-Id: I950f8c3f135793b01c59832835bb429db2282169
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7689d4ad2f673317af432aae498da74d13703126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-21 16:04:31 +00:00
Christian Ehrlicher
2779ba3276 SQL tests: Fix for PostgreSQL 12 and above
The 'WITH OIDS' was deprecated some time ago and removed with
PostgreSQL 12 so we have to adjust our test table creations. Don't know
why it was used in the first place at all.

Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 87662bcf107e65c04f933f212f4c8cad6692f948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:31:53 +00:00
Marc Mutz
da6e6861c1 QVarLengthArray: fix off-by-size() bug in growBy()
The growBy() function takes the _increment_ of the size(), so needs to
add size() to increment for the call to realloc().

Add a test which hangs (vanilla build) or explodes (valgrind build)
without the fix.

Amends 26b227e128475da3f88a6b34921a08994bf71cf4.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Fixes: QTBUG-110412
Change-Id: I7ea91342fdcb779825c88013a3f86ba6d90ef530
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 51e5a2376a8a2956665ff4c3a0e86c8cd9d0847d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:31:53 +00:00
Thiago Macieira
81ed4430e4 QUrlQuery: fix operator== for emptied object case
If an object had elements and then was emptied, it will have a non-null
d pointer, which wasn't taken into account in the comparison.

Fixes: QTBUG-109840
Change-Id: I69ecc04064514f939896fffd17376aa18184653c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3d584b1093cdb6245b02eda996db2927ffaf09ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 05:58:42 +00:00
Mate Barany
9e8dcaa1e3 [doc] Warn users about data races regarding qt_ntfs_permission_lookup
qt_ntfs_permission_lookup is a non-atomic global variable that is prone
to data races. Make a remark about this in the documentation.

Task-number: QTBUG-105804
Change-Id: If7c64f3ab7d2c3b1487fe56204a4e66c420b0604
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 696ad54e5d76dd063cbb02d0c288fdece6ee75d0)
2023-01-18 21:51:56 +00:00
Tor Arne Vestbø
c759af9981 Respect custom QWSI event handler when delivering synchronous events
Fixes: QTBUG-110268
Change-Id: I25195904cfc18d593db1be713b6e899e55eb922f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2813e2814e185bf8d2426c5eb3d6b2c243ee72c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 19:13:05 +00:00
Thiago Macieira
9f9d022916 CMake: make qt_config_compile_test verbosely indicate missing deps
This alone isn't enough:
  Feature "xcb": Forcing to "ON" breaks its condition:

      QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11

  Condition values dump:

      QT_FEATURE_thread = "ON"
      TARGET XCB::XCB found
      TEST_xcb_syslibs = "FALSE"
      QT_FEATURE_xkbcommon_x11 not evaluated

But when it says:

-- Performing Test XCB (extensions) - Failed because XCB::CURSOR not found

The user can know what to do.

Change-Id: I810d70e579eb4e2c8e45fffd1719c0abf608ed30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit caecb17248a88434faf533ceef81d3b5f5e79335)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 19:13:05 +00:00
Assam Boudjelthia
1fd8ad388d Android: delete dead code for tst_android under tests/auto/other/android
This amends 23780891a50ba678714f7e0a4cf43a0f8164b440 which moved the.txt
test to tets/auto/corelib/platform/android and kept the old location
mistakenly.

Change-Id: If58422f9a94cfe4d6a941cc5453d8f0506057dcb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c7b93d471d763b5e7986305deb4d0d83d7b69068)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-18 16:16:17 +00:00
Assam Boudjelthia
627f0cb6e0 Android: use signature-less jni syntax for AndroidContentFileEngine
Task-number: QTBUG-98974
Change-Id: I1e8e102282af2877bbbe6e8018b7649fac66804e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit ba3db0cacdea95ca91d0b3984b4e65c43a17a9bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 16:16:17 +00:00
Marc Mutz
85e5ff806c QStringView: remove pointless Q_ASSERT in toString()
QString and QStringView have the same size_type these days.

Change-Id: I59ffe78f51e06ccc130562b1682fb4a672c3ec22
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8ef22183d67e0e7a8ad00bc0ea48c41510eb84ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 13:30:52 +00:00
Assam Boudjelthia
b59e89c907 Android: pass EXTRA_INITIAL_URI to native FileDialog
Allow setting the initial directory where the file dialog
will be opened.

Change-Id: I1395b367c74d28fb2890ac53a90456c3ac4c1b05
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 609e14724edfd8d8cef23c5f30ad7812a359ed8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 10:16:38 +00:00
Marc Mutz
17c6ee5a26 QVarLengthArray: cope with vector<unique_ptr>'s copyability
Despite being move-only, std::vector<unique_ptr> advertizes
is_copyable:
  https://quuxplusone.github.io/blog/2020/02/05/vector-is-copyable-except-when-its-not/

Our combined reallocation and resizing function, reallocate_impl(),
runs afoul of this when it uses std::is_copyable in a constexpr-if to
implement resize(n, v) without running into problems with move-only
types: the trait is true, but actual instantation runs into a
static_assert in the STL implementation.

To fix, move the problematic resize functionality out of
reallocate_impl() and into the resp. resize_impl overloads. The shrink
functionality remains in reallocate_impl(), because there are many
more users, and it only requires destructible<T>, which isn't
constraining at all.

Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a.

Fixes: QTBUG-109745
Change-Id: Ibc5b9cf5375108eb3d8f6c8a16d4fd02dadd73b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 800ebd84f57092ccba24984f3888f97bb5433d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 01:12:38 +00:00
Tor Arne Vestbø
283d5c96ec macdeployqt: Don't remove rpaths more than once
In a universal build the tool will find multiple duplicated rpaths,
but the install_name tool doesn't like it if we try to remove it
more than once.

Fixes: QTBUG-109738
Change-Id: I4a8bea0ad3e47b28e6384ceead551edc83e30d26
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9a2198f9cdd5df482c64a52cb5d1e372ac24610c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 11:46:34 +00:00
Amir Masoud Abdol
073bc79b50 Use the Windows path separator in a Batch file
Patching inconsistent path separator in Batch file. This at some point
may lead to something similar to the mentioned task.

Task-number: QTBUG-109857
Change-Id: I36c05dc7a0b7daf3dc5dced61f3c3f7d90eb59e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 07a978c756cba6953bf81497fa3a386793652242)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-16 08:29:45 +00:00
Timur Pocheptsov
5da2292bff QWidgetTextControl: deal with empty formats list properly
Do not call first on it. A regression was introduced by
56f0ebfe860e440dcbba8997f44836debc901119.

Fixes: QTBUG-110070
Change-Id: I7c969da889b6c7ad3a67149fe99ca47830683073
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0cd153b2681437b91f07315a27238446cc24363f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 16:21:11 +00:00
Volker Hilsheimer
9bbf761373 QFormLayout: don't access out-of-bounds layout data
When rows are hidden (implicitly or explicitly), then their layout data
does not get fully updated. If rows get hidden after the layout data has
been calculated once, then we must make sure that their indices are
reset. Otherwise we might access array indices that are out of bounds
when the layout data structure gets resized to fit only visible rows.

For good measure, skip entirely over hidden rows when accessing the
layout data when arranging the widget.

Fixes: QTBUG-109237
Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c3a5fe2fd7a1b8a6b6133c938ffe6b3f30181bf0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:50:11 +00:00
Alexey Edelev
934735822a Set GenerateDebugInformation to true in vcproj if at least /DEBUG is set
If the command line option contains /DEBUG without the following
argument, GenerateDebugInformation remained 'false' because the
DebugInfoOption contained the initial value.

Set GenerateDebugInformation to 'true' if the /DEBUG option is found and
reset to 'false' only if option is set to 'none'.

Amends commit 6a6b27940d497b29672ff65ff242fe0211603f22.

Fixes: QTBUG-110068
Change-Id: I792d7335d8b9536d4beed54cabfd70dcf54f09ac
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e3ef4111271761ede6cbbeb3b0fa075a483085e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:50:11 +00:00
Kai Köhne
818ce40e10 Doc: Fix qt_attribution.json files using Path for files
Since qttools commit 39fdcb8e7a, qtattributionsscanner fails
if 'Path' is not a directory. Use the 'Files' attribute instead.

Fixes: QTBUG-110002
Change-Id: I65fecdcb852ce9abea55f168cd939804bae9ae80
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2c78c5d4569d89c204857ab007f9e260b219d624)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:50:06 +00:00
Friedemann Kleint
bd99d02123 QtSql: Disambiguate typedefs
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I3f94044671cdbd0a1bb0964bf291e36508223b50
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit d9d74723cc4b369f41530aff5b500d93779d5e32)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-13 07:58:29 +01:00
Marc Mutz
938712a996 QVarLengthArray: Extract Method growBy()
Separates the actual reallocation use-cases from the resizing ones
when calling reallocate_impl, in preparation for fixing QTBUG-109745.

Task-number: QTBUG-109745
Change-Id: Iee0c3e56569ec7877beda8db3a645e2bbb6b4d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 26b227e128475da3f88a6b34921a08994bf71cf4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 20:57:40 +00:00