The code comment above the cast is correct, but the code wasn't: While
we're receiving the result of the cast in a QDialog pointer, the cast
is still to QMessageBox*, and whether that cast is in the Q_Q macro or
not doesn't change the fact that it's invalid.
Says UBSan:
qmessagebox.cpp:2804:31: runtime error: downcast of address 0x7ffebfd87140 which does not point to an object of type 'QMessageBox'
0x7ffebfd87140: note: object is of type 'QDialog'
2b 7f 00 00 30 94 57 b9 2b 7f 00 00 80 8c 00 00 90 61 00 00 08 96 57 b9 2b 7f 00 00 00 00 d8 bf
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QDialog'
The trivial fix is to cast only to QDialog.
Amends 29b2506e8cf0c792821a3ddb28e62080cd66ae28.
Pick-to: 6.8
Change-Id: Ia3f6c08b62f6bed274f43baab881a0d802bd986b
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit f4dd7e29a68c4439e3da40db4eb2d67999d316b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Using Q_DECLARE_OPAQUE_POINTER means that the metatype system won't have
any knowledge about the type, beyond it being a pointer. That leads to
all kinds of unexpected errors in code that needs to introspect the
meta-type information to handle QObject's and gadgets, notably but not
limited to QML.
Warn about using Q_DECLARE_OPAQUE_POINTER for gadgets and QObject's, and
offer Q_MOC_INCLUDE as a potential alternative for some use cases.
Pick-to: 6.8 6.5
Task-number: QTBUG-127012
Task-number: QTBUG-134883
Change-Id: I4fe53f277d0aa51ef552d04f642364aa6613ef7c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 0a567a7f926f433cbd1294131aac0e80dcfd7943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Show the color that is dragged in, both graphically and textually.
Revert to default palette for other data types. Prioritize colors
over text: if an application (such as kolourpaint) offers both x-color
and text, the color is probably the intention, and the text may be
just a hex string for placing into a color text field.
Pick-to: 6.8
Fixes: QTBUG-134313
Change-Id: I6c19f1220712881d2057bc9758bbc8cbd9247c81
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 1750acc3921148b0ffc8f9f1421b87a2f5522a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This reverts commit fd9c9788f73cb088229701dd92443aa04005a4a3.
This change failed to consider the fact that color fonts may
also contain non-emoji characters and can be used for regular
text. In this case, it very much makes sense to support
subpixel positioning.
If needed, a more specific optimization can be made for emoji
characters later, but for now we just revert to fix the
regression.
Task-number: QTBUG-134626
Pick-to: 6.8
Change-Id: I07fece03d02b62811c2def26c19c5225a08a0037
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit e72b2f19300f5a5e2b4c58926024ba332d65e75c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Writing "adjusted()" would have produced a link automatically, but
since an argument is present, the function name is not a link. Add it
manually. Omit the parentheses and the argument, because that's how
QDoc renders "adjusted()", too (only the function name is the link).
Amends 1aa4ad46e4878072be9acb8389572e7f9e8198df.
Pick-to: 6.8 6.5 5.15
Change-Id: I350a277f91e486256ca014e554beea3348b6ca96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39aac934387afe3b50c1dff4c739080202a7a4df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Coverity complains that the binary search algorithm can yield high =
32, which, when passed to primeForNumBits(), will overflow
prime_deltas[]. This is true, for negative 'count', or, more general,
if the MSB of 'count' is set.
Add a Q_ASSERT(count >= 0) to inform Coverity (and other readers of
the code) that this function is only expecting non-negative arguments.
Amends 4adf5e1a9ef4fe78f4b70b7462943246903f4f11, which didn't fully
solve the issue, at least not as far as Coverity is concerned.
Pick-to: 6.8 6.5
Coverity-Id: 11295
Task-number: QTBUG-134543
Change-Id: I994dd1d1850c6644188a9fc0b83973614dd51e6b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 536cd1ce20a59e4daaf3a09c115f2dc5ad9cbf91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Some VxWorks touch device drivers return improper value of min and max
ranges in both axes (both 0 for both axes). This makes any touch point
position equal to (0, 0), making touch unusable in Qt.
[ChangeLog][Platform Specific Changes][VxWorks] The user can now
override touch ranges that the driver returns, by setting the
new parameters "rangex" and "rangey" on the environment variable
QT_QPA_VXEVDEV_TOUCHSCREEN_PARAMETERS with comma-separated
min and max touch ranges for X and Y axis respectively.
For example, add rangex=10,815:rangey=15,1024
Task-number: QTBUG-115777
Change-Id: I4f4aba7ee66e76b80438888697f84c4db9896c3d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 276ccda2f3e96984b392c0429a5da8b804baacdf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The related functionality meant to be enabled by BuildInternals, which
makes the lookup of the pre-defined HostInfo version based on either
calculated or pre-defined INSTALL_CMAKE_NAMESPACE.
The PROJECT_VESION(_MAJOR) meanwhile is hardcoded by the current Qt
repo, which is not necessary aligned with BuildInternals/HostInfo.
Pick-to: 6.8 6.5
Change-Id: I61052c93ce2d6ee3c6d8025da2e078edcde48d0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 56ec6b4843ff1e3763ad9cb608acfb21ea4db341)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Avoid hardcoding the HostInfo package version, use the
INSTALL_CMAKE_NAMESPACE as the reference for the find_package calls.
If we assume that the package follows the versioning in the future,
we should consider the Qt version, to avoid any version related
issues.
Pick-to: 6.8 6.5
Change-Id: If84550ab82f8de51ff5af41c7f31838c4ed53a67
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a67c13d1a68db40d1c2e9f89bcc76aa244feb8d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
[ChangeLog][QtCore][QCborValue] Fixed conversions from QVariant when the
variant contained long, unsigned long, or qfloat16.
[ChangeLog][QtCore][QJsonValue] Fixed conversions from QVariant when the
variant contained long, unsigned long, or qfloat16.
Pick-to: 6.8
Fixes: QTBUG-134756
Change-Id: I08d069dd639c0fc5a15afffd4067762ec94d606d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 895b1c0ab358189dd3d7330207bbc69e36427350)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Needed to make some conversions explicit, since you can't assign to a
qfloat16 from double.
[ChangeLog][QtCore][QVariant] Implemented converting of qfloat16 to and
from the other numeric types, text conversions to and from QString and
QByteArray, and conversions to and from QJsonValue and QCborValue. This
should make qfloat16 behave the same as float and double.
Also flip the order of arguments in one of the addComparePairs(): left
side is actual, right side is expected. I noticed on the copy & paste
to do the qfloat16 above it.
Pick-to: 6.8
Task-number: QTBUG-134756
Change-Id: I6a6c469d21746a07c18efffd6b3b961c73c0e2f2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a4daf4939644ea3a087a8c03b1ec962e2e4defa8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
No-op change. All this does is explicitly wrap the right side of the
expression in a double() function-style cast.
Pick-to: 6.8
Change-Id: I84bc14bf75b4d0a046dcfffd19f318eaf7fe0e9f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ab45c44fb5471cef907334a1f6d7dbad279dd707)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This makes the tests more exhaustive than they were, with far less
repetition. Also adding the testing of conversions for which we don't
have a toXxx() getter, because those exercise different code paths
inside of QVariant, and yet should produce the same result.
Pick-to: 6.8 6.5
Task-number: QTBUG-134756
Change-Id: I99664a53da674bcbd992fffd5f290cfe51259d5b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 42e0f9811095fc73c5c1209632247446e6229b3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Currently the QWindow::devicePixelRatio() documentation mentions that the device
pixel ratio can change, but it does not explain how to track the changes.
This patch adds that the QWindow instance receives the event of type
QEvent::DevicePixelRatioChange when the device pixel ratio changes.
Fixes: QTBUG-128182
Pick-to: 6.8
Change-Id: I2107015a07f30167c9f7324959b47ada0a75988d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ada114f8b37b62fe80332105507b1afc20424aa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
To suppress clang-tidy's
bugprone-pointer-arithmetic-on-polymorphic-object
because we store a dynamically allocated array of
QHttpNetworkConnectionChannel objects in QHttpNetworkConnectionPrivate
and index into this all over the code.
Pick-to: 6.8
Change-Id: Ibcdf7c8acc4a57eaf36bca3719733655053ac818
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 930dfd11dd7d8a0135c5d80d047b95bb8a55cbcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This allows API users sending the HEADERS and DATA frames after the
SETTINGS ACK right from settingsFrameReceived slot, and keep the
expected frame order.
Pick-to: 6.8
Change-Id: I7900e786074d1d534c2e14f00e2aedf8dbb3a9d9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d3292dbeb60cc4f13be06e07a7408a0d0817975d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
It was failing because making it latin-1 turned it into:
"Norwegian BokmÕl, Latin, Norway"
While we expected:
"Norwegian Bokm\xE5l, Latin, Norway"
Amends e323d46cdaecffebb3f9fa55934e4eb4868611cf.
Change-Id: I55fe21331d1cb3abd66780e103aee8b603509818
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d359035c804021f59da70a75d962bfeafd320a71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Before this change, if someone called ninja Gui_generate_docs, it
would implicitly depend on sync_all_public_headers -> Gui_sync_headers
which would generate dbus headers.
This caused trouble with the new 'build doc tools from
qttools/dev/HEAD' approach, because an older pre-built dbus tool might
be passed a newer option when integrating a qtbase change that passes
the new option.
To avoid that, we now filter out the dbus headers from the list of
headers that should be processed by syncqt when building a
documentation target.
We do the same for the qvkgen generated headers.
This also removes the dependency on the ${target}_sync_headers target,
which means there is a potential issue when someone manually calls
`ninja sync_all_public_headers Gui_sync_headers` or something like it,
which would spawn two syncqt processes that access the same files
concurrently. This is an edge case that should not happen, but if it
ends up happening, we will have to implement some kind of lock file
mechanism.
Pick-to: 6.8
Fixes: QTBUG-134672
Task-number: QTBUG-128730
Change-Id: I9061f9495e2faa77744f5f5c0de8fedd362ba228
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e7834e90f38891382f830da7700f00ebd81f21a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Caching the scaled QPixmap directly in QIcon is not a good idea
- the cached pixmap might be used as starting point for a pixmap with
another size so it gets blurry
- QIcon has no caching mechanism to throw away unneeded QPixmaps after
some time so the memory usage grows indefinitely
Pick-to: 6.9.0
Fixes: QTBUG-134930
Change-Id: Ic490ba15438a5cd07a555692e1d08cd1c211d005
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a238e1225f49b81772516ed5d0a5a4f4f2e9268)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Requests that may lead to a different state when performed multiple
times (non-idempotent) should not be automatically re-transmitted if an
error occurs after we have written the full request.
We assume all custom methods are potentially non-idempotent.
[ChangeLog][QtNetwork][QNetworkAccessManager][Behavior Change]
Non-idempotent requests are no longer incorrectly re-sent if the
connection breaks down while reading the response.
Fixes: QTBUG-134694
Pick-to: 6.8 6.5
Change-Id: Ie8ba7828ce9375359c2326f06426fe1a1e568fef
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 4c9a4ecd358da3bf371a2441cccd8a66c86f2d3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When a pushbutton has a menu, the menu indicator is drawn as the glyph
ChevronDown from Segoe Fluent Icons font. But later the font is not
reset so it's also used for the push buttons label. Since the icon font
has no valid glyphs for most of the characters, a replacement is used
but this might not be the one set for the pushbutton.
Pick-to: 6.8
Change-Id: I25c9b993450e7fe740addb153259f46b570ad8f7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c26a93b3d5cccd48d18ef2e8b1879c093c15794)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Handle QSG_INFO with the proper macro rather than with an invalid
const_cast
* Remove the racy bool rubLogEnabled, read the atomic from the
logging category directly
WARNING: ThreadSanitizer: data race (pid=427588)
Write of size 1 at 0x7f89d5be2530 by thread T12:
#0 QRhiImplementation::prepareForCreate(QRhi*, ...) qrhi.cpp:8863
Previous read of size 1 at 0x7f89d5be2530 by thread T11:
#0 QRhiResourceUpdateBatchPrivate::free() qrhi.cpp:9907
Pick-to: 6.8
Change-Id: Ied5171ea5bb97372daced8afe3ad894d49961069
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3cc947e98f6237c86160589143e69c13c965e226)
No need to test twice whether the row's columns array is initialized.
Pick-to: 6.8
Change-Id: Iead06f98ad421202bb4b71ae8efbd784ab3e87c1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit bd6e55c856e3c016048410f69919e443c71628bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The function follows various libc functions in forcing the caller to
decide the case of the exponent separator, rather than allowing them
to opt for the case the locale normally uses. At Qt 6 I changed the
code reading from CLDR to not force the case, but didn't change
toString() to force lower when that was requested. Since the function
is documented to use lower-case when that's what it asks for, change
it to do what it says in its documentation. A caller who wants the
locale-appropriate case is thus obliged to call exponential() and scan
it for lower- or upper-case letters and select the right one of 'e'
and 'E' (or 'g' and 'G') to match.
This partially reverts some test changes made in
commit d5bb8d5150498dc059e8c17f224c66fb1a6bcf32 and expands the
QLocale tests to include ones matching those it changed. Fixed some
tests of QDoubleValidator that previously turned 'e' in the input into
'E' in the output; roughly alternate between changing the input to
match the output and the other way round, to be sure we exercise both
branches of the test.
Pick-to: 6.8 6.5
Task-number: QTBUG-134785
Fixes: QTBUG-134768
Change-Id: I5cffbd772a166efab9f7a5145289771c16be1658
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 05c8a48612be38a3c50bb5ed9daf1adfc221b9f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Some locales even have multi-character exponent separators. Scan the
actual locale-appropriate separator to determine whether it contains
any cased characters; if upper, prefer 'E' format, of lower prefer
'e'; but match the case of the input string in any case, when it has
case. Use 'e' when it has no case.
This doesn't currently change any test data, due to the bug that
QLocale::toString(double, 'e',...) uses the locale-appropriate case,
even if that is upper-case, contrary to its own docs. However, fixing
that bug breaks some of the tests of QDoubleValidator without this fix
to prepare for it.
Pick-to: 6.8 6.5
Task-number: QTBUG-134768
Change-Id: I0ba5bbdb507b8b6efdf6dc134c387fd3b4bcbeb2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8c88a077ccc8350a44fd97fd082dbc328b5dd11f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Extend QMimeType::comment() to support translations from .qm files as a
fallback when system-provided translations (e.g., shared-mime-info) are
unavailable.
Task-number: QTBUG-127004
Change-Id: I23060ab7a690c774691b2d96174e77a252c047ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2edb56977309daff0e2bb92bb5f64f8e0ac47da9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Fix the drawing of the SC_TitleBarCloseButton for fractional dpr by only
drawing two lines with a width of 2 instead 6 single ones as the single
ones might get disturbed due to rounding.
Pick-to: 6.8
Fixes: QTBUG-133834
Change-Id: I711cef885ed04fa695c24ee3e536697a0ebb3868
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9b35b477f7d4b37a33204c837309a0ede0101129)
The old implementation from Qt 5 time only affected the 32 LSB of the
result. The upper bits were completely determined by the seed, and the
seed alone. To see this, note that all except the seed are at most
32-bit values, and no shifting out of that range occurs, either.
Fix by just using qHashBits(), making sure (with a static_assert())
that QUuid has unique object representation (= can be compared for
equality using memcmp()).
[ChangeLog][QtCore][QUuid] Improved the performance of the qHash()
function on 64-bit platforms by populating all bits of the output
(was: only lower 32 bits).
Amends 55d68a16aafb93aa15bcdbd78892006777b6067a.
Pick-to: 6.8 6.5
Change-Id: Ibf67350f571889fd21e0acc82639c053c0d606b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bb846a22c37dcb085829676d8feb7c203d21c886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The return value of this function is constant and some users (QML?)
may call this function often, so memoize the result of the function
instead of re-creating the QHash on every call.
Amends 40206a9f6d7635bb19305d1c8d74908808e3529e.
Not picking to Qt 5, because I'm unsure about the state of magic statics
there, and I don't want to take out the Q_GLOBAL_STATIC sledgehammer.
Pick-to: 6.8 6.5
Change-Id: I8311e93ea16982c82e8312e1e104d95ed062fe6b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0d0a151e0d3a93bcd289751b56959a7655a049d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The macro body did not use its type parameter and both uses of the
macro in fact passed float for that parameter in any case, making the
so-called double version of the test actually a redundant clone of the
float form. This code is very ancient (harald, 2006).
Pick-to: 6.8 6.5 5.15
Change-Id: Ib6b7231c2737346784385473a94f3936b08aed33
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a52a979abd58bde5823b15324595776b1e2e62b9)
Previously, QXmlStreamWriter would incorrectly insert a newline before
the first token when writeStartDocument() was not used, while
auto-formatting was enabled.
This fix ensures that the first token is written inline without an extra
leading newline, while preserving expected formatting for subsequent
tokens.
To achieve this, two new flags have been introduced:
- didWriteStartDocument: Tracks whether writeStartDocument() was called.
- didWriteAnyToken: Ensures that at least one token has been written
before allowing newlines.
Fixes: QTBUG-28721
Pick-to: 6.8
Change-Id: I8be7e8fc6ac0e63304359d24c6c8372e5ba42bb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c3295bd59cb1c3b858b6a858aba4481adeea209b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Many of the conversions are implemented by macros and may include
conversion from a type to itself. We never call the convert() function
with those parameters, so that code can be safely suppressed.
Change-Id: I31904243ae8f750a3002fffd85f944305f0eee6b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 3e1d147986cfbce0da7cd0623aad5c1351642bc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When safe area margins are in play, such as on iOS and Android, or on
macOS in 6.8 and above when the NSWindowStyleMaskFullSizeContentView
styleMask has been set (manually or via Qt::ExpandedClientAreaHint in
6.9), then widgets with a layout will by default try to avoid the non-
safe areas.
This worked well as a safe default, ensuring widget applications filled
the entire window with its background color, while constraining the
layout of children to the safe area.
However, for those that explicitly want to put content in the non-safe
areas, by setting Qt::WA_ContentsMarginsRespectsSafeArea to false, the
story was a bit cumbersome, as we set the attribute to true by default
for all widgets. Meaning, any child widget put into the non-safe areas
that itself had a layout (such as a push button) would also need the
Qt::WA_ContentsMarginsRespectsSafeArea = false override.
We now default Qt::WA_ContentsMarginsRespectsSafeArea to true only for
top level widgets on creation, and leave it up to the user to manage the
attribute for the other use-cases, as they then need to be in full control.
[ChangeLog][QtWidgets] The Qt::WA_ContentsMarginsRespectsSafeArea attribute
is no longer set by default for non-top-level widgets. Top level widgets
still default to Qt::WA_ContentsMarginsRespectsSafeArea=true, so children
are laid out in the safe areas, but overriding the attribute for the top
level now allows placing widgets in the non-safe areas without also setting
the Qt::WA_ContentsMarginsRespectsSafeArea attribute to false for every
descendant widget that overlaps the non-safe area.
Task-number: QTBUG-133215
Pick-to: 6.8
Change-Id: I7b1d420d730ee896ec2fb61aadacd94473dc9681
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 16081f414d9cfd752c0e6152fbfa386bdbade7a4)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The return value of this function only changes when models are added
or removed, and some users call this function often (an earlier
version of QGenericItemModel did, possibly QML does?), so cache the
result of the function instead of re-creating the QHash on every call.
Use QAbstractItemModelPrivate::defaultRoleNames() so we don't need
an instance to get the base class' contents. Amend the comment in
QAIM::roleNames() asking to keep the two in sync.
Amends 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f.
[ChangeLog][Important Behavior Changes][QtCore][QConcatenateTablesProxyModel] The
roleNames property is only updated (lazily) on addSourceModel() and
removeSourceModel() now (was: on every call of the function). If your
source models change their roleNames() dynamically, you need to call
invalidateRoleNamesCache() manually when they do.
Change-Id: I32edc93ff9ff7b252ca04f0d61b54b2244d0be48
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f3256e059f4e675f6e8d0cda710c3f979d84bc2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Instead of the RVO-unfriendly¹
auto r = std::move(it->second);
erase(it);
return r;
use map::extract(), if available. The RVO-unfriendly code now only
plagues old-fashioned compilers that, in 2025, didn't, yet, manage to
implement C++17 _cpp_lib_node_extract. The rest enjoys C++17
guaranteed RVO.
Amends 14090760a87f23509b7bb5ad846537c766cb44a5.
¹ theoretically, this code is eligible for NRVO, but embedded in a
larger function like this, it won't kick in on most compilers.
Reported-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Pick-to: 6.8
Change-Id: I6654fa7f5ed80d07369eb6a2b37f1e82cd3aa7f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ed92f6c22fa59de1e536e1631053ae5565dcc0e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
On VxWorks there is dlopen, but the feature can be turned off for static
builds, so Qt can use EGL even when dlopen is not present. In
qeglplatformcontext.cpp dlsym needs dlopen feature. There is no dlopen
on windows neither on Integrity.
Task-number: QTBUG-134671
Pick-to: 6.8
Change-Id: I7ced5f53ca21a8b0ceb25732ed4b1dc6c0bb1300
Reviewed-by: Janne Roine <janne.roine@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3c919b6d0df486b7319faf8e4f366ab457e9f852)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The return value of this function is constant and some users call this
function often (an earlier version of QGenericItemModel did, possibly
QML does?), so memoize the result of the function instead of
re-creating the QHash on every call.
Use QAbstractItemModelPrivate::defaultRoleNames() so we don't need
an instance to get the base class' contents. Add a comment to keep
the two in sync.
As a drive-by, port from the QByteArrayLiteral macro to _ba UDLs.
Amends 32b586864e3a4398da38c045f4ac0823c3dc3c57.
Pick-to: 6.8
Change-Id: If00b51e60930c974e6f8f928711dc78ba1f42b93
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fde232c855d59009503fe6dbaadd10346ab0830a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
...when the return value is unused.
The code should already be safe from restart()'s preconditions: either
the timer is explicitly checked for validity before the call, or we can
reason about the code (in testlib, the functions are called after the
one that starts the timer, making it valid). Therefore, this is just a
"cosmetic" cleanup (and a super-micro-optimization), but Marc doesn't
want to think about the qtestlib changes and says to pick it all the
way, "just in case".
Pick-to: 6.8 6.5
Change-Id: I73cf287ce1314fc3626734ec64ddf5884afe3383
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit baffc8e47df15190cd85705099698a72e2bdbfa0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
It might be redundant, but I can't definitely prove that these timers
are already started by the time we call elapsed() or restart() on them;
I "just" think they are because the CI is happy with the existing code,
even when adding assertions into QElapsedTimer.
As a precautionary measure, add more isValid() protections to QNAM code.
Also replace restart() with start() since the return value is unused.
Pick-to: 6.8 6.5
Change-Id: Ic64ab27116d8b1cb6c14e18dee79a15aa40844ce
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dd7065616665e983349263bc5d600d764e164003)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
It's illegal to call elapsed() or restart() (sic) on a non-started
QElapsedTimer, so don't do that. In QNAM code, this has been observed by
adding assertions into QElapsedTimer, which then make network tests
crash. (While I am unable to run the network testsuite, this is
reproducible locally by running tst_QNetworkDiskCache::setCookieHeader).
The QTextStream test also calls restart() without a start(), but then it
calls elapsed()+start() which is the whole point of restart(), so amend
accordingly.
Pick-to: 6.8 6.5
Change-Id: I5cfe308f64b631b68b92843b409777a6b9176828
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 585471b138b195cb9020200cae760f119903df85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Not all flags have an affect on an already created window, depending
on the platform and existing flags. Add option to force recreating
the window.
To aid debugging we also now log platform destruction/recreation events.
Change-Id: I7822cb58eaed51d72ed4ea3244f1f4113964cff7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d56dbdd48cb6149b6697b1e695ee7e2de1151bee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This fix ensures that QDomElement::setAttributeNode() correctly replaces
an existing attribute with the same name. Previously, calling
setAttributeNode() with a new attribute of the same name resulted in
both the old and new attributes being present, violating the expected
behavior described in the documentation.
Fixes: QTBUG-15125
Pick-to: 6.8 6.5
Change-Id: Ibdda37a65f6e754d9f7e68e725d3438bbb2d9e0c
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 8c991345847e4b050d746a3efc28ddfa7115a130)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We should also test removal, not just addition.
Amends 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f.
Change-Id: I0842a6be6230362e2095f6c8b2b1ced230826c5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e15ef96bcb59de31937881b8e901f94bcf98355a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The return of a default-constructed QVariant 'v' from three branches
invites NRVO, but most compilers won't let it kick in, because there
are two return statements that don't return 'v'.
Return an rvalue from each branch, so RVO is guaranteed (since C++17)
to kick in.
Amends the start of the public history.
Picking back all the way, since it's risk-free.
Pick-to: 6.8 6.5 5.15
Change-Id: I495885bee3ebba63c9e52640903c792011c1dee2
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 26ba78900d6dae5be24b83004f0f91db74ac95e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>