As the numercialPrecisionPolicy can be set and subsequently retrieved
from the QSqlDatabase's driver, then when copying the QSqlDatabase, we
need to set that appropriately too.
Task-number: QTBUG-10452
Change-Id: I2c63748365ab4e9fbc29d8d460d80d2e2a0ee385
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We haven't had support for anything older than 7.3 for a long time, so
this removes the code to save having to maintain it any further.
Task-number: QTBUG-644
Change-Id: If0635f3bef5138a00a0e77011a70f23d0bffda32
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters. It
eliminates nearly 2000 qdoc warnings.
Change-Id: Ibe047424396a8f99f8bd64efea1b0d8cc7c7527d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Enable xcb QPA plugin when XQuartz is available. This is done
in a single build, alongside the Cocoa version.
We delegate part of the configuration stage to pkg-config, so
this becomes a requirement. Ensure that
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig
is in your environment, or pkg-config is properly set up.
Tested with the following configure options:
configure \
-pkg-config \
-fontconfig -system-freetype \
-system-xcb -xkb -no-opengl \
-qt-xkbcommon -qt-xkbcommon-x11
Change-Id: I2eb5a0491172368afc4c629c540cbef08580348d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The condition for the 'services' sub-project in platformsupport.pro
was identical to the one guarding genericunix.pri in services.pro.
We can't remove the condition in platformsupport.pro because that
would result on an empty static library, which is not supported on
some platforms, like macOS.
Change-Id: I5c80737d9527bdd75dde44e33e5063f3d7aeecb7
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
QAbstractItemDelegatePrivate::textForRole() was formatting date and
time separately, then gluing the parts back together with space.
QLocale can do that just fine itself (it has a toString() overload
that handles a QDateTime) and might even (some day) do it better. To
my mild surprise, this proved sufficient to fix a problem with
date-time display in tool-tips, when the date-time includes a zone.
Extracted the date-time part of an existing selftest into a test of
its own and extended it to test times of each spec-type; verified that
the non-local spec cases of this all failed before this fix.
Task-number: QTBUG-61069
Change-Id: I6d6be0c27be9a557d8afc3ced200a10b2aaff816
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It's decoding a SYSTEMTIME in the slightly quirky manner of MS's
timezone APIs (year 0 means annual, with wDay as 1 through 4 for the
first through fourth, or 5 for the last, of a specified week-day
within a month) and the calculations to go with it were a little
opaque. So clean it up, document what it's doing (and why) and assert
some things that should be true. Also, only copy one int, instead of
a whole structure, to change from their day-numbering to ours.
Expand on a related TODO comment in its caller, at the same time.
Change-Id: Iffd95c094c37fc1081b73b2a267cfdcd29aeb4ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The implementation of QWinTimeZonePrivate used many static functions
and at least one struct; to which I've added. Put these all into an
anonymous namespace (thereby keeping the struct types out of the
linker's sight): make them local the C++ way, rather than the C way.
Change-Id: Ibdce0865234b5d4ebbdc90628cc4d9e790ed6321
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QTimeZonePrivate::dataForLocalTime() needs a transition before the
time it starts at; MS's time-zone data tends to omit old zones (before
2007, in the case of Win7 for Casablanca - which had interesting
transitions before that), so all we can do is extrapolate backwards
from there; but a first rule is indeed apt to be a no-transition rule,
describing the zone's status up to the first known transition. So
fake a "start of time" transition to return for this case, that
describes this prefix of history.
Change-Id: Iaf178cbebc3b1e599cbde3437a0af75d9f6ca432
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A transition time may represent the beginning of time; as such,
arithmetic on it might underflow, e.g. on adding a negative zone
offset to compare with a given time. So move the arithmetic to the
other side of the comparison in such cases.
Change-Id: I1697a03ebf74679ff86059664dd2b173b9c4c367
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a year contains a real change of standard time without any DST,
MS's APIs still claim to have both a DST start and a DST end; one of
them is bogus and positioned on the start (or end) of the year,
producing no change in offset from the end of the previous (or into
the start of the next) year. So code round that.
Task-number: QTBUG-42021
Change-Id: Ieb6161cfb77db8a57dc181097f117316f9d1c13c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Iterate rules (now that there's fewer of them than years) with only a
secondary iteration on years (when needed - in which case it should
never need more than two iterations). In particular, avoid iterating
years to the MIN_YEAR and MAX_YEAR extremes on failure; fail faster !
Change-Id: I354af8e0cb1e484c8abda279991e6e1824f9f7d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The MS API documents that the two TIME_ZONE_INFORMATION date fields
either both have wMonth clear (when there is no DST) or both have it
set (for each part of a DST pair). This rule is followed even when
there's a standard time change without DST, with perverse results I'll
deal with in a later commit. Add code in init() to verify the rule is
followed and qWarning() if not.
A year with no transitions doesn't imply no earlier or later year has
transitions, so don't give up on searches for transitions because of
it. Also fix a potential uninitialized variable bug, related to
data() breaking out of a loop on such a year.
Change-Id: I1ad86c07e54b2eb835a2e02d18dc64022f52a0d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Note that the relevant cases are all numeric, eliminate a redundant
variable (the min of two others, one of which was provably <= the
other), invert and rename a boolean (that was always used negated),
eliminate a case that couldn't arise (and assert this).
Change-Id: I9ef9cedbeb608c7cd56ddc618ddfb921966edfbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or
30 would fit in the field and be valid; but 4 or more was accepted,
even though it was too short for the field, because no suffix could
make it valid within the field-width.
[ChangeLog][QtCore][QDateTime] When parsing dates and times from
strings, fixed-width date-time fields, such as a "dd" for day,
QDateTime now rejects all values that should be padded, rather
than only doing so when the value is a prefix of some value that
would fill the field-width. Use a single letter for the field,
e.g. "d" for day, if you want to accept short
values. (QDateTimeEdit is not affected.)
Task-number: QTBUG-63072
Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test. Add similar tests for date-time and time; and an
isValid test on the end of year 9999. The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.
[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format). Widgets handling dates now
support dates to 9999, likewise.
Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For want of this, nothing that used QLocale::system(), inter alia,
could be thread-safe or re-entrant.
Task-number: QTBUG-49473
Change-Id: I3e017aa7d59c4c39828bb5cdc7ff0780ea66bafe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
To signal a thread to cancel, nothing more than a std::atomic_flag is
needed, but the implementation actually used mutexes, and weird
run-state introspection, so we can't just swap it out for a
std::atomic_flag.
Instead, we retain the principal logic, however weird it is, and just
optimize the common case where isInterruptionRequested() is called
from the secondary thread, repeatedly. We add a fast-path that just
checks that d->interruptionRequested is not set. That requires nothing
more than a relaxed atomic load, because there's no new value read
that could be used as a signal to the secondary thread that some
condition changed.
"What signal?", you may ask. Well, one can think of users doing this:
void cancel() {
m_why = tr("&Canceled");
requestIterruption();
}
void run() override {
while (!isInterruptionRequested()) {
doWork();
}
emit progress(100, 100, m_why);
}
We need to keep this code working, at least until Qt 6.
But the code can already now only rely on synchronization if
isInterruptionRequested() returns true. If it returns false, then
requestInterruption() has not been called, yet, and any modifications
done prior to the requestInterruption() call are not visible in the
secondary thead.
So we still lock the mutex, and in general don't change the semantics
of the functions, except that we don't lock the mutex in the case
where the flag wasn't set in the first place.
This makes calling isInterruptionRequested() as cheap as it can get,
assuming a lock-free implementation, of course.
I opted to use a std::atomic<bool> instead of QAtomicInt, as the
latter does not have loadRelaxed()/storeRelaxed(), and because it
future-proofs the code.
Change-Id: I67faf36b8de73d2723f9cdd66c416010d0873d98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When a new source model was set to QSortFilterProxyModel, the model
tried to remap the persistent indexes to the new model which was wrong.
The correct solution is to clear the persistent indexes with
_q_sourceModelDestroyed() since the old source model went away.
Task-number: QTBUG-44962
Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
QItemSelectionRange::intersects() needs to check if the parent of both
QItemSelectionRanges is the same. This is a very expensive operation
which should be done last. Same goes for isValid() which itself calls
parent() for two indexes.
This rearrangement speeds up some worst-case usecases by at least 30%
as shown in the bug report.
Task-number: QTBUG-60940
Change-Id: If6111a73cb8b97a8a0d0640527b34448d21f3143
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
setSession is only used if we have bearer management.
Change-Id: I64b9d29c01566e79bbca5d0dc11d6aee6d9b0bf0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Instead of trying to adapt to whatever the C library may have and using
QThreadLocalStorage, let's use a simple linear congruential generator
engine from <random>. We can't use a single instance because qsrand()
is documented to work per thread.
I thought of using QRandomEngine, but had to make the choice between
growing the QtCore code size and growing the per-thread data size. Code
is sharable and is actually smaller than the sizeof(QRandomEngine),
which is over 2500 bytes. sizeof(std::minstd_rand) is just
sizeof(uint_fast32_t).
Change-Id: I0a103569c81b4711a649fffd14ec8e641d02bf20
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This logic initially was copied from QTest::mouse* widget overload
(by d130382776) which uses QCursor::setPos()
to generate mouse move events via the windowing system. The QCursor API was
later removed by 1762bf3394, but now the redundant
qWait logic remained. Later this stray qWait was incorrectly moved to apply
for all mouse event types (by 268f41ec70), when
originally it was needed (arguably) only for mouse move events due to usage
of QCursor.
This patch also removes the waitForEvents() function as it is not a documented
qtestlib API (in qtestlib only the documented functions should be considered
public API, no matter what you can find in the header files). Removal does not
affect binary compatibility as this is not an exported symbol. And if somebody
has used this non public API, updating code is trivial.
Change-Id: Id1dec10f5cf276cee1ac0e8c8f8ba2edc493b667
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The standard calculateUnixPriority provides values that are almost
invariably inappropriate with even LowestPriority mapping to
something higher than the priority of any other thread on the
system.
[ChangeLog][QtCore][QThread] Changed how Qt thread priorities are
mapped to QNX system thread priorities.
Task-number: QTBUG-53357
Change-Id: I205035c4ca7dcafabda7a9a9b06cc52c67c6d2b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Add Q_DECL_COLD_FUNCTION (__attribute__((cold))) to tell the compiler
that the following functions are not usually executed in normal programs:
- qWarning/qCritical/qFatal
- qTerminate
- assertion failure
- qBadAlloc
The effect of the attribute is that
1. These functions get put into their own section, .text.unlikely,
and will be optimized for size, not speed.
2. Conditions that lead to one of these functions are automatically
marked as unlikely (something we have done manually in the past)
3. (anecdotal) the compiler is less likely to inline these functions
Text size effect of this change over all of QtBase: ~27KiB text size
saved, of which 11KiB in QtCore alone.
Change-Id: If308d4a4b9ff8f7934316c54b161a78ebe3f4205
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We do not touch anything mutex-protected in the path towards the qWarning(), so
the mutex lock is not needed. It may actually be harmful, since a message handler
may check isInterruptionRequested(), which would then deadlock.
Otherwise, we're just decreasing the size of the critical section — always a
worthwhile goal.
Change-Id: I26aa7e3dc087ff7efaccff1d4dc788ba00ba183f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
clangqdoc now accepts an unnamed enum type, calls it "anonymous"
and allows it to be documented as a named enum type. In this
update, several instances appear in subclasses of QGraphicsItem.
This update documents them correctly.
Change-Id: Ide8026801269154a37e7677a1ce62e0cb392efea
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
When setting a header item (that is, the item that provides the
QTreeWidget's column) the widget needs to manipulate the underlying
tree model and add or remove columns. This requires calling
the right QAbstractItemModel APIs for structural model changes.
The calculations done resulted in a off-by-one error:
* if the model had N columns and needs to grow to M(>N), then
one needs to begin insertion from N to M-1 (and not M);
* if the model had N columns and needs to shrink to L(<N), then
one needs to begin removal from L to N-1 (and not N).
Add the -1s needed.
Change-Id: Ic669788825a1c480376a08df0d7c9c10f91552ef
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
QTreeWidgetItem::insertChildren should behave like a more-optimized
QTreeWidgetItem::insertChild. Unlike the latter, the former lacks
out-of-bounds checks, resulting in successful insertions even
when using an invalid index (say, bigger than the row/column count).
Reintroduce some sanity checks instead. This allows to fix a "fixme"
left in the autotest.
[ChangeLog][QtWidgets][QTreeWidgetItem] QTreeWidgetItem::insertChildren
now ignores insertions happening at invalid indices, for
consistency with QTreeWidgetItem::insertChild.
Change-Id: I1532597768cc6aff96a6e8f356bc6075b582801d
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
The penultimate entry in mimeRuleTypes_strings is "byte", which, incl. the
terminating NUL character, has length five. But 65-59 == 6, so the last index
in magicRuleType_indices was off by one. No harm done, since there's one more
NUL (three in total...), but fix for the next reader of the code.
Change-Id: Ibdf855014a313a0486d013c9d06d55cea96435fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The previous commit didn't handle correctly the case where an entire
mime directory is deleted. The unittest wasn't testing that case,
now it is. We need to move providers into a new list, and then
delete those left over (i.e. now unused).
Change-Id: I04fd8b39b511a2331d706864f695ce5074acf916
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, we would use mime.cache in all mime directories if at
least one of them had such a file (other than the most-local one),
otherwise the "source" XML would be used in all directories.
Now it's possible to use mime.cache in those directories which
have one, and XML in those directories that don't.
Not only is this more correct, it will allow in a subsequent
commit to bundle the binary cache in QtCore's qrc rather than
the very big XML file.
The design change to allow this is that now every provider
only deals with a single directory, and QMimeDatabasePrivate
takes care of creating multiple providers, one for each dir.
This required to move most of the loops from the binary provider
up to QMimeDatabasePrivate itself.
Change-Id: Iac82d5f5836b80d45076e586b903d16fa2525b34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is actually simpler (two calls to ensureLoaded are enough,
rather than one in every implementation method) and is necessary
for further refactoring steps (which will instanciate more provider
instances).
Change-Id: I9fb8acf3556515babecb88ba88e25af43937af5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This wasn't the case when called from QMimeType, or some
QMimeDatabase methods. Now fixed.
Change-Id: Ifd515c1520482e4a23c399f1f773269659c92359
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the text of a QAction in a menu item contained a sequence of multiple
ampersand characters, only one of them would be removed, which is
inconsistent with the way this situation is handled on Windows, where
every other ampersand is removed, which is also the way other widgets
such as tabs, buttons, etc. are handled on macOS and other platforms.
Task-number: QTBUG-63361
Change-Id: Ibd9a520afa37b3387f3b951a94a3c275742e7ad3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Makes the code smaller and neater. Take this opportunity to mark some of
them constexpr.
Change-Id: Idaa189413f404cffb1eafffd14cef1df599c9ab7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The reason for each is given in the skip. It's mostly about the
server-side encryption, which is unimplemented for WinRT.
Change-Id: I036b95a4526e02fd047e193f2b3c9130bec08144
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Since the x86_simd/main.cpp file already has all the source for each and
every test anyway, just reuse it.
Change-Id: I938b024e38bf4aac9154fffd14f779f450827fb9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This lets the tests run on devices which previously did not have access
to the files used (WinRT, mobile devices).
Change-Id: Ibdd85862eee6ab1a7d4da87ca321ee9bc9880bfa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This has two main benefits:
1) introduces a qmake CONFIG we can use in .pro/.pri/.prf files
2) removes the need to keep an up-to-date list of which compilers
support the feature
The test is implemented as trying to compile every single SIMD test we
currently have, but without passing the -mXXX option. The reason for
trying all of them is that some people may have modified their mkspecs
to add -mXXX options or -march=XXX, which could enable the particular
feature we tried, resulting in a false positive outcome.
Change-Id: I938b024e38bf4aac9154fffd14f7784dc8d1f020
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
It seems the compiler supports /arch:AVX512 and /arch:AVX512F but none
of the other switches (and neither are documented). And when you pass
those, you also get Conflict Detection (CD), Double & Quad (DQ), Byte &
Word (BW) and Vector Length (VL), which matches the ICC switch
"-xCORE-AVX512". Unlike ICC, there doesn't seem to be an option to
enable only the common part of AVX-512.
Support for Intel Xeon Phi's current features (Exponential &
Reciprocation and Prefetch) and future ones (IFMA, VBMI, 4FMAPS, 4VNNI
and VPOPCNTDQ) seems to be missing altogether.
See https://blogs.msdn.microsoft.com/vcblog/2017/07/11/microsoft-visual-studio-2017-supports-intel-avx-512/
Change-Id: I98105cd9616b8097957db680d73eb1f86e487e6d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This allows us to get "subvolumes" on all filesystem types. We do that
by detecting the subdirectory that was bind-mounted.
/proc/self/mountinfo has been in the kernel since 2.6.26. Since btrfs
was only added on 2.6.29, there is no loss of functionality for btrfs
users.
I've tested this with subvolume or mountpoint names containing spaces,
tabs and newlines.
Change-Id: I57a1bd6e0c194530b732fffd14f4fa418255d839
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>