The "two widgets at a time" API to set the tab order is awkward and
easily misused (as the documentation explicitly explains). Add an inline
overload that takes an initializer_list, and call the existing function
for each consecutive pair of widgets in the list.
Add documentation with snippet, and a test.
Change-Id: I8e6f14a242866e3ee7cfb8ecade4697d6bdfb4d4
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QDateTime::addMsecs does check for overflow. I don't know when this
has changed, but it doesn't matter.
Change-Id: I44c6ba5e88cce544c0d1ef33fa38a528a96b0b7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Only unzip the test suite in initTestCase(), but run the tests from
runTestSuite(). This is mainly useful when running specific a unittest
locally, no need to wait for the whole zipped test suite to run.
Change-Id: I518a2de716d3d07fb5a78298f1bd3ab2759e744b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use TableScope helper class to make sure the table used for the test is
really cleaned up before usage.
Change-Id: I45fffcd13acae6032636ae07097b14af174ede21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Sync the IBASE driver behavior for primaryIndex() and record() with the
rest by assuming that the given table name has the correct casing.
Change the tests for these two function to pass an unescaped table name.
Change-Id: I6d96359f97e1acc6970b9a22fdf0e968a616b7bc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
[ChangeLog][SQL][SqlQuery] Added two new functions
boundValueName()/boundValueNames() to return the names of the bound
values.
Fixes: QTBUG-97847
Change-Id: I8df5f15e8df13141a34d38b0a2e13b37f4e7829c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We can expand the testing a bit bit verifying that also
created windows work as expected, and that QWindow DPR
is updated when Screen DPI is changed.
Change-Id: I082aac18b6b086c69c16681977b7eaa6c3e54ee0
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
The alias created by QSqlRelationTableModel to avoid duplicated field
names was not escaped which lead to an inconsistency in the returned
alias name from the database (e.g. postgres lowers all unescaped column
names).
Also adjust the test for QSqlRelationTableModel to use escaped table
names for it's tests and fix it for QIBASE.
Change-Id: I01426320c0c1a70cb9bf8e6dfa2f8b07dbb1c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When a context object is provided, then callers expect that the functor
or slot is executed in the thread of the context object. And if the
context object has been destroyed by the time the permission response
is received, the functor shouldn't be called at all.
To implement this, we either have to plumb the call back through a
signal/slot connection and benefit from QObject's infrastructure. This
is not practical here, as we don't have an "engine QObject" that would
emit a signal.
Instead, we can create a QMetaCallEvent explicitly, following what we do
in e.g. QHostInfo, and using a temporary QObject that handles the event
to then call the functor.
Add test coverage.
Pick-to: 6.5
Change-Id: Id878e45b304857304165ab4a7c6aae76fbee46ce
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
[ChangeLog][Deprecation Notice][QtCore] The QtFuture::makeReadyFuture()
method and all its specializations are deprecated since Qt 6.10.
The reason for the deprecation is that the method has a
makeReadyFuture(const QList<T> &) overload, which behaves differently
from all other overloads (including other non-const ref QList
overloads).
Use QtFuture::makeReadyVoidFuture() when you need a ready void QFuture,
or QtFuture::makeReadyValueFuture() when you need to propagate the
input type to the returned QFuture, or QtFuture::makeReadyRangeFuture()
when you need to create a multi-value future based on an input
container.
Fixes: QTBUG-109677
Change-Id: I55125269989df0a02840d5ddd5763ef5f1070df5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
[ChangeLog][QtCore][QFuture] Added QtFuture::makeReadyVoidFuture()
and QtFuture::makeReadyValueFuture().
Basically, these methods behave like QtFuture::makeReadyFuture(), but
QtFuture::makeReadyValueFuture() does not have a "const QList<T> &"
specialization returning QFuture<T> instead of QFuture<QList<T>>,
which allows it to always behave consistently.
This patch also introduces usage of the new methods around qtbase.
Task-number: QTBUG-109677
Change-Id: I89df8b26d82c192baad69efb5df517a8b182995f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
[ChangeLog][QtCore][QFuture] Introduce
QtFuture::makeReadyRangeFuture(). This method takes a container
which has input iterators and returns a multi-value
QFuture<ValueType>, where ValueType is the underlying type of
the input container.
This commit also replaces the usage of buggy
QtFuture::makeReadyFuture(const QList<T> &) overload with the new
method.
Task-number: QTBUG-109677
Change-Id: I019e62eac74c643d88a65b3cc0085bc7c33bc712
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This can happen if the same project has two or more Q_IMPORT_PLUGIN
macros in their source. And that can happen when converting from qmake-
based builds to CMake, as qmake didn't generate a source file with the
macro but CMake does.
[ChangeLog][QtCore][QPluginLoader] staticInstances() will not call
duplicated registrations of the same instantiation function, which can
only happen as a result of duplicated Q_IMPORT_PLUGIN for the same
plugin name.
Fixes: QTBUG-102745
Pick-to: 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174fb9dd62d8583d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QMultiHash has access to two sizes: one of them is shared with QHash,
stored in QHashPrivate::Data::size, which counts keys; the other, which
is what our public size() function returns, is stored in
QMultiHash::m_size and counts plain (key,value) entries. We forgot to
update it in the non-const operator[] that created a node.
I've reviewed the rest of the code and can't find any more places where
the item count may be changed and m_size isn't updated.
[ChangeLog][QtCore][QMultiHash] Fixed a bug that caused an element that
was created by operator[] to not be counted, resulting in a hash map
with an incorrect element count and which could cause an assertion
failure depending on how the hash was later mutated.
Fixes: QTBUG-112534
Pick-to: 6.2 6.4 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17527ec274e1d99e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
The overhead of making new custom classes appears to be less than
constructing a generic std::function.
[ChangeLog][QtCore][QRunnable] QRunnable::create can now take
non-copyable functions as argument.
Task-number: QTBUG-112302
Change-Id: Ied870f13ca6c7eaa14ed6eff9c4e676c7b73881c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Add a testcase for toSQLTCHAR() to make sure to pass the correct number
of encoded characters to the odbc functions.
Pick-to: 6.5
Task-number: QTBUG-112375
Change-Id: Ib67fab678fc3d0b098aedfc6fa9ec2139f2e75c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
A QSqlError is not equal when the native error code differs. The
database and driver text should not be considered during the
comparison because they might differ due to e.g. different locales.
[ChangeLog][QtSql][QSqlError] The comparison operators have been fixed to
take both error type and error code into account.
Change-Id: Ie7511f183f88dd454eb165c6ff237e51b79d1c08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
One each of L1 and non-L1.
Will help porting that API to QAnyStringView.
Pick-to: 6.5
Change-Id: I51afc07c5b2384409c2627164e95265265fbb544
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the trailing frame just had PRIORITY we would early-return, though
this meant we didn't check if the frame had the END_STREAM flag set,
leading some requests to certain servers to hang.
Fixes: QTBUG-111417
Pick-to: 6.5 6.4 6.2
Change-Id: Iac174dc5aeca30d5d19fae35f303983de9841847
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Instead of adding more QString::fromMyFavoriteStringImpl(), just check
that
QStringView{myFavoriteStringImpl}.toString()
works.
It does.
Pick-to: 6.5
Task-number: QTBUG-111886
Change-Id: I337282611360b4a56a10c8acfd2d7d53ea196d5b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the move ctor and move operator for QSqlIndex, also add an explicit
testcase for QSqlIndex
Task-number: QTBUG-109938
Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This will be helpful in a number of places, in particular in order to
support enums of different sizes in QML. We record the type as string in
the JSON output and as QMetaTypeInterface in the generated C++.
Task-number: QTBUG-112180
Change-Id: I943fac67f8b25b013d3860301416cdd293c0c69e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
An implementation of C++20 std::to_address, a prerequesite for
QSpan<>.
The test cases are inspired by libstdc++'s test suite, just to avoid
missing some cases, but the to_address implementation is white-room.
Fixes: QTBUG-108430
Change-Id: I4c092fdd7a56c0b279068e341bbf91a725ca3b1f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QListView generates a move, when an item is dropped directly behind
itself. This causes unexpected behavior, e.g. item widgets getting
discarded.
This patch prevents a move from being generated in that case.
It adds an autotest to tst_QWidget, to verify item widgets and item
data do not get discarded in case of a no-op drag&drop.
Fixes: QTBUG-100128
Pick-to: 6.5 6.2
Change-Id: I02a755320a7b71dad218293c9c94c88da6507423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
While doubleFunction's body is empty, it takes its argument by value,
which means copying. Copying an uninitialized double is a gray zone
(if you follow the partially-formed paradigma, it's UB; though the std
may allow it some types, most notably std::byte and uchar; probably
not double, though). Converting an uninitialized int into double is
most certainly UB.
Fix by initializing both d and i.
Found by GCC 11's -Wmaybe-uninitialized.
Pick-to: 6.5 6.2 5.15
Change-Id: I103fb72bf4b8792a292346007f498dc6349e9c68
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... by supplying a TestThreadPool that waitsForDone() with a defined
timeout in the dtor.
When tests hang, this will now print an intelligible message instead
of just the generic watchdog-killed-process one.
Also replace all QVERIFY(waitForDone()) with the same code used in
TestThreadPool's dtor and add a comment in a place we'd rather not use
these tools.
Pick-to: 6.5 6.2
Change-Id: Ifd2b3372eb7c7337a3ba77d003e45dcd77e23545
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The test function occasionally can fail on CI/Windows, when a
certificate update on www.qt.io requires installing a new root
certificate on the test VM.
This patch blacklists the test class (which has only one test function)
on Windows. It adds diagnostic output, so future failure reasons can
be established from CI artifacts.
Pick-to: 6.5
Task-number: QTBUG-63481
Change-Id: If686d006f379fe6dbfb0d11d80b8455f72fdbb09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Amends 4d90c4e74a, after which the test
became flaky. We need to wait for the functor to be called before
quitting the thread, otherwise we have no guarnatee that any of the
queued metacall events have been processed by the thread. Since
QThread::quit is thread-safe, we can just call it from within the
functor. This guarantees that at least one of the single-shot timers
is processed before we quit.
And since QTimer::singleShot has special code paths for 0-ms timers
(going through an explicitly queued QMetaObject::invokeMethod call
rather than through an actual QSingleShotTimer object), we need to run
the test logic with different timeouts to cover both code paths.
Task-number: QTBUG-112162
Pick-to: 6.5 6.2 5.15
Change-Id: Ide1e7b4b74dcbda72144a0d73ef5f64b0694ddbc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test can collide with a 1960-01-01 transition in some zones, so
move it to Jan 2nd to avoid that.
Pick-to: 6.5
Change-Id: I5286cadc0de0b66283253b0ac736f23a2add0c8f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
A foreign window can be used both for embedding a Qt window into a
native window hierarchy, or for embedding a native window into a Qt
window hierarchy. In the former case, we should not modify the foreign
window in any way. Since the platform does not know anything about the
intended use case at the time of the foreign window creation, it should
avoid modifying the foreign window in any way, and should instead pick
up the foreign window state and reflect that through QWindow.
Pick-to: 6.5
Change-Id: Id2e39d101277ecebd656d615cea3e7f734a4b0a6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The member variable indexBeforeChange is member-initialized with -1 and
changed to the current row, if a valid index is set.
It is used to check, if the model has been reset to an empty model
and/or the index has been invalidated. The result is used to decide, if
the currentIndexChanged signal is emitted or not.
If a combo box had a valid index and it is invalidated afterwards
(e.g. because the combobox has no more entries), indexBeforeChange is
not reset to -1. The redundant signal emission is therefore prevented
only the first time.
This patch resets indexBeforeChange if the index is invalidated or the
last item is removed from the combo box.
It also adds a no-op check to tst_QComboBox::currentIndex.
The test data sets "check that setting the index to -1 works" and
"check that current index is invalid when removing the only item" check
the respective use cases.
As a drive-by, variable names and QObect::connect syntax have been
cleaned up in tst_QComboBox::currentIndex.
Fixes: QTBUG-108614
Pick-to: 6.5 6.2
Change-Id: Ib6dfa887d9247f2c47df065039d69ba57c32fa24
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QT_SCREEN_SCALE_FACTORS is in many cases set on behalf of the user,
instead of by the user, so we should apply the standard app
scale factor policies to it, instead of interpreting it
as a user override.
Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.
Users who want to override can set
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
to restore the default Qt rounding behavior.
[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.
Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: I936e96671fe2a0a43c3e8129f0768875cb011103
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The usual problem, the usual fix: default the addResult() template
argument to the class template argument, cf. e.g. wg21.link/p2218.
[ChangeLog][QtCore][QPromise] Added support for calls to addResult()
with braced initializers.
Fixes: QTBUG-111826
Change-Id: I9ad7294dbcefbc5d2609ca3d9e7304dbeb8b3f41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Currently, Qt assumes that enums always have int as their underlying
type (both in QMetaEnum::keyToValue and in the QML engine). This change
makes it possible to to retrieve the underlying type from an enum's
metaype - or rather, a metatype of an integral type with the same size
and signedness. The use cases aobve don't really rely on the exact same
type. In most cases, we wouldn't even need the signedness, however that
is already available anyway, and it will come in handy once QML supports
bigint, and we need to decide whether we should return
While it would be possible for individual users of this function to
manually query the size and signedness, having a function returning a
metatype offers additional convenience - especially in QML, where the
conversion APIs generally operate on metatypes.
Task-number: QTBUG-27451
Task-number: QTBUG-84055
Task-number: QTBUG-112180
Change-Id: Icf733b42df0ea64017d69f4d94cb7c855d9e3201
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
... and also extend the documentation to explain this case explicitly.
Fixes: QTBUG-107545
Pick-to: 6.5 6.2
Change-Id: I9414cc677b037989de60e97871485018e5c8a569
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add support for time zones in the IBASE driver, which was introduced in
firebird 4.x. TIMESTAMP WITH TIME ZONE data type is supported in order
to store and retrieve a QDateTime with the time zone.
Task-number: QTBUG-111879
Change-Id: I631b4262d17796a17630379b7d659f88244a23ad
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
A null QString used to make a QVariant containing it null in Qt 5, but
this is no longer the case. Add a test that get_if works as expected.
Task-number: QTBUG-111598
Change-Id: I0f3511e1b33f4a9d67755269455680feda22ddca
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This second patch of the series implements get().
Unlike other get() implementations in Qt, don't use my trick with the
constrained friend free function here. Instead, provide the four
overloads manually, like mandated by the standard library for
std::variant (and, indeed, tuple), such that these functions can also
be used on subclasses of QVariant.
[ChangeLog][QtCore][QVariant] Implemented the type-based std::variant
access protocol (get<T>()/get_if<T>()) to allow easier access to the
contained element than the previous solution of casting data(), as
well as to allow generic code to treat QVariant and std::variant the
same. The holds_alternative<T>() function is not provided, since it's
the same as get_if<T> != nullptr. The index-based variant access
functions (get<I>()/get_if<I>()) are also not provided, because,
unlike std::variant, QVariant does not have a bounded number of
alternative types, and QMetaType IDs are not (all) compile-time
constants.
Fixes: QTBUG-111598
Change-Id: Id7bc41f7d91761b3483ec5604f1a4685c8079844
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QVariant supports non-default-constructible payloads, in principle
(QTBUG-105140). And fromValue() works with such types, but value()
insists on providing a wide contract and therefore accidentally
requires default-constructible.
We can now invent other "Qt-ish" API like optional::value_or() or a
value() that returns optional<T>, but we should first get the
interface in that generic code must use, and which at the same time is
the most versatile, because it gives write access to the element
stored in the variant: [variant.get], consisting of get_if(), get(),
and holds_alternative(). The latter is the same as get_if() !=
nullptr, so we won't provide it.
This first patch implements get_if(), adds test for it.
As a Hidden Friend supposed to be called with explicit template
arguments, we run into the problem that wg21.link/P0846 solved for
C++20. Add the usual work-around, and check it works.
The ChangeLog will be on the last patch.
Task-number: QTBUG-111598
Change-Id: I23f57ea2de3946944810c5552c68a7a3060a44f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I must have broken this in the 6.5 work I did for QMetaType and
QVariant, but I haven't searched which commit exactly did it. Our
QVariant tests are old and thus only checked the type ID, which meant
that they caused the registration by the act of asking for the ID in the
first place; this commit adds a couple of explicit checks for the type
registered by name before the ID.
Fixes: QTBUG-112205
Pick-to: 6.5 6.5.0
Change-Id: Idd5e1bb52be047d7b4fffffd174f1b14d90fd7a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
For single-shot timers, at least. QSingleShotTimer had either an
optimization or the only way to make new-style slot invocations by
storing the QSlotObject pointer and calling it directly. Instead of
doing that, let's just actually connect and let QObject handle the
actual delivery.
[ChangeLog][QtCore][QTimer] Fixed a bug that caused slots connected to
single-slot timers using the new-style connection mechanism to be
delivered in the wrong thread.
Fixes: QTBUG-112162
Pick-to: 5.15 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174eadb227ab65ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The necessary QT_ENABLE_P0846_SEMANTICS_FOR is already provided by
qpoint.h) here. Add a test to confirm it works.
Amends 0e22001a3b.
[ChangeLog][QtGui][QVector2/3/4D] Fixed manual get<I>() calls
(Tuple Protocol) in C++17 mode.
Task-number: QTBUG-111598
Change-Id: Id4a118b6439c2d1471b921f8d92ee558f9902eab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In C++17, unqualified lookup doesn't find function templates that
require ADL from a call with explicit template arguments, unless
another function template of that name is in scope (otherwise, the <
is parsed as operator less-than instead).
P0846, merged for C++20, fixes this to repeat the name lookup, parsing
the < as indicating a template.
We have API in Qt (Tuple Protocol for some types, e.g. QPoint) that
work for the purpose of Structured Bindings, but don't work for manual
unqualified calls when P0846 semantics are missing, and we're adding
more, to QVariant, so add a macro to handle the issue.
The macro simply declares a function template overload of the given
name for a throw-away struct, thereby bringing, for that one name,
P0846 semantics into C++17.
When we require C++20, we can drop this again.
Amends:
- fb6b7869e8 for QPoint(F)
- 8ae9431c79 for QMargins(F)
- 0e22001a3b for the rest
[ChangeLog][QtCore][QSize/F, QMargins/F, QPoint/F] Fixed manual
get<I>() calls (Tuple Protocol) in C++17 mode.
Task-number: QTBUG-111598
Change-Id: I2ffaef12c5bb6d82f75ce78a7c03c6789dfa0691
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This is useful for a lot of applications that render text coming from
sources which already support arbitrarily numbered lists (like chat
applications for example). Application-side workarounds usually have
significant overhead; and this feature has been requested multiple times.
It should be possible to both read and write HTML with the <ol start="x">
attribute, and read and write Markdown with arbitrary numbers for the
first item in a list.
[ChangeLog][QtGui] QTextList now supports specifying a start index using
the new QTextList::{setStart, start} functions. The HTML start attribute
on ordered lists in rich text documents is now parsed and used when
rendering a text list. Non-negative indices in markdown lists are now
also parsed and written properly. This allows starting a list with a
different number than 1.
Fixes: QTBUG-30407
Fixes: QTBUG-65384
Task-number: QTBUG-107562
Change-Id: Ib35b9378d9134ffedaa2d92f728b0984793aa7c1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Change the signature of stateChanged(int) to emit Qt::CheckState
instead. This was forgotten during Qt6 porting so we have to wait for
Qt7.
Task-number: QTBUG-104688
Change-Id: Ica2504e5b9ae68612de81524faed0f31c9b10402
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
I got tired of being told off by the inanity 'bot for faithfully
reflecting existing #if-ery in new #if-ery. Retain only the
documentation and definition of the deprecated define.
Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This reverts commit 9286d46ee2.
Reason for revert: Should be fixed by 5c6814fb18760f65bab0f8b9cd623ee5c874a58d
Change-Id: I3a161df445af8dcbb61138d57e931a093a319027
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We test setKey() in repeated_setKey() these days, so speed up the test
of the test suite ever so slightly by passing the key to the ctor
instead of an explicit setKey() call.
Pick-to: 6.5
Change-Id: Ia2378c0f59cbfa9d95a0f3665b06655332247e2c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Cleanup tst_databases.h: fix identation, replace qGetHostName() with
QSysInfo::machineHostName(), use QSqlTableModel::EditStrategy instead
int for submitpolicy data to avoid casts.
Change-Id: I4917ca23c4b39ab15bc0e006e6111baefb82d278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fix some tests so they will correctly work with Interbase (Firebird 3.x)
Change-Id: Ib3c8ceaf31fa01af3a00a9772350b49cee8b2342
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
A table name or identifier must not be longer than 30 (< Oracle 12.2) or
128 bytes (sadly not characters).
Change-Id: I49192afaf908e12f5cfd20c754640b6117b03a71
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QColorDialog supports entering hex rgb values only with a leading #.
That makes copy/paste impossible whenever the copy source has plain
hex, without the leading #.
This patch automatically adds a leading # character, when missing.
As a drive-by, QObject::connect statements are altered to PTMF syntax,
amending 9eb1b9e86ce3d1004e39e8ab7c7ecb6796d6df1a.
The patch also adds an autotest for the new functionality.
Fixes: QTBUG-111742
Pick-to: 6.5
Change-Id: I4ced29dc8b543457f411a3fa0ac756b550cdb09f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Previously the widget stayed black and we printed
"QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly,
this should not happen".
To make it work the compositor is recreated in addition to the rhi
and the widgets are informed with the internal events.
Change-Id: I982d08bd3530478fe0f827080154c008a92a812e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When this code was using QByteArray, whose data() is never nullptr,
the strings presented to the underlying C APIs were always valid NTSs
(nullptr is not a valid NTS).
With QByteArrayView, or with QT5_NULL_STRINGS != 1, this is no longer
the case. Check that all implementations are fine with that.
Pick-to: 6.5 6.4
Change-Id: I78251288a4784440af4a2daf095aed7c53867287
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QCryptographicHash is move-only these days, so
QMessageAuthenticationCode should not be left behind.
[ChangeLog][QtCore][QMessageAuthenticationCode] Added move
constructor, move assignment operator and swap() function.
Fixes: QTBUG-111677
Change-Id: I420f24c04828e8ad7043a9e8c9e7e2d47dd183e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is private for now. It's very handy to have anonymous properties
for the QML model/delegate adaptors. There are models with only
"singular" model data that doesn't have any sub-properties. Such model
data should be available from the model object via an empty string as
role. This way we can get rid of a lot of special casing.
Task-number: QTBUG-104752
Change-Id: I229e355a7cab064ee1c9f89557bc0244a5d0c90a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Signals of the vertical scroll bar were blocked when scrolling with
pageUp/pageDown keys or clicking on the scroll range outside the
scroll bar. This has lead to inconsistent signal emissions:
The vertical scroll bar's valueChanged signal was emitted only on
single steps and when the scroll bar was moved with the mouse.
When it was moved in page steps by clicking on the scroll range or
pressing pageUp/pageDown, it was not emitted.
This patch removes the signal blocker for page step movements, which
was added in 94fd108ea4 to replace
explicit calls to blockSignals(), which were added in
c14d442b08ac81327b173b0a220c7b1840667899.
The patch also adds test function to tst_QPlainTextEdit to check if
the valueChanged signal is emitted correctly.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-8682
Fixes: QTBUG-25365
Change-Id: I4385a5387c91497f623978e35bbbe3e06f473afe
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Drive-by changes:
- Cleanup creating a QChar[], by creating a char16_t[] and
reinterpret_cast'ing it
- Use human-readable Unicode characters where possible
Pick-to: 6.5
Change-Id: Ice2c36ff3ea4b6a5562cf907a7809166a51abd28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previous setup of the test was failing in minimal static build if built
using the unity build because of the explicit inclusion of the qtcore
source files. By removing them, it surfaced that QFileSystemEntry
doesn't export all its necessary symbols for testing. So this patch does
that, as well as removing the qtcore sources from the test. It also
makes sense to make the test private.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Icdabe32485b7ce4ed6049bcc24918f531406b4bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The signal has been emitted also, when the slider position has changed
without a value change (e.g. on QWidget::show() or on resizing).
This patch stops emitting the signal without a value change.
It adds a verification to tst_QAbstractSlider::setValue(), that
valueChanged is not emitted on a no-op value change.
As a drive-by, the patch removes an unnecessary assignment and
changes signal spy constructions to PTMF syntax.
Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-25365
Change-Id: I9932e45d4e680aa53422ca75aa42a16306213a38
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
I.e. tryLock(chrono::milliseconds) shouldn't call the int overload as
that truncates the timeout (milliseconds is typically int64_t).
Add a note to the tryLock(millisecons) docs that passing
milliseconds::max() will make it wait forever to obtain the lock.
Task-number: QTBUG-110059
Change-Id: Ib48d9b1b117ce816348625331543d6ba8a788973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QCompleter::setPopup() sets window flags, focus policy, parent, focus
proxy, item delate and installs an event filter, before the popup
argument is assigned to d->popup.
In the QCompleter::eventFilter override, QObject::eventFilter is called
(under more) if d->popup is nullptr.
If a custom class is inherited from QCompleter and it overrides
QObject::eventFilter(), this causes an infinite loop.
This patch re-factors the method.
- early return is added if the new popup != d->popup
- remembering the existing widget's focus policy is constified and
moved ahead of the delete secion.
- assignment of d->popup to popup argument is moved after the delete
section.
- after assignment, the argument variable is no longer used.
The refactoring eliminates two issues:
- potential risk of double-installing event filter due to missing
early return.
- inifite loop if inherited class installs another event filter.
The patch adds a test function to tst_QCompleter, which implements an
inherited class, installs an event filter on a popup and checks if a
ChildAdded event hass been recorded.
Fixes: QTBUG-111869
Pick-to: 6.5 6.2
Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Some of the mockplugin tests needed to be excluded from the unity build
manually. In addition, MSVC's complain about include <QtCore/QString>
instead of <QString> was addressed here since it was breaking the unity
build as well.
Some other independent executable and libraries have to be excluded
manually as well.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I1f21f8484b4d3b1c399e2118ab3a71e682a3006a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Previous setup of the test was failing in minimal static build if built
using the unity build because of the explicit inclusion of the qtcore
source files. In order to resolve this, I removed the inclusion of
qtcore's headers and made the test private.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id1c7b3b65ca2078354c235a718ff3e93a65362e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When possible, I replaced add_executable with
qt_internal_add_executable.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I643d2e27f0d880fe9b6cec7af790e4c99227fb0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
All the other overloads are implemented using the new one.
Windows change relies on the pre-check in the code review making sure it
compiles.
[ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds)
overload.
Task-number: QTBUG-110059
Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is expected to be temporary and to be investigated afterwards.
Task-number: QTBUG-108844
Pick-to: 6.5
Change-Id: I0a571dad2b99ceaa0fd48e5cdd81057e49e55ddf
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Add support for MYSQL_TYPE_BIT. Since the bitfield can be max 64bits,
store it in a uint64_t. Writing such a value as MYSQL_TYPE_LONGLONG
works as expected but receiving it needs a special handling.
[ChangeLog][SQL][MySQL] Added handling for Bit-Value Type - BIT.
Fixes: QTBUG-21326
Change-Id: Id20e3316caf6703b3bec8a828144494a20693fd8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add a helper class which makes sure that the used table does not exist
before usage (e.g. due to leftovers from previous tests) and is properly
cleaned up on exit. This also allows to remove all usages of
safeDropTable().
Change-Id: Iefeffbd10e2f2f67985183ea822d7b6dd2b80be7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
E.g. tst_qprocess_and_guieventloop uses write-read-write.
This is useful e.g. when not building all of qtbase, but only a specific
unittest while hacking code.
Change-Id: Id97c6c09c180ba35554d75877a434cb258a6243d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add a function QHostAddress::isPrivateUse to test
for IPv4 private networks and IPv6 unique local unicast addresses.
Task-number: QTBUG-111211
Change-Id: Ic8abefa7aa974fa83118aeb9f2506a5713f79f0d
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
250ca8d5f8 changed the qConvertToNumber
to have a std::optional return instead of a boolean out-argument.
In doing so a code path that was supposed to report a failure (string
could not be converted to an integer) accidentally starting reporting
success (and converting the string to 0).
The problem is that the `ok` check from QString::toLongLong was
accidentally dropped in the refactoring; previously the function set
`ok` to false and returned 0, now the function just returns 0.
Instead, amend that return to return nullopt (because the conversion has
failed).
Change-Id: Iaedef5463f3ec500a97bd4c9bbddf977f66df61a
Pick-to: 6.5 6.5.0
Fixes: QTBUG-111867
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Change-Id: I3087bff60e77c0eaa5818a5405c97628ce7f6b79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
state->rate is always larger than or equal to state->bitsInQueue;
when bitsInQueue == rate the queue is consumed and bitsInQueue is set to
0 again.
Done-with: Marc Mutz <marc.mutz@qt.io>
Pick-to: 6.5.0 6.5 6.4.3 6.4 6.2 5.15
Change-Id: I56d268a19fb3cd542cc027edc962253f09d97a14
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In most QObjectPrivate-subclasses, the Q_DECLARE_PUBLIC macro is used in
the private segment of the class declaration. In that case, the q_ptr
becomes a private member of the private class, and then the
QObjectPrivate::connect function can no longer be used, as it needs to
access the d_ptr.
Fix this by declaring QObjectPrivate, and the static-assert-helper, as
friends of the class using the Q_DECLARE_PUBLIC macro.
Adapt the QObject test by moving the Q_DECLARE_PUBLIC macro into
the private section of the test-private, and add a compile test.
Pick-to: 6.5 6.5.0
Change-Id: Ifc04be3b305221e138b1e08bb3a3838d871f4fcb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
And fix coding style a little bit around the change.
Change-Id: Idfc232a751ccc08d0680351d48d4a68f09f18c1f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fix coding style, replace QVERIFY(a == b) with QCOMPARE, use nullptr,
use a lambda for a local slot, and wait for the test widget to go away
so that it doesn't break following tests.
Change-Id: I1a4f790084b92301444a96a1449c84bf3317b88a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
... to make large data usable from other test functions.
Pick-to: 6.5 6.5.0 6.4 6.4.3 6.2
Change-Id: I302070121a8bb49f373c7711bc3ab9e6418874ef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QAIM::match() supports different matching modes. The wildcard match mode
was never meant to be specifically a filepath globbing wildcard, but
rather a generic one -- something like "*" should match into a
string like "a/b/c". This is a regression from Qt 5, where
QRegExp::Wildcard was ported to only allow for path globbing
rather than generic matching.
[ChangeLog][QtCore][QAbstractItemModel] QAbstractItemModel::match()
now uses more generic wildcard matches rather than file path globbing.
Please refer to the documentation of
QRegularExpression::wildcardToRegularExpression() for more information
about the differences.
Change-Id: I28b8a76b01fdd9c5dd8f99528fac1c7b704564bc
Fixes: QTBUG-104585
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends 76c63936d3 by adjusting the test case.
We still just test that we can open a file based on a filename that we came
up with ourselves.
Also, update usage documentation and make the snippet a bit more relevant.
Change-Id: I5bf00210d74e2a73d5a71a09a5beb1b3f6f8e225
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QTemporaryFile is not designed to promote temporary files
to non-temporary files. So, it, quite importantly, does not
care if the content of the files are flushed to disk before
renaming it into its 'final' destination. This is what
QSaveFile is for.
This was much more time-consuming than intended since I had to debug
this quirk about calling size().
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-111397
Change-Id: I15b300f6a5748ad3a0be983545ea621269a12ecd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add support for shader input output interface blocks in Metal
tessellation pipelines. This feature is builtin to other rhi supported
tessellation backends (OpenGL/Vulkan).
Metal tessellation is implemented as compute pipelines for vert and
tesc, and a render pipeline for tese and frag. The shader conversion
from GLSL is handled by SPIRV-Cross, which has a particular way of doing
things. Rhi must setup the vertex inputs for the tese - frag render
pipeline to read from buffers written by the tesc compute pipeline,
following SPIRV-Cross conventions. This includes ensuring correct
memory alignment per MSL Specification.
In order to enable input output interface blocks, reflection of struct
members of QShaderDescription::InOutVariable is required. Reflection of
QShaderDescription::BuiltinVariable array dimensions is also required to
support variable size tese builtin input gl_ClipDistance.
An acompanying patch to QtShaderTools is required.
Change-Id: Id94e86caef211485afc187bb79fe3d0619d02cf0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
QPropertyAlias might be deprecated, but using it should still not fail
to compile.
Pick-to: 6.5
Fixes: QTBUG-111735
Change-Id: I486cddb424b60cd3e5c539e26afca3726e29bb09
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
If a composite widget is put behind one of it's contained children via
QWidget::setTabOrder, then our logic might replace the composite widget
with the contained child. In that case, we'd end up with a broken tab
chain, possibly resulting in incomplete clean-ups and triggering asserts
when shutting down the UI.
Handle this by stopping the last-child searching logic at the respective
other widget, and by not allowing both widgets to be the same.
Augment test case, and apply some minor refactoring to the code.
Pick-to: 6.5 6.2
Change-Id: I7d97dfa85315b6c01daa283253025d94a1727048
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The choice of whether to show a message again is per message,
so when showing a new message we need to reset the check box
back to its default checked state, otherwise the user might
mistakenly dismiss more than the indented message.
[ChangeLog][Widgets] QErrorMessage will now reset the check
box for showing a message again for each new message shown,
as each individual message has its own suppression state.
Pick-to: 6.5 6.5.0
Change-Id: I86d4bb5eabdb5b7a478c03516108a5edf87fcbe3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The parameter names were previously "lhs" and "rhs", which is incredibly
abstract for a testing framework. One of the parameters will tend to be
a baseline value to compare against while the other is the result of
some action we want to test. Thus I suggest they be renamed "computed"
and "baseline".
This way we can, hopefully, retain the semantic that the 'left'/first
argument is the computed ('actual' in QCOMPARE) value while the
'right'/second argument is the baseline ('expected' in QCOMPARE.)
Change-Id: I3e0fdce2a3f1faca06fdf7184ef6e0eb9724d990
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
A glob pattern has different semantics depending on whether
it's used in "filepath mode" (FNM_PATHNAME) or not.
QRegularExpression only implemented the former, but the latter
is also useful, and possibly more "intuitive" for certain use
cases (e.g. offering users a simplified version of regexps that
however still need "*" to match a "/").
Add this support. The problems highlighted by QTBUG-111234 have
not been addressed, I've just amended a bit of documentation
relating backslashes.
[ChangeLog][QtCore][QRegularExpression] Support for non-filepath
wildcards has been added to wildcardToRegularExpression().
Fixes: QTBUG-110901
Task-number: QTBUG-104585
Task-number: QTBUG-111234
Change-Id: If9850616267980fa843bda996fcb4552b5375938
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Not relevant for the CI as that does not run with any real Vulkan
implementation. (and Lavapipe works if that's used)
As the investigation in the Jira issue shows, there is no proper
conclusion yet on why rendering to a slice of a 3D texture breaks
the content of other slices that have image data written to them
before that render pass targeting the slice. It would seem that
transitioning to COLOR_ATTACHMENT_OPTIMAL has some unexpected
consequences for slices that are not targeted by the render pass
with Mesa on Intel.
(NB rendering to a given 3D texture slice works via
VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; and how often this is needed
in practice is unclear, typical volume rendering cases will anyway
likely just upload data to the slices of a 3D texture, not rendering
to them)
The problem is still clearly visible in the tex3d manual test (when run
on affected Linux machines), this we keep unchanged for the time being
so that the issue can be examined further. However, the autotest is
changed to prevent the issue from occurring (render to slice first,
then upload to other slices) since it causes confusion when the test
is run locally on various developer machines.
Pick-to: 6.5
Task-number: QTBUG-111772
Change-Id: I4dc4c2413f8c518f377a33065992ad786a5ff44f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Separate 1D mipmap generation support from rendering into an 1D texture.
Those are two independent features, so have a separate feature flag for
both instead of using just one.
This will then be symmetric with the 3D texture features, where now we
have a new flag to report support for generating mipmap for 3D textures.
(whereas 3D texture as a render target is already covered by
RenderTo3DTextureSlice)
Change-Id: Ie5e1f056a7d1c341d90cd7fc522877a3f2da3290
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The polyfill for file input on WASM now makes use of the supplied
filter list.
Some changes were introduced in the abstraction for filters so that
they are usable both for the new file API and the legacy file input.
Change-Id: Id6341be4d6a1647e17382d13da7be42491cfaf80
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The note that QSqlDatabase::exec() is deprecated was added more than 12
years ago so it's time to also mark the function as such.
Change-Id: Ic5e7c31b3ff5b21e16e2640548cba1a4baaeeb1c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Apple lets us know that:
warning: 'sprintf' is deprecated: This function is provided for
compatibility reasons only. Due to security concerns inherent
in the design of sprintf(3), it is highly recommended that you
use snprintf(3) instead.
Pick-to: 6.5
Change-Id: I3130b3c7b636466b5e77adc5cb05ad4ce1faee11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We test moc's support for [[deprecated]], so don't warn about it.
Pick-to: 6.5
Change-Id: Ifda2b81c14cb9802db4bb1d0a1eb17d978ad492a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
remove toHex() as it's not used at all and qTableName() with two params.
Also remove some SQLite 2 specific stuff
Change-Id: If285febdfbee5833f7174d70f386bd54674bd539
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Use a scope guard to print debug info in case of an early return.
Silences clang warning about sprintf being unsafe and deprecated.
Change-Id: Idcbfde1a6f2eb1143f51c1e5ecedbf3fe90d8ec8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The doc said positive values for a negative range were intermediate
but the code actually rejects them if the value has an overt plus
sign, so make clear that intermediate is only for the case without a
sign. Incidentally comment on a test where it might not have been
obvious to the reader that a space is the locale's digit-grouping
chracter.
Pick-to: 6.5 6.5.0
Change-Id: I3edab74fe8c2cbe8448c0e523676f1fd0d0d8a9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
From the manual page:
Note: modern applications may prefer to use the interfaces
described in utimensat(2).
Change-Id: Ib20d8b9b50626233852ca351452ce90841a39603
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make sure to properly close the cloned database connections and allow
one test for sqlite
Change-Id: Ia4eb4a684a3c432844e4b2a77bff69655b53f9b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make them templates, for two reasons:
- so they can accept std::pmr types and, in general, any basic_string
with custom allocators and char_traits
- to break overload ambiguities with the Qt string view types
Also, add the missing C++20 char8_t overloads.
Also, avoid creation of a QString in the sizeof(wchar_t) == 2 case
(Windows). Add a comment to optimize for the sizeof(wchar_t) != 2 case
later.
Found in API review.
Pick-to: 6.5
Change-Id: I30139520f582a38863a0936f8eca4b1ed33e37c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
otherwise there is no way to synthesize a "click" through the a11y API.
toggleAction only leads to a toggled() signal but the user may be more
discerning and only listen to clicked() (or QAction::triggered) to react
to **user** events not all toggle events. as such pressAction is always
superior to toggleAction when user input is meant to be synthesized
through a11y tooling.
Change-Id: I7f024d57087b545d3cfd1805026ea538b0b3e166
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
C++20 doesn't like arithmetic with enums anymore. While this hasn't
caused immediate pain, yet, fix it pro-actively for an imminent patch.
As a drive-by, fix the missing space at start of comment.
Pick-to: 6.5 6.4 6.4.3 6.2
Change-Id: Id08bb227c587bc7b900c593a7b6d2655ca32eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also add one for types that are neither copy- nor move-constructible.
In contrast to resize(n), the QVLA(n) ctor worked for such types, so
make sure it stays that way.
Pick-to: 6.5 6.4 6.4.3 6.2 5.15
Change-Id: If54fbc9dd6a4808175c4bcb0ffb492b33c879746
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Use it in a few places.
[ChangeLog][QtCore][QMessageAuthenticationCode] Added
QCryptographicHash-style resultView().
Change-Id: I745d71f86f9c19c9a9aabb2021c6617775dab1cf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Both QTimer's and QObjectPrivate's destructors print a warning if the
current object lives on another thread and has an active timer:
QWARN : tst_QTimer::moveToThread() QObject::killTimer: Timers cannot be stopped from another thread
QWARN : tst_QTimer::moveToThread() QObject::~QObject: Timers cannot be stopped from another thread
This timer is used to ask the thread to quit, which in turn allows us to
destroy this QObject without a cross-thread warning. Because it's
already fired once and done its duty, we can make sure it's not active
by simply making it single-shot.
Pick-to: 6.4 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17465067b27c044b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
A click on the selected item should deselect all other items before
editing starts.
Remove the part of the test case that assumes that we can have multiple
items selected in ExtendedSelection mode, and click on an item to start
editing while maintaining selection. That can never happen.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-111131
Change-Id: I0312eed4614502cfb77eca26d3f7615427493d7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The documentation for the RelationFlag enum was not very clear on what
was the "first" and "second" object.
And the fact that the AT-SPI backend (which these enum values originates
from) inverses "first" and "second" makes it harder to understand what
how it all fits together.
So when (with this change) Qt documents 'QAccessible::Labelled' as
"The returned object is labelled by the origin object"
AT-SPI documents ATSPI_RELATION_LABELLED_BY as:
"The origin object is labelled by the returned object"
(Documentation for AT-SPI is rewritten so that it shares the same
terminology)
Notice that the two objects are exchanged, which means that even if they
use the same 'Labelled' relation, the semantic gets 'inversed'.
This is already the case today, so we cannot change it. Therefore, to be
clear, the relation mapping will remain to be like this:
Qt Relation | Maps to AT-SPI | Qt explanation
----------------+-------------------------------+--------------------------------------------------------------------------------
Label | ATSPI_RELATION_LABELLED_BY | The returned object is a Label for the origin object
Labelled | ATSPI_RELATION_LABEL_FOR | The returned object is Labelled by the origin object
Controller | ATSPI_RELATION_CONTROLLED_BY | The returned object is the Controller for the origin object
Controlled | ATSPI_RELATION_CONTROLLER_FOR | The returned object is Controlled by the origin object
This mapping can already be seen in qAccessibleRelationToAtSpiRelation()
For the record, these future relations should then be mapped to like
this:
Qt Relation | Maps to AT-SPI | Qt explanation
----------------+-------------------------------+--------------------------------------------------------------------------------
Described | ATSPI_RELATION_DESCRIPTION_FOR| The returned object is described by the origin object
DescriptionFor | ATSPI_RELATION_DESCRIBED_BY | The returned object provides a description for the origin object
FlowsTo | ATSPI_RELATION_FLOWS_FROM | The returned object has content which flows logically to the origin object
FlowsFrom | ATSPI_RELATION_FLOWS_TO | The returned object has content which flows logically from the origin object
Change-Id: Ib245ec95564e4886dc6dbbb68abec2b23cd0e534
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Runtime support is indicated via QRhi::Feature::HalfAttributes.
OpenGL support is available in OpenGL 3.0+, OpenGL ES 3.0+, and in
implementations that support the extension GL_ARB_half_float_vertex.
Other RHI backends (Vulkan, Metal, D3D11, and D3D12) all support this
feature.
Note that D3D does not support the half3 type. D3D backends pass half3
as half4.
tst_qrhi auto unit test included.
Change-Id: Ide05d7f62f6102ad5cae1b3681fdda98d52bca31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Amends 0242be9060, and removes unwanted
side effect of having a modified style behavior for later functions.
Pick-to: 6.5 6.4 6.2
Change-Id: If3dff0d7ab9e6c6c10e7a92d0a3eaff98fa1457f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Add Algorithm::NumAlgorithms and use it to iterate over all
statically-available algorithms, querying their hashLengthInternal().
This avoids having to statically_assert(<= MaxHashLength) everywhere,
and auto-adjusts the buffer size in SHA1_ONLY builds.
Yes, the extra case labels for NumAlgorithms are a nuisance, but at
least the compiler will remind us when we forget, unlike a missing
static_cast(<= MaxHashLength) that might easily be forgotten.
Adjust the test (which iterates over the QMetaEnum for
QCryptographicHash::Algorithm, so finds NumAlgorithms and tries to
pass it to the hash() function which responds with a
Q_UNREACHABLE(). Only test hashLength() == 0 for that enum value.
Pick-to: 6.5
Change-Id: I70155d2460464f0b2094e136eb6bea185effc9d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Only Ukrainian is actually recorded in CLDR as using U+0415 as
exponent separator; all other Cyrillic-using locales officially use
plain ASCII 'E'. However, it seems reasonable, in all Cyrillic
locales, to recognize both (given that they look very similar).
Task-number: QTBUG-107801
Change-Id: I70a1e60a2d9fe7e254e01d32c5bad909ea4b8c76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
In some locales signs and the exponent are not single character
tokens. Replace QLocaleData::numericToCLocale() with a tokenizer that
will cope with this. At the same time, cache the locale data needed in
support of that, so that we don't repeatedly recreate QString()
objects just to compare them against input tokens.
The caching class is inspired by Thiago's proposal for fixing the
performance, which also inspires the optimization of the C locale in
the tokenizer used here.
Add some testing that round-tripping numbers via strings works for the
locales with signs and exponents that use more than one character.
Task-number: QTBUG-107801
Change-Id: I9fd8409a371ed62ed969d9ebc8b09584e752f7fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It was confusing entry capacity with the bucket capacity. The value
maxNumBuckets() returned was the maximum number of entries. This issue
was harmless: we would just fail to cap the maximum to an allocatable
size. But the array new[] in the Data constructors would have capped the
maximum anyway (by way of throwing std::bad_alloc).
So instead of trying to calculate what the maximum bucket count is so we
can cap at that, simplify the calculation of the next power of 2 while
preventing it from overflowing in our calculations. We continue to rely
on new[] throwing when we return count that is larger than the maximum
allocatable.
This commit changes the load factor for QHashes containing exactly a
number of elements that is exactly a power of two. Previously, it would
be loaded at 50%, now it's at 25%. For this reason, tst_QSet::squeeze
needed to be fixed to depend less on the implementation details.
Pick-to: 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd17415f3856c358a0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Saw this on my FreeBSD VM. The backtrace() function thought the nearest
symbol to something was "_ZTSNSt3__110__function6__baseIFbPvS2_EEE",
which decoded to
typeinfo name for std::__1::__function::__base<bool (void*, void*)>
The function pointer type inside parameter threw the decoder for a loop
and caused it to crash with the failed assertion in qbytearray.h:
inline char QByteArray::at(qsizetype i) const
{ Q_ASSERT(size_t(i) < size_t(size())); return d.data()[i]; }
I noticed this
- because tst_qtimer hung
- because qFormatLogMessage deadlocked acquiring QMessagePattern::mutex
- because the logging recursed
- because qCleanupFuncinfo failed an assertion while formatting the
backtrace (my QT_MESSAGE_PATTERN has %{backtrace})
- because QTimer::~QTimer -> QObject::killTimer printed a warning
- because tst_QTimer::moveToThread produces warnings
Pick-to: 5.15 6.2 6.4 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17464f86e9725991
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
<bit> exists in C++20 and is properly both constexpr and optimized. But
in C++17 mode, we don't have constexpr bitops and instead elect to have
performance at runtime instead. But somewhere along the line, either
when they were added, when C++20 <bit> support was, or in any of the
bugfixes for other compilers, the nesting of #ifdef got messed up and we
declared that we had constexpr builtins for MSVC in C++17 too.
The macro QT_HAS_CONSTEXPR_BUILTINS isn't supposed to be used by anyone
else... but we ended up not being able to use it ourselves either. So
I'm renaming it to a more precise label.
Pick-to: 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd1741b9b4060c9753
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The goal of this function is to ensure that dst is _always_
NUL-terminated. The only exception is if there's no space to write
even one NUL byte, of course, but not when src is nullptr but dst
would have space.
Update the docs to the new behavior and make them more precise.
Fix a test that assumed qstrncpy() would not write to dst for
(dst, nullptr, 10).
[ChangeLog][QtCore][qstrncpy()] Now NUL-terminates the target
buffer even when the source pointer is nullptr, provided the
target buffer has space for at least one byte.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I7806d8c71e260f8f02b79af7b6ce94f23599dd69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The window stack will now upkeep three groups of windows, always
on bottom (1), regular (2), always on top (3). Windows belonging to
(3) will always appear on top of (2) and (1), and windows from (2) will
always appear on top of (1).
The first window created in the application gets the (1) status, which
is in line with the root window mechanism used before.
Activation has now been decoupled from the top position on the window
stack as a window in (1) or (2) may be active, in spite of the top
window belonging to a higher group.
Fixes: QTBUG-110098
Change-Id: I51f4d2d47163fab26ce5ef28f7a4f23a522c7f91
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Test documented behavior and serv as a baseline for future changes.
Change-Id: I36a914694d5244c89f28f3e403e11d65492a5eef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
They were leftovers from QTDS driver removed with Qt6
Change-Id: I34863912bd41e0b4ca54bf443001f1cb3f20511a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We so far refetched the first observer after evaluating bindings, as
binding evaluating might change the list of observers.
However, that approach did not take into account that the 'this' pointer
might no longer be valid after binding evaluation: In case of a
QObjectBindableProperty (or a QObjectCompatProperty), binding evaluation
might cause a reallocation of the binding storage, and consequently the
invalidation of the QPropertyBindingData.
Fix this by refetching the QPropertyBindingData from the storage (if a
storage has been provided, which is always the case for the affected
classes).
Fixes: QTBUG-111268
Pick-to: 6.5 6.4 6.2
Change-Id: Ie7e143a0bbb18f1c3f88a81dd9b31e6af463584f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The QtSql for Mimer SQL sqldriver makes it possible to work with the
Mimer SQL database on different plattforms. There are drivers for
several other databases in QtSql and a driver for Mimer SQL will
benefit many users.
To build the Mimer SQL driver, download Mimer SQL from
https://developer.mimer.com
[ChangeLog][QtSql]
Added a QtSql plugin to work with the Mimer SQL database
Fixes: QTBUG-111219
Change-Id: Id6ba5de4de01189d0516ffbfa89efcb0d013115f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Drive-by change: use UTF-16 instead of UTF-8 for Eastern Arabic
Numerals, both are not human-readable but UTF-16 is one code point
instead of the two for UTF-8, less \x.
Pick-to: 6.5
Change-Id: I721f3989b7d776ddc4f9d337b21dca9d398fcc0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Constructing from const char* etc is already covered by
constructorQByteArray.
I took a guess that the "// b(10)" comment is about testing constructing
a QString from a QChar[] that has an explicit \0 charcater. I tried
finding what the initial intent was but the trail went cold at the
"Initial import from the monolithic Qt" commit.
Pick-to: 6.5
Change-Id: I15bcdb24e55286eb6cd3056af0714a1eed581635
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise, double-click recognition will fail.
Use QEvent::clone when possible, or set the timestamp explicitly when
not.
As a drive-by, remove some long-dead code in affected code lines.
Fixes: QTBUG-102010
Pick-to: 6.5 6.4 6.2
Change-Id: I882bf6e8090bf6f182b7a0a3c62aa3a4c8db2e14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
I.e. the second arg to QCOMPARE isn't what's being tested.
Drive-by changes:
- More _L1 usage, less blocky and easier to read
- QCOMPARE's second arg can be a View, it is smart enough and can
compare them just fine
- Replace a "//15 chars" comment with a QCOMPARE check
Pick-to: 6.5
Change-Id: I4f4b84b16b543df37b0ba2f9dd781b045b2ed397
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As of macOS 10.14 the keyboard assistant background is shipped as part
of the compiled asset catalog of the app, so looking it up via a URL
will fail.
Instead we look it up via NSBundle's dedicated image lookup function,
which handles both cases.
The logic has also been moved to qwizard.cpp, since the additional
plumbing via QPlatformNativeInterface was unnecessary.
The keyboard assistant itself no longer shows the background image
as of macOS 12, so we might consider doing the same, but the design
of the assistant has also changed significantly, so as long as our
QWizard layout looks like the old keyboard assistant we keep the
background as well.
Pick-to: 6.5 6.2
Change-Id: I7d42dd79b285f3518837458864bca6bc353b3b6d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
- Port macros to QTest data rows in separate unittests
- Move DOUBLE_TEST-related data to toDouble() unittest
- Drop one redundant unittest:
QTest::newRow("const-charstar") << (const char*)0;
Pick-to: 6.5
Change-Id: Ie809895e9f5d58c2d3ec419689f409b55e24fcf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And switch to using test data rows (rooting out two macros in the
process).
Pick-to: 6.5
Change-Id: Ib31e6b59f90f0983c0efc4bef7cb246aedfcab5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change test data to compile with NO_CAST_FROM_ASCII uncoditionally where
casting from ASCII isn't what's being tested by a unittest.
The goal is to add a variant of tst_qstring that is compiled with
QT_NO_CAST_FROM_ASCII so that the unittests cover that code path too.
The commits are split into smaller chunks (where there is a common
link between changed code, that code is put in a commit, otherwise I
kept the number of changed lines below ~150) to make reviewing them
easier.
Pick-to: 6.5
Change-Id: I14256f1bde7749a3023753dbb7ed8be72cb6bc14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends 17c1ebf8bf, after which dragEnabled
item views toggled selection on click rather than on press. If the edit
trigger included SelectedClicked at the same time, then Ctrl-Clicking a
selected item would start editing the item, instead of toggling
selection.
Fix this by ignoring clicks with modifier when evaluating whether
editing should start.
Extend the mouseSelection test case by including a column for the
editTrigger, and cover the respective combinations.
Fixes: QTBUG-111131
Pick-to: 6.5 6.4 6.2
Change-Id: I9605f9b3d5a49e292551a34c3c4c7a5f9ecb2a89
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
`QStatusBar::removeWidget` was hiding the wrong widget (the next one),
since the `removeAt` call changed the item that the `item` variable
is referencing.
This fixes a regression in Qt 6.3.0 (7166a82844).
Pick-to: 6.5 6.4
Change-Id: I9977b47e6208f8d451ff1037bcb9f4e8414cb431
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Not clearing the continuationData could lead to use-after-free when
there is an attempt to cancel an already finished future, which belongs
to an already-destroyed promise.
This patch fixes it be explicitly resetting continuationData to nullptr
in the clearContinuation() method, which is called from the QPromise
destructor.
Task-number: QTBUG-103514
Pick-to: 6.5 6.4 6.2
Change-Id: I6418b3f5ad04f2fdc13a196ae208009eaa5de367
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
A recent update moved handleScreenChange out of being a private slot.
Porting to the new syntax fixes the warning and moves to a compile-time
check.
Pick-to: 6.5
Change-Id: Ibd85c6caf7dca051d669250a94a82fbddbd3435d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
An effort has been made to support more keyboard layouts that provide
dead keys (US international, Mac-specific dead keys).
The dead key is translated now at the event conversion phase, not
when it is actually used for modifying keys, which simplifies the logic.
Unittests have been created to check the translation mechanism.
Fixes: QTBUG-86272
Change-Id: I07f7d63f5a37f8469c693b034b400da99379f519
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
It's completely unnecessary, since QFileInfo will query the file system
anyway and that has a much better view of what is normalized and what
isn't. More importantly, this fixes the mistake in failing to normalize
properly in removePaths(), which removed the ending slash of a root
directory such as "C:\\". That caused the path to become "C:", which
QFileInfo interprets as "current path on drive C:".
[ChangeLog][QtCore][QFileSystemWatcher] Fixed a bug that prevented
removePaths() from removing the root of a drive on Windows.
Fixes: QTBUG-110986
Pick-to: 5.15 6.2 6.4 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd17419b6d69670876
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The test needs investigation. Skip it for now so that we can enable
CI for WASM but leave a note to investigate it.
Task-number: QTBUG-109954
Change-Id: I9448312c2c16ec4f31279dcbe4e2213681cabe8a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The code for the QMetaMethod queuedConnectionTypes overload relied on
QMetaMethod::parameterMetaType and QMetaType::flags() to detect whether
we're dealing with a pointer (and then use the VoidStar metatype instead).
However, if the type was incomplete when the slot was defined, and the
type was not registered when connect was called, we would not find a
metatype for the argument.
However, in that case we might still be able to handle the method, by
checking whether the type name of the arguments ends with a "*".
This patch does that, fixing a regression from 5.15.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-108537
Change-Id: I54cc48a3343444480ab9094fe1ebaaa5aa75cee0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When SPIRV-Cross encounters a GLSL storage buffer runtime sized array,
it generates MSL code which expects a "buffer size buffer" containing a
list of storage buffer sizes to be bound. This patch adds RHI backend
support for Metal "buffer size buffers" on compute and graphics
(including tessellation) pipelines. Includes unit tests.
An accompanying patch to qtshadertools is required.
Change-Id: I9392bfb21803e1a868d7de420fedc097a8452429
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
With the introduction of a new atomic variable the users should use the
class QNtfsPermissionCheckGuard or the helper functions
- qEnableNtfsPermissionChecks()
- qDisableNtfsPermissionChecks()
- qAreNtfsPermissionChecksEnabled()
to enable/disable permission checks instead of manually managing the
variable qt_ntfs_permission_lookup (which is a non-atomic variable and
as such prone to data races).
Also moved the variable qt_ntfs_permission_lookup to qfile.h to make it
clash with the user-side declarations the documentation suggested to
use (and it is probably also a better fit thematically anyway).
[ChangeLog][QtCore][Deprecation Notice] Deprecated the variable
qt_ntfs_permission_lookup to avoid race conditions while enabling or
disabling permission checks. It can be replaced by the RAII class
QNtfsPermissionCheckGuard or with the functions
qEnableNtfsPermissionChecks(), qDisableNtfsPermissionChecks() and
qAreNtfsPermissionChecksEnabled().
Fixes: QTBUG-105804
Change-Id: I93a563864ffb3f9945551c34004d8ca393603b25
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
If a slot connected to a QMenu-action destroys the QMenu, then
we must not touch data members in subsequent code, and instead return
immediately.
We cannot use QBoolBlocker here, as that would reset the data
member of QMenuPrivate even when trying to return early.
Fixes: QTBUG-106718
Pick-to: 6.5 6.4 6.2
Change-Id: I6b5ea471b1bf1f9864e1384382100f8f6c01346f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
dfb4697e4a made a change to selection
behavior that resulted in a regression where clicking on an item view
but not on an item would cause the current item to get unselected.
Changes the behavior to not update in this case.
Added a new test that specifially checks for this scenario and ensures
that the current item is still selected, even after the user clicks on
empty area.
Fixes: QTBUG-105870
Pick-to: 6.2 6.4 6.5
Change-Id: I191c3878819b99897083039fba0ab43908da5429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
I don't begin to understand the semantics of the trackers here, but
whatever they are, they break with the fallback std::swap() 3-moves
implementation and lose track of alive objects, so provide an ADL swap
that does the right thing.
Amends dd58ddd5d9 (I think).
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I1cd49c95dca2d103a26c2c7ac0a896929135a6c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
A RAII wrapper around Qt::{begin,end}PropertyUpdateGroup().
[ChangeLog][QtCore][QScopedPropertyUpdateGroup] New RAII class
wrapping Qt::beginPropertyUpdateGroup() and
Qt::endPropertyUpdateGroup().
Fixes: QTBUG-110710
Change-Id: If2619e9584dd9d57985d63e3babca75421499ab9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The "Private Use Area" are subsets of Unicode which are not
considered regular characters, but reserved for fonts to provide
custom glyphs.
If these were used and the main font did not have support for them,
we would look them up in other fonts and sometimes display an
arbitrary selection of glyphs, based on whatever existed on the
platform. This is unexpected and different from how native apps
work on Windows, for instance.
[ChangeLog][QtGui][Text] Font merging (automatic assignment of
alternative fonts) is no longer applied for characters in the
Private Use Areas of Unicode.
Pick-to: 6.5
Fixes: QTBUG-110502
Change-Id: Id2c63786aafda59bf170e0d7263eb78a391fe46d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
And don't use toLower() as QString::compare() and QCollator::compare()
can compare case-insensitively.
Change-Id: I999d787cb77e10a101da75d1bf0a5baf096a5c9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I.e. don't detach in the replace() overloads that delegate to
replace_helper() if this string is shared, instead create a new string
and copy characters from this string to it, along with the "after"
string, then swap it with this.
Do the same thing if "before" is shorter than "after" and there isn't
enough capacity to do the replacement without reallocating.
Use std::copy* and std::move*, which will both fallback to
memmove/memcpy, but they have C++ API, which is more readable.
[ChangeLog][QtCore][QString] Using replace() on a currently shared
QString is now done more efficiently
Task-number: QTBUG-106184
Change-Id: If74ffa1ed47636dc23d543d6dc123d8f2b21d537
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Utf8 data is variable-width, ideally we want to write characters at most
once, so insert directly into the QString buffer if inserting at the end
(by delegating to append(QUtf8SV)), and use an intermediate buffer to
hold the converted data before inserting anywhere else.
Task-number: QTBUG-108546
Change-Id: Iabfaeecaf34a1ba11946bd67951e69a45d954d6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of detaching when the string is shared, or if the the insertion
would cause a reallocation, create a new string and copy characters to
it as needed, then swap it with "this" string. This is more efficient
than detaching which would copy the whole string before inserting, as
some characters would be copied multiple times.
Use detachAndGrow(), otherwise QStringBuilder unitests fail:
PASS : tst_QStringBuilder1::initTestCase()
FAIL! : tst_QStringBuilder1::scenario() 'prepends < max_prepends' returned FALSE. ()
Loc: [tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp(61)]
PASS : tst_QStringBuilder1::cleanupTestCase()
The issue is that now when inserting, if the string is going to
reallocated, we create a new string, so the freeSpaceAtBegin()
optimization doesn't work the same way.
void checkItWorksWithFreeSpaceAtBegin(const String &chunk, const Separator &separator)
{
// GIVEN: a String with freeSpaceAtBegin() and less than chunk.size() freeSpaceAtEnd()
String str;
int prepends = 0;
const int max_prepends = 10;
while (str.data_ptr().freeSpaceAtBegin() < chunk.size() && prepends++ < max_prepends)
str.prepend(chunk);
QVERIFY(prepends < max_prepends);
...
...
each str.prepend() would have reallocated.
[ChangeLog][QtCore][QString] Calling insert() on a currently shared
string is now done more efficiently.
Task-number: QTBUG-106186
Change-Id: I07ce8d6bde50919fdc587433e624ace9cee05be8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the object is shared, instead of detaching, copy characters from
"this" to a new object except for the chacters that would be erased,
this is more efficient than detaching (which would copy the whole data
then erase).
- Extend tst_QString::removeIf() to catch a corner-case (that I saw
with tst_QByteArray::removeIf()).
- Add q_uninitialized_remove_copy_if, which works like
std::remove_copy_if but for uninitialized memory like
q_uninitialized_relocate_n (but copies rather than relocates/moves).
With the same static_assert from q_relocate_overlap_n that the type
destructor is non-throwing.
Added q_uninitialized_remove_copy_if in this commit rather than a
separate one so that it's unittested by its usage in eraseIf().
[ChangeLog][QtCore][QString, QByteArray] Removing characters from a
currently shared string or byte array is now done more efficiently
Task-number: QTBUG-106181
Task-number: QTBUG-106183
Change-Id: Icc0ed31633cef71d482b97e0d2d20d763163d383
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A QVariant(QString) was not convertible to an enum not registered with
Q_ENUM() which worked fine in Qt5.
The same problem exists for QVariant(enum) to QString.
Fix it by not bailing out when no metatype for the enum was found and
try to convert it to a qlonglong instead (which is then correctly
converted to the enum type).
Fixes: QTBUG-109744
Pick-to: 6.5 6.4
Change-Id: Ie7bb016a860455b69508f0f46b36474c9c294f3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implemented assign() methods for QVarLengthArray to align
with the criteria of std::vector, addressing the previously
missing functionality.
Reference:
https://en.cppreference.com/w/cpp/container/vector/assign
[ChangeLog][QtCore][QVarLengthArray] Added assign().
Fixes: QTBUG-106200
Change-Id: If671069808ff561b0f4c77b6c7f7aca360a0c663
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This fixes a use-after-free in QPropertyDelayedNotifications::notify.
Before this patch, evaluateBindings or a notify from a property index
might have caused the originalBindingData to become reallocated.
However, at that point, we've already restored the original bindingData
in evaluateBindings, so we won't track updates, and thus won't adjust
originalBindingStatus, which will then point to already freed data.
To remedy this, we no longer do the notification with data fetched from
originalBindingData, but instead use the information we have in the
proxyData.
We also need to enure that referenced bindings do not get deleted; for
that we keep the PendingBindingObserverList alive for the whole duration
of the endPropertyUpdateGroup.
As we now have the PendingBindingObserverList, we use it for the
notification logic, and only notify change handlers in
QPropertyDelayedNotifications::notify. That will allow a follow-up
cleanup of QPropertyObserverPointer::notify, and aligns the logic for
grouped updates with the logic for "nornal", non-grouped updates.
Amends f1b1773d0a.
Task-number: QTBUG-110899
Pick-to: 6.5 6.4 6.2
Change-Id: Iae826e620d9614b7df39d86d8a28c48c8a5c4881
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
That use case for the class never materialized, and it was actually
meant for internal use. However, we put it into the public header, so
we cannot remove it (and while undocumented, someone actually used it at
some point, compare e4d62651c2).
Mark it as deprecated instead so that it can be finally be removed in Qt
7.
Change-Id: I058c5831a44610121fbec6eaddebd8b33d4a16c9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
qt_ntfs_permission_lookup is a global, non-atomic variable which
could cause problems in case of multiple threads. Introduce a
new atomic variable to handle permission lookups but instead of
manual incrementation/decrementation, implement a class to manage
the variable.
Since the atomic variable is not directly available to the user,
implement helper functions to increase/decrease/check the status
of the variable.
Task-number: QTBUG-105804
Change-Id: If6cbcdd653c7f50ad9853a5c309e24fdeb520788
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Introduce the qt-cmake-create script. The script generates the simple
CMakeLists.txt based on the source files located in the current or
specified directory. The initial version can generate a CMake code for
the following file types:
- .c .cc .cpp .cxx .h .hh .hxx .hpp - generates the qt_add_executable
call with prerequisites.
- .qml .js .mjs - generates the qt_add_qml_module call with
prerequisites.
- .ui - adds the found ui files to the existing executable. Requires
C++ files be present in the directory too.
- .qrc - generates the qt_add_resources call and adds the resources
to the existing executable. Requires C++ files be present in the
directory too.
- .proto - generates qt_add_protobuf call with prerequisites.
The QtInitProject.cmake script contains the 'handle_type' function that
allows extending the script capabilities and establish simple relation
chains between the file types.
Note: The initial implementation doesn't deal with sub-directories, so
all files from sub-directories will be added to and handled in the
top-level CMakeLists.txt file. This can be extended by user request.
Task-number: QTBUG-104388
Change-Id: I5abd9e07da109e867ff95986572ed2bf02ef9d3d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The adaptor is a server-side implementation that must exist anyway and
is called by the QtDBus runtime. We don't want warning on the server
side because it must call those methods to implement the client API.
Since we have the XML introspection saved in a class property anyway,
the runtime won't be inspecting the method tags to see if
Q_DECL_DEPRECATED is there, to add to the XML (which it isn't
generating).
Pick-to: 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd17416596135d26ca
Reviewed-by: David Faure <david.faure@kdab.com>
Commit 93dad2bf91 (6.0) changed
Q_DECL_DEPRECATED to use the [[deprecated]] attribute, which must appear
before inline and other keywords.
To keep it next to Q_NOREPLY, I also moved the "inline" into the next
string.
Added missing tests for both.
Pick-to: 6.2 6.4 6.5
Fixes: QTBUG-110979
Change-Id: I9671dee8ceb64aa9b9cafffd1741656e86f40453
Reviewed-by: David Faure <david.faure@kdab.com>
This addresses two different issues:
- Firstly, we were casting the resolved binding data pointer to
QPropertyProxyBindingData, instead of the d_ptr of
QPropertyBindingData. Fix this by introducing a helper function,
and consistently using it to access the proxy data.
- Secondly, we were not resetting the originalBindingData when the
pointed to object was destoyed. Fix that, too.
Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-110899
Change-Id: I7691c9df5cc26e761f6b0e5f16d152f7f2183208
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
New languages (and one local for each) added with v42
- Haryanvi
- Moksha
- Northern Frisian
- Obolo
- Pijin
- Rajasthani
- Toki Pona
It also appears that Canada has changed its date format. Modify the
relevant test case to reflect this change.
Task-number: QTBUG-110333
Pick-to: 6.5
Change-Id: Ia8975c2866cd54c9e565543d05bacd52f4987909
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- The optional nice-to-haves DebugMarkers, Timestamps, PipelineCache
are not yet implemented (features reported as false, to be
implemented later, although buffer/texture resource name setting
already works as-is, regardless of DebugMarkers).
- Mipmap generation for 3D textures is missing. Won't matter much
given that 3D textures are not used in Qt for anything atm. For
generating mipmaps for 2D (or 2D array) textures, the MiniEngine
compute shader and approach is used. 3D support for the mipmap
generator may be added later. 1D textures / arrays are supported
except for mipmap generation, and so the
OneDimensionalTextureMipmaps feature is reported as false.
- Qt Quick and Qt Quick 3D are expected to be fully functional.
(unforeseen issues are not impossible, of course)
- Uses minimum feature level 11.0 when requesting the device. It is
expected to be functional on resource binding tier 1 hardware even,
although this has not been verified in practice.
- 2 frames in flight with the usual resource buffering
(QRhiBuffer::Dynamic is host visible (UPLOAD) and always mapped and
slotted, other buffers and textures are device local (DEFAULT).
Requests 3 swapchain buffers. Swapchains are mostly like with D3D11
(e.g. FLIP_DISCARD and SCALING_NONE).
- The root signature generation is somewhat limited by the SPIR-V
binding model and that we need to map every binding point using the
nativeResourceBindingMap from the QShader. Thus the root signature
is laid out so each stage has its own set of resources, with shader
register clashes being prevented by setting the visibility to a
given stage.
Sampler handling is somewhat suboptimal but we are tied by the
binding model and existing API design. It is in a fairly special
situation due to the 2048 limit on a shader visible sampler heap, as
opposed to 1000000 for SRVs and UAVS, so the approach we use for
textures (just stage the CPU SRVs on the (per-frame slot) shader
visible heap as they are encountered, effectively treating the heap
as a ring buffer) would quickly lead to having to switch heaps many
times with scenes with many draw calls and sampledTexture/sampler
bindings in the srb.
Whereas static samplers, which would be beautiful, are impossible to
utilize safely since we do not have that concept (i.e. samplers
specified upfront, tied to the graphics/compute pipeline) in the
QRhi API, and an srb used at pipeline creation may change its
associated resources, such as the QRhiSampler reference, by the time
the shader resources are set for the draw call (or another,
compatible srb may get used altogether), so specifying the samplers
at root signature creation time is impossible.
Rather, the current approach is to treat each sampler as a separate
root parameter (per stage) having a descriptor table with a single
entry. The shader visible sampler heap has exactly one instance of
each unique sampler encountered during the lifetime of the QRhi.
- Shader-wise no different from D3D11, works with HLSL/DXBC 5.0
(i.e. existing .qsb files with DXBC in them work as-is). But unlike
D3D11, this one will try to pick 6.7, 6.6, ..., down to 5.0 from the
QShader, in that order.
- Uses D3D12MA for suballocating. As a result it can report vmem
allocation statistics like the Vulkan backend, and it does more
since the DXGI memory usage (incl. implicit resources) is also
reported. This is optional technically, so we also have the option
of going straight with the heavyweight CreateCommittedResource()
instead. That is what we do if the adapter chosen reports it's
software-based or when QT_D3D_NO_SUBALLOC=1 is set.
- PreferSoftwareRenderer (picking the WARP device) and the env.var.
QT_D3D_ADAPTER_INDEX work as with the D3D11 backend.
- It is not unexpected that with large scenes that generate lots of
draw calls with multiple textures/samplers per call the performance
may be slightly below D3D11 (probably mostly due to descriptor
management). Similarly, the reported memory usage will be higher,
which is partly natural due to creating heaps, descriptor pools,
staging areas, etc. upfront. Will need to be evaluated later how
these can be tuned.
Change-Id: I5a42580bb65f391ebceaf81adc6ae673cceacb74
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Failing test functions fastMove, moveAccross, moveInOutOverlapped seem
to be stable in the meanwhile. This patch removes the blacklisting.
Task-number: QTBUG-109036
Pick-to: 6.5
Change-Id: I9a2b015572e4d8a4eac196d3985c052030fd84e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The new name better matches the names of existing functions there.
A comment on the old code noted that such a move should really be
done, so as to correctly share the environment-mutex locking.
In the process, move the (now three) time-related internal functions
from qglobal_p.h to a new qtenvironmentvariables_p.h since that's the
natural place for them given where they're defined (and the fact that
they're for internal use only).
Change-Id: Ib028baebaf31a806a2c0c97caaaba0a466c11cea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We must check that the path is an actual file on the filesystem before
using native APIs. This regression was introduced by commit
047d8f36de.
[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
Pick-to: 6.4 6.5
Change-Id: I570832c9ac8b4e03bde8fffd173f7b4c6b164192
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
This test is calling mimeTypeForFileNameAndData(), so it doesn't
actually use the files.
Change-Id: I570832c9ac8b4e03bde8fffd173f77f138ef3434
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
When calling a ctor this way, an object is created in the memory pointed
to by _a[0] using the other arguments for the ctor.
This allows separate allocation and initialization of an object through
the metaobject system.
Fixes: QTBUG-108879
Change-Id: Ifb154373ee42faab281cfb62aa14334980ec6b7d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The QChar::toLatin1() args in:
str.replace(index, len, QChar(after[0]).toLatin1())
s2.replace(ch.toLatin1(), after, cs)
will be converted to QChar, so it's always calling the same QString
overload, I argue that we're not testing QChar implicit conversions
here.
Change-Id: I3962cab2b34684f970638575e6bd15dd1067a8c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The fact that read-access is always included makes a bool readWrite
property a little awkward to document and explain. An AccessMode enum
with values ReadOnly and ReadWrite is much easier, and will also lend
itself more easily as a constructor argument than a boolean.
Found in API review.
Pick-to: 6.5
Change-Id: I4f20dbe9f19c7bdb52248a6e544e36d731d5a2ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The aim is to have fewer files including <windows.h>.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Id9cc08f54b5daf6d7e317fad27036dc2efaacbb8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is a continuation of commit 5c9d671bfb.
[ChangeLog][QtCore][QStandardPaths] Improved conformance to the
Freedesktop basedir spec by ignoring any relative paths in XDG_*
environment variables.
Fixes: QTBUG-58043
Change-Id: I7c34143ced97d6d3de6ecbf13bccf9e935462d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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
Pick-to: 6.5 6.4
Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a
Reviewed-by: Doris Verria <doris.verria@qt.io>
It causes clashes in CMake Unity (Jumbo) builds.
Change the function to be Q_AUTOTEST_EXPORT'ed helpers.
Pick-to: 6.5
Task-number: QTBUG-109394
Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I2e4032e07e1c39432cae1eb2dfff94be33846c09
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
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
Pick-to: 5.15 6.2 6.4 6.5
Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Note: This requires an update to the tst_qtextlayout test, because
the test assumed that the Arabic string would always yield a run
of two glyphs. This was a side effect of how Harfbuzz handled
Qt's test font, which has zero font tables and cannot be used for
shaping. With the Harfbuzz update, the Arabic text here yields a
single cluster instead, which actually makes more sense, so the
test has been made a bit more robust to support both cases.
Pick-to: 6.2 6.5
Task-number: QTBUG-110338
Change-Id: I93d4cf8e3046dc93224e144d4c81d86bef4918d1
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If the string is shared, instead of detaching, create a new string and
copy the characters from this string, replacing the ones matching "before"
with "after", to the new string.
Change-Id: I2c33690230d40f3121e60e242666460559258b7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
TIME_NOSECONDS doesn't really switches to short time format,
just removes the seconds from long time format
Fixes: QTBUG-110627
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Ie799958f3942c657f00bc8196588258661ddc1d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It seems that on macOS 13.2 and newer, it requires explicit activation,
just as on the offscreen and minimal platforms.
Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-110703
Change-Id: I519eec872505ea3673111ae300c2494113f85c36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This reverts commit cebcb7991a.
Reason for revert: We need to enable BIC tests again
Pick-to: 6.5
Change-Id: Ibabe2c50547972d040d933a1027833426b018e81
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Says Clang 15:
tst_qurlquery.cpp:193:11: warning: explicitly moving variable of type 'QUrlQuery' to itself [-Wself-move]
moved = std::move(moved);
~~~~~ ^ ~~~~~
It's amazing how little it takes to throw this warning off guards:
just use an alising reference instead of the same variable. Makes you
wonder whether the time spent on detecting such trivialities in the
compiler is really well spent.
Amends fc8dad2f10.
Pick-to: 6.5
Task-number: QTBUG-109842
Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of the System V one. An important difference is that
QSharedMemory does not clean after itself.
Updated the configure summary output to include this information.
Drive-by update to sorting order and I removed cpp-winrt from the
listing because there's a warning at the end if it is not set.
Change-Id: I12a088d1ae424825abd3fffd171e0eadcfd33426
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If a previous test in the same process or previously leaked a shared
memory or semaphore handle, tests could fail and cascade down. They
could also interfere with one another. So prevent this issue by
assigning a monotonically-increasing identifier per test function or row
tested and improving how we clean up those we did create.
This shows we need the API to explicitly clean up.
Change-Id: I12a088d1ae424825abd3fffd171db61d6b68a411
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native key.
Documentation in a new commit, when the dust settles.
Drive-by updates to the tst_QSharedMemory::attach row names, to fix
grammar and remove spaces and apostrophe.
Change-Id: I12a088d1ae424825abd3fffd171d3025c77f94d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native Qt.
Documentation in a new commit, when the dust settles.
Change-Id: I12a088d1ae424825abd3fffd171d2b549eeed040
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Common to both QSharedMemory and QSystemSemaphore, this will hold the
native key and will replace the concept of non-native key in those
classes.
Change-Id: Id8d5e3999fe94b03acc1fffd171c03197aea6016
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
This removes the second portion of the #if mess of shared code between
QSharedMemory and QSystemSemaphore for SystemV.
Change-Id: Id8d5e3999fe94b03acc1fffd171c073c2873206e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It's not a lot of files, but it's actually more in the same dir than
mime/ does right now. I'm about to add two more files, though I'll also
merge a few more later.
Change-Id: Id8d5e3999fe94b03acc1fffd171bfe2ea36a35a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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
Pick-to: 6.5 6.4
Change-Id: I950f8c3f135793b01c59832835bb429db2282169
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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.
Pick-to: 6.2 6.4 6.5
Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
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 26b227e128.
Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.5 6.4
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>
It wasn't added when this class was created in 5.0 because we couldn't
add move constructors and still keep the ability to compile Qt with
C++98 compilers. We've forgot to correct this shortcoming since 5.6.
Fixes: QTBUG-109842
Pick-to: 6.5
Change-Id: I69ecc04064514f939896fffd17376b8243b73c52
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
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
Pick-to: 6.5 6.4 6.2
Change-Id: I69ecc04064514f939896fffd17376aa18184653c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This overridden function is not used and also can't be triggered by a
synthetic input event in an auto test.
Change-Id: Id8b69b440a90c18cf5870e34804fae3e6607e49f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This got lost during the QStringView port that happend in Qt 6.0
(commit 548dcef089) because
QString::operator+=(QStringView) does not copy the nullness of the right
side, whereas QString::operator+=(const QString &) does.
Pick-to: 6.2 6.4 6.5
Fixes: QTBUG-84315
Change-Id: Ide4dbd0777a44ed0870efffd17399b772d34fd55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Because Python 2 reached end of life. I wonder how this even works on
macOS, as my Monterey doesn't even have "python" any more.
Pick-to: 6.2 6.4 6.5
Change-Id: Ibddb9b0ada5a4bbaa64bfffd173b239c6c4b66f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
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 a00a1d8806.
Fixes: QTBUG-109745
Pick-to: 6.5 6.4
Change-Id: Ibc5b9cf5375108eb3d8f6c8a16d4fd02dadd73b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
As discussed in API review, the default-constructed T() returned from
a mismatched data<T>() call is indistinguishable from a real T with
default state.
To make them distinguishable, return optional<T>. Call the new
function value<T>(), mimicking QVariant::value<T>(), and suggested in
API review, because data() is usually used to return raw pointers, not
values.
Remove the qWarning() on requestedType and actualType mismatch, as the
new function can be used in std::get_if/dynamic_cast-like if-then-else
chains, in which failure is part of the normal operation, and a
warning message misplaced:
if (auto loc = perm.value<QLocationPermission>())
~~~ use *loc ~~~
else if (auto con = perm.value<QContactsPermission>())
~~~ use *con ~~~
~~~ etc ~~~
Pick-to: 6.5
Change-Id: I799a58e930307323ebce8f9ac50a42455e9c017f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Following the QRect, add functions converting the QString to native
emscripten::val and back: fromJsString, toJsString
Change-Id: I2d0625ede3bbf7249e2e91b8de298b5b91df8ba2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The new test:
- checks the properties of stateful Q<Typed>Permissions work
- ensures that piping a Q<Typed>Permission through QPermission
maintains state
- also ensures that assignment of a Q<Typed>Permission to a
QPermission works (via QPermission(Type) + move ctor)
Pick-to: 6.5
Change-Id: I340e49b1ecc665702ccab26d9050ca158b0e7885
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The test body has been inside an #if 0 for long, remove the test
altogether. The part that loads libthai does not check anyhing
meaningful.
Task-number: QTBUG-109954
Change-Id: I8ce006a14e4cf926b668e958d4b2343f965a5fb6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
It had various QVERIFY()s of != and >= checks: convert these to
QCOMPARE_NE() and QCOMPARE_GE() checks.
Change-Id: Ida6f7dca726187f7837da0d805549d9c582f946a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
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
Pick-to: 6.5 6.4
Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QDateTimeEdit has such reset functions for the minimum/maximum
range properties, this makes QCalendarWidget consistent with the
simpler editors.
Fixes: QTBUG-62448
Change-Id: Iabb89f599e4996f00488a885a5b8a009471838b3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
For most territories, if we specify only that territory, we should get
a locale specific to that territory. There are exceptions for various
reasons, but check that it's true in most cases, at least. In the
process, convert two QVERIFY(... == ...) into QCOMPARE(..., ...)
Task-number: QTBUG-64940
Change-Id: I7590f20f37b0b459aafb3d1d08f6eb77932fa027
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>