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>
Change-Id: I9a2f18263a8bc0a0de8978792dbb1f285acc0ccd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It will fill the view in some cases, obscuring what Qt draws.
Change-Id: I9ca00dddd829a28fb2cb3b009bfd3223f85ef7cb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The former is more idiomatic in Qt, and doesn't require
as much boilerplate to set up.
Change-Id: Idf03af4018611c8eb3b31af90da72f9d85617b2c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We have had test.qt-project.org for close to 3 years now.
Change-Id: I71488efd29b645f7b228fffd14fadf4627288243
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
WSARecvMsg does not return the sender in WSAMSG::name if WSAMSG::Control
isn't set. This makes no sense, so I'm assuming it's an API quirk we
need to work around.
[ChangeLog][QtNetwork][QUdpSocket] Fixed a regression from Qt 5.9.3
caused by an apparent Win32 API quirk we triggered when using
readDatagram(), resulting in an invalid QHostAddress sender address.
receiveDatagram() was not affected.
Task-number: QTBUG-64718
Change-Id: I71488efd29b645f7b228fffd14f9d84cc205c4b3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.
Change-Id: I1861e5366ea980dff2ffa753b137276c77278eee
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Often requested feature in QtWebKit is reporting what kind of resource
corresponds to particular QNetworkRequest, similarly to
QWebEngineUrlRequestInfo::resourceType(). This information can be used
to modify or block certain request types in user's implementation of
QNAM::createRequest().
The only clean way to pass this data is via attributes of QNetworkRequest,
so enum value needs to be reserved. It's unlikely to be used anywhere
outside of QtWebKit, however this is already the case for
SynchronousRequestAttribute.
Change-Id: I51a258e5e4b78e6e823c30c48d0c644356de6b17
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The test is removing 2 rows starting at the last row of a model.
As the comment indicates, that's clearly invalid.
Change-Id: I43ef00d602934965b206e2ba591ff8fd0a6ae398
Reviewed-by: David Faure <david.faure@kdab.com>
Unary ~ is not defined for enum classes, so we need a cast.
Change-Id: I79d495ebcc24ab960da8dae3be08eb307a9de448
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When processing host lookup error if-statement only checks the connection
type SPDY, which is not right - it could also be HTTP/2. As a bonus:
QT_NO_SSL conditional inclusion is not needed - HTTP2 can be 'clear text'
and SPDY enumerator is defined even in no-tls build (and is just a
noop here). Also, improve our somewhat cryptic message in 'Should not happen'
else branch - 'cannot dequeu' says nothing about HostNotFoundError.
Task-number: QTBUG-64721
Change-Id: Ib0346b8717c2dbddaffab690298f3cae01e338ea
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
... and unblacklist it on Windows.
From what I can tell there is no particular reason why this test fails
other than that it is a little too slow sometimes (these things happen).
So, to fix the test I bumped the timeout, but to avoid the test running
for longer on every test-run it now also ends when the socket enters
the "Unconnected" state.
Previously it failed 171/500 times, and after this patch it failed
0/1000 times.
Change-Id: I4266bff6b91aaaf502ee66265d01c3a177706402
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Some cursor themes may not contain cursors with common names,
then fallback names should be used. The fallbacks in this
change were taken from the wayland plugin.
Change-Id: I7fcc47a71cafe41c88a21a7168acd3a274b71693
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Also we can't use constructors for multiple reasons now that it is C.
Change-Id: I27f3e011cc1f67f5aa134eaf3ab934456cead902
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
An over-correction snuck in at some point.
Change-Id: Ib67c4f6ecf8e6e244a0598c025a7cb7c15401070
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>