indexIn() could hit UB if `from` < 0, so handle that case too. (This
also makes using noexcept for that method more correct wrt the Lakos
rule). While I think that passing valid indexes to a method is the
responsibility of the caller and that the existing API in Qt where a
negative index is interpretted as "search from the end" is
hard-to-use/bad API, not handling `from < 0` this way will most likely
not pass review (c.f. commit 81538c5219b92356c52233a80845847145795d6f on
gerrit). I'd rather get this over with so that an indexIn(QSV) overload
can be added...
Change-Id: Id85d18c901c82d9652804ecff7bfe7c71c10a63c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The size of the dock buttons did not account the
SH_DockWidget_ButtonsHaveFrame style hint and therefore was too large
when a full 16x16 icon was used (which was the case after the latest
style cleanups) and therefore appeared too large.
This also allows the remove of the hack for the windows style. The
windows vista/11 style is not even affected by this hack because there
the size comes from windows itself and can not be modified via
PM_SmallIconSize.
Fixes: QTBUG-118643
Task-number: QTBUG-118122
Change-Id: Ie09a6a4e89df66b5393c5a57735002da47415c0e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Crash reports imply the `certBackend` we extract in
QSslCertificate_from_CERT_CONTEXT is null, which means that
something went wrong when parsing the certificate data we get from
the certificate chain.
We assume the rest is okay since it must be inside the bounds of the
length of the chain.
It's not clear why the certificate would be invalid, but it's better
to avoid the crash for now.
Pick-to: 6.5 6.6
Task-number: QTBUG-118569
Change-Id: I76ce07fc38bf82ef5c93097d839724ddee1edeef
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's actually 'lexicographically'. But 'alphabetically' is a more common word.
This was brought up in https://forum.qt.io/topic/151834/what-s-lexographically/5
Pick-to: 6.5 6.6
Change-Id: Ibeb0e4463e12b54c1c10ac7df268e4d62b6ce49f
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
With one exception in a kludge-around, substituteDigits() calls were
always subject to the same condition, so wrap that in a trivial method
and simplify the code calling it.
Change-Id: I6d8f3ca9179e32f03348cd718f9ee9de573221b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The arrays can be constexpr, and we can avoid some repetition by
making only the choice of which to look in conditional, when we do the
same thing thereafter.
Change-Id: I8c9f95b3967017cf67a76de9d2a7a8729ee430f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Likewise for the string list in uiLanguages(). Document the exception
(for grouping separator) and the other corner case (currency symbol).
In commit 089bbfc307 we changed the
system locale look-ups to rely on backends to return null QVariant on
failed look-up, but the MS backend has several places where it would
return an empty string for lookups that really shouldn't.
Pick-to: 6.6 6.5
Fixes: QTBUG-118703
Change-Id: I1a5622beebc4e5639d643250829937a829e23363
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While it would be perverse for availableTimeZoneIds() to list all
supported UTC-offset zone IDs, it makes reasonably good sense for its
offset-specific overload to include the ID QTimeZone would use for the
relevant UTC-offset, since passing this ID to the ID-based constructor
will indeed get a zone with this offset. In particular, it already
does include the offset-zone's ID if there is an IANA UTC-offset zone
with the given offset; and its list is apt to be empty otherwise.
Only applies to IDs we would in fact accept, checked with
offsetFromUtcString() to match the QTZ constructor's check.
Change-Id: I77bb60b166c3d3af5824d84952e1e10a5d32a5ad
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Principle of least surprise: prefer IANA IDs over synthesized ones.
This also aligns what id() returns more nearly with what
availableTimeZoneIds() reports. Amend some tests to match the new
behavior, extend one test to verify id-round-tripping (also for the
IANA zones) and another to verify single-digit offset IDs get
zero-padded.
Document the complications in how id() relates to what is passed to
the constructor. (It was already complicated; the present change just
aligns it better with IANA IDs, where possible.) Mention, in
availableTimeZoneIds(), that (and why) it only includes IANA's offset
IDs. Drive-by: fix a typo in another availableTimeZoneIds() overload's
doc.
[ChangeLog][QtCore][QTimeZone] When created from (only) a UTC offset,
or from (only) a non-IANA UTC-offset ID, a QTimeZone instance now uses
an IANA UTC-offset ID, where one is available with a matching offset.
Previously it used a synthesized UTC±hh[:mm[:ss]] one which would omit
trailing :00 for minutes or seconds, which the IANA ID may well
include.
Task-number: QTBUG-118586
Change-Id: Ifc4976f36361c830c88a8bef0e8b963fe5a2ab43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The table was almost sorted by offset - its UTC entry, with offset 0,
was at the front rather than first among the offset 0 entries. The
lookups in it were being done as if the IDs were in space-joined lists
(as for the IANA IDs in the Windows table), splitting on space,
despite the fact that it had separate entries for different IDs at the
same offset (this only arose for offset 0). So actually massage the
input table in python to combine IDs with the same offset using space,
placing UTC first among the offset 0 entries, and ensure the C++ table
is sorted. Regenerated the CLDR data tables using the updated script.
In the process, fix an off-by-one error in the iteration over
space-joined IDs, where the search only advanced to the space, rather
than to just after it. That wasn't a problem before, but now would be.
Change-Id: Ib49c27bac269b557166fa10738c3e396d58456c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Introduce dark mode to QWindows11Style and increase frame contrast on
highcontrast themes.
Change-Id: I18d10a314fb11828b8c3a116396e2d3cd2247b65
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This should have been done when the extras where moved to qtbase,
it went under the rug and was forgotten.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-114971
Change-Id: Id7831a8bab8bedc1f869b9fc8bfc72acc3cca7a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make checkBlackLists() return true if the test is blacklisted and false
otherwise.
Change-Id: Ief400a10a47ec7c21ea1d37fe75c7dc08739e06c
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This method is part of private API, so it's safe.
Change-Id: Idc7464a825841db2fa9dddd47d6dbda82668601d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
- editing same document in different views is possible? yes
- resizing one QTextEdit calls QTextDocument::setTextWidth(), which
affects the width in the other view too. You can resize either one,
but you can't have two views with different layouts, of course.
Added a categorized log message in QTextDocument::setTextWidth()
for a sanity check.
Task-nunber: QTBUG-35688
Change-Id: I59c4d10143fda3a66b946237832274d67f9d9d45
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Document requirement of setting the QT_FORCE_FIND_TOOLS option to
ON to reuse the pre-installed Qt version when not cross-compiling.
Task-number: QTBUG-118211
Pick-to: 6.5 6.6
Change-Id: Ia02abeaede583ca01f10187158da0f4bc86f9d1a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The legacy mode was using the new nativeKey to create a semaphore.
As a result, on macOS the name of the semaphore key file was the same
as the name of the shared memory key file.
This lead to a situation when the file was mistakenly deleted when
destroying any instance of the shared memory, not only the one that
created it.
Fix it by using QSystemSemaphore::legacyNativeKey() in legacy mode.
Add a test to verify that we cannot re-create a shared memory with the
same key. The test was failing on macOS without the fix.
Fixes: QTBUG-111855
Pick-to: 6.6
Change-Id: Ib0bc41791e889b1888bbb8aa9044c6b053b63a5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make the logs visible as errors as they should be.
Task-number: QTBUG-115016
Change-Id: Idfaddbc3bdd3b218ae961b1a5cce9540a4710c39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
MSVC runtime dlls also include vccorelibXXX.dll, concrtXXX.dll,
beside these traditional dlls, it's also possible to link against
the new UCRT runtime, the ucrtbase.dll (and possibly including
the API Set dlls), so we need to add some more checks to make
windeployqt more robust. I've tested a custom Qt build locally,
which I managed to make it link to ucrtbase.dll only, and this
code works fine.
Pick-to: 6.6
Change-Id: I00bc8666d8850aac279b8747465879e39348ba02
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Have all or most of Android code dealing with displays in
QtDisplayManager. Also, simplify setApplicationDisplayMetrics()
call and avoid caching any uneccessary members.
Task-number: QTBUG-118077
Change-Id: I943069c24bb40ae3016db5896e553b501e700a6b
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Windows 11 23H2 (10.0.22631) will be released publicly soon,
it's better add it to Qt now.
Pick-to: 6.6
Change-Id: I1bcec19d3a15e778f2c5e504d1e5cf678753f5a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The text handle should not be visible in case when it is out of
the text-object, or when it is hidden by other object. That is why we
should call updateSelectionHandles() method after touch only in case
when cursor position fits to clipped input item rectangle.
Fixes: QTBUG-115005
Pick-to: 6.6 6.5
Change-Id: I35c083acd8fd4d5240e3bb15afa1afbec4ea0b26
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Should not unset all the old state and set the new ones.
Only unset the state that needs to be unset.
If states changes from maximized to minimized, there is no need to
unset the maximized state and set the maximized states again.
(minimized and maximized can exist simultaneously :)
This amends f61b140482 .
Pick-to: 6.6 6.5 6.2
Change-Id: Ic93122b92fafcdba973b885e299b282408da7a1c
Reviewed-by: Liang Qi <liang.qi@qt.io>
Use pmf-style connect syntax for the three connections within
QDockWidgetPrivate.
Change-Id: I091a210d6a822903f0cc183f9090e03b124875e6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Since 2017 we've been using the ICU backend in preference to the MS
one, so there's no point declaring the MS one when it's not being
compiled.
Pick-to: 6.6 6.5
Change-Id: Ia7b770ec27bb627caace814b972967c4f7d63330
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While touching code, use CaseInsensitive compare more to avoid needless tmp allocation
Change-Id: I4fe8496133925887df6879b48c730c36f486fa9c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Exclude qdbusconnectionmanager.cpp which includes qt_windows.h,
clashing with the "interface" parameter name in qdbusinterface.h.
Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: Id41910857cb203ec5a1b784fa171eeb189ca4eca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This patch provides the actual implementation to detect binding loops
in property setters.
These test will help to catch all the existing binding loops that were
introduced when migrating to new bindable properties.
The logic of the new tests is taken from
tst_QObject::objectNameBinding(), but generalized to be applicable to
all bindable properties.
The original code from tst_QObject can now be removed.
The patch effectively reverts f791570b86
because a lambda returning a nullptr now means that the binding loop
test should be skipped, which is not a good default behavior.
Now when all the existing bindable properties are fixed, it's fine to
give a compilation error when adding new tests, if the class is not
default-constructible.
Task-number: QTBUG-116345
Pick-to: 6.6 6.5
Change-Id: I059d444d4bb023c050a22e5b1974565e4f581b5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
After the introduction of QInputDevice class the returned
QPointingDevice object from QTest::createTouchDevice()
call is no longer automatically deleted when the
QCoreApplication is deleted. Moreover, this function does
not really go thorough qpa but simply registers the device with
QWindowSystemInterface::registerInputDevice() (which is
actually also used from qpa plugins when new device is plugged)
Pick-to: 6.6 6.5
Change-Id: I3a0400288d76b7c95659d6b6ea260eff3233ebf1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When building for 32bit platforms (e.g. Android armv7a), then printing
qsizetype value using printf's %lld format generates a warning because
qsizetype is just an int. This breaks the build, and can't be fixed
by using another placeholder without producing a warning on 64bit
builds. So fix it by casting the qsizetype always to 64bit signed int.
Change-Id: Ie7c0fa8b3a0fe6366ce6fd5b2947f42a3e67c381
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Emit log output and return false immediately if we fail to get both the
Activity and the Service objects. Standardize the registerNative methods
to return bool and take a QJniEnvironment, and adjust the macros
accordingly.
Simplify the startup routine to use QJniEnvironment.
Change-Id: I11be35426520dc803f5a07bbb495e908592f254e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This further helps reduce the creation of temporary QJniEnivronment
instances (with allocated d-pointer) for cases where we simply need to
get the JNIEnv for the current thread.
Change-Id: I2eda238124be51c755d8910de9dbc9ca8eb92288
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
On Android, `long` has the width of the system, while `jlong` is always
64 bit. If we support `long` as a signature type equivalent to `jlong`,
then it becomes possible to write code that fails to compile, or in the
worst case crashes at runtime, on a 32bit system.
Instead, support quint64, which is always the same size as jlong.
Change-Id: I60432ec7411e697b5f6e1f153216ceee0af7e0f1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewing and improving the docs for QWidget is part of the objectives
for the 2023 Q4 OKRs.
Most of the work in this patch is fixing grammatical errors and typos.
It is tempting to move much, if not all, of the Detailed Description content from the QWidget class reference page (qwidget.cpp) into its own overview/explanation page, which would be more in line with the diátaxis framework. But I think that should be a different patch.
Fixes: QTBUG-117758
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibb3f367c4677f7e6615bc0cd39d0ffe921862cb9
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>