After the move to PCRE2, optimizing patterns has been a thorn in the
side due to the fact that PCRE2's JIT compiler modifies the pattern
object itself (instead of returning a new set of data, like PCRE1
did). To make this fit with the existing behavior, a read/write
lock was introduced, with the read part locking when matching and
the write when compiling (or JIT-compiling) the pattern.
This locking strategy however introduced a performance issue,
as we needed:
* to acquire a write lock to compile/optimize the pattern (incl. the
common case where the pattern was already compiled, so bailing out
immediately);
* to acquire a read lock during the actual match, to prevent
some other thread from optimizing the pattern under our nose.
This was due to the "lazy" optimization policy of QRegularExpression
-- optimize a pattern after a certain number of usages. The
excessive amount of locking effectively limited scalability.
Simplify the code, and drop that policy altogether: since JIT
compiling in PCRE2 is faster and pretty much "always recommended",
just always do it for any pattern (unless it gets disabled via
env variables) when compiling it.
This allows to go back to a plain QMutex, and now the actual
matching doesn't require acquiring any locks any longer. Of course,
there is still a mutex acquired just before matching for checking
whether the pattern needs recompiling in the first place; this can
probably be further optimized via double-checked locking (using
atomics), but not doing it right now.
This shift makes a couple of pattern options controlling
optimization useless, and allows to centralize the 3
QRegularExpression tests (which were actually the very same test,
just setting slightly different optimizations strategies).
While at it, install a stress-test for threading, with the idea
of running it under TSAN or helgrind to catch bugs in
QRegularExpression's locking.
[ChangeLog][Important Behavior Changes][QRegularExpression] Regular
expressions are now automatically optimized (including JIT
compiling) on their first usage. The pattern options
OptimizeOnFirstUsageOption and DontAutomaticallyOptimizeOption no
longer have any effect, and will get removed in a future version of
Qt. QRegularExpression::optimize() can be still used to compile and
optimize the regular expression in advance (before any match), if
needed.
Task-number: QTBUG-66781
Change-Id: Ia0e97208ae78255fe811b78029ed01c204e47bd2
Reviewed-by: David Faure <david.faure@kdab.com>
linux-icc and macx-icc toolchains contain a significant amount of code
which can be merged to a common configuration file.
as a side effect, such merge resulted in reduction a parts of
linux-icc and macx-icc toolchains to the common view.
Change-Id: I37d110734eeeb9bd61ca0aa942de380ac8e75f1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And disable menu actions for functionality that's not available.
Task-number: QTBUG-68168
Change-Id: I153487860e8dda8271ae04e9cd2ad8b26a4b130f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This greatly reduces how often we reset the scroll evaluators,
especially with non-focused windows in KWin which sends an enter for
every wheel events in that case.
The update of the evaluators also has race conditions with the normal
events, and thus reducing them fixes odd scrolling behavior with rapid
firing mouse wheels.
Task-number: QTBUG-42415
Task-number: QTBUG-68734
Change-Id: I1c14ca3352bf9c6e57e47ad3aaee1712fe6ba30b
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
...for consistency with the other platform plugins.
Change-Id: I85946d610a62c19140618c83f80c4aa63fce4bc3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
A simple application that establishes DTLS connection(s) and
sends/receives datagrams. Class DtlsAssociation is
essentially a QUdpSocket|QDtls pair: it initiates a handshake,
handles timeouts and errors. After establishing an encrypted
connection it sends messages to the server and processes responses.
Task-number: QTBUG-67596
Change-Id: I92d481b7dfd2459e6a93c754b338a2e897a7feaf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
QTimeZonePrivate::isValid() just checks m_id is non-empty; so we have
to leave m_id clear if we don't get a valid time-zone back when we ask
the JNI for one. Unfortunately, JNI gives us a "valid" default zone
if it doesn't recognize the given name; so check the known names of
this zone (or of zones with its offset); if the given ianaId isn't one
of them, assume this is a bogus zone.
Task-number: QTBUG-68842
Change-Id: I6245db18c59c4261ed5fcd4d948dd773365ce61d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Before the fix is applied this test fails because QFINDTESTDATA will
return "/usr/" instead of the folder with the same name in the current
directory.
The 'usr' folder can't be located 'next to' the application since this
does not trigger the issue (QFINDTESTDATA looks for the folder next
to the executable early on). So we put it in a subdirectory and change
the current working directory to its parent directory.
Change-Id: I627679dcb6f2f6954264e23bfc1a71de3bff7203
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Newer mouse devices support a so-called "free-scroll" mode, which
unlocks the wheel and allows for faster scrolling. For such input
devices, evdev will report an event value greater than 1, when free
scrolling is active. Examples for such devices would be the Logitech
G700 or MX Master series.
However QEvdevMouseHandler interpreted such an event's data incorrectly
and triggered wheel events for the opposite scrolling direction. This
also often resulted in jittery & jumpy scrolling, when the events'
values alternated between 1 and 2.
Change-Id: Ibb23ed4419d647fff9b90d371d5bb4037cf2bd9b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
While at it, fix some more issues in the sentences to
harmonize the description between the different classes.
Change-Id: Iee1c3ffe6fd71e82504bfb003d927c4db3b2a065
Reviewed-by: Martin Smith <martin.smith@qt.io>
The ObjectBoundingMode coordinate mode of QGradient allows specifying
the gradient coordinates relative to the object being painted. But if
the gradient brush also has a transformation, that transformation is
applied in the logical, not object, coordinate space. That behavior is
counterintuitive. However, changing it now would break existing
code. Instead, we introduce a new coordinate mode enum with the
expected behavior, and document the old one as deprecated.
This prepares to fix the bugs below in qtsvg, by making
it possible to specify the same behavior in Qt as SVG has.
[ChangeLog][QtGui][QGradient] Add ObjectMode coordinate mode
[ChangeLog][Important Behavior Changes] QDataStream version bumped up to 18 to account for changes in the serialization of QGradient.
Task-number: QTBUG-59978
Task-number: QTBUG-67995
Change-Id: I8820a2555359812f3e1a46e37d6ac2cc29a2091d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
TempFileTemplate is initialized each time an application starts.
It leads to the call of QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation)
which is slow and can even change permissions of the runtime directory.
Use a static wrapper function to initialize this variable only when needed.
Change-Id: Ib620f9b842c88103c67f8dfab200f4d39c9981ee
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
QImageWriter::supportedMimeTypes() had an empty mimetype name
in the list because the mimetype for the key "cur" was missing in this
json file.
Change-Id: I4eae4275cb04c4d640dbcac76cd9dc99baa4f0a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Convert these keysyms into the corresponding Qt::Key_ enum values,
so that they can be part of a QKeySequence and used by applications.
Task-number: QTBUG-69062
Change-Id: I6f2e28191dd8dacd63d4bf710e1714fc5dcce75f
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Fix warnings about invalid function type casts (return types
conflicting with the FARPROC returned by GetProcAddress()) like:
corelib\global\qoperatingsystemversion_win.cpp💯48: error: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'RtlGetVersionFunction' {aka 'long int (*)(_OSVERSIONINFOW*)'} [-Werror=cast-function-type]
by introducing nested casts.
Task-number: QTBUG-68742
Task-number: QTQAINFRA-2095
Change-Id: I8ba6a74e6347dada486ca40c98aa8999957c4281
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
We cannot inline methods of QThreadPrivate because QThreadData has to
be declared before. The global QThreadData needs to be accessible to
QThreadData::clearCurrentThreadData(), and QAdoptedThread::run() has to
be moved inside the #ifndef QT_NO_THREAD block as run() doesn't exist
in the stub and Q_DECL_OVERRIDE would be wrong.
We also fix the QThreadData::current() method to take and use the same
parameters as in the non-stub case.
Change-Id: Id29ca44b11fa95ed2df7cc39243a07ce7d3c455e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
sleep, msleep, and usleep are not actually related to threading and
serve a purpose also in a single threaded application.
Change-Id: Iba2e343d48a9c09e60125bc1b589047e0241608a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
While at it, add the comment to the toFloat() functions also.
Task-number: QTBUG-55232
Change-Id: I21c06363946f35fb3d89a51e4f75be392b57c0a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Both use QLocale::toDouble behind the scenes, so the same limitations
apply. Document them for toFloat() also.
Change-Id: I954362a0db203630685c034df6a921fa6447a509
Reviewed-by: Martin Smith <martin.smith@qt.io>
... which may cause dnd data to be lost.
As soon as Unity sees that dnd operation has started (it monitors
for changes on XdndSelection) it creates an invisible window
named XdndCollectionWindowImp that fill entire screen and starts to
act as DnD target. Once it has fetched the mime data it moves
XdndCollectionWindowImp away without sending any DnD termination
events. XdndCollectionWindowImp does not respect the XDnD protocol.
Only when its gone we can start a normal dnd operation - looking for
real DnD target. We ask windows if they are XdndAware on the initial
mouse press and subsequent mouse move events. This patch sets a cursor
to Qt::ForbiddenCursor while DnD is interfered by XdndCollectionWindowImp.
A user will see the real DnD action (reflected by cursor) only after
the next mouse move when XdndCollectionWindowImp has stopped interfering.
We also setCanDrop(false) while DnD target is XdndCollectionWindowImp.
Temporary seeing ForbiddenCursor is better than losing DnD data.
Dropping in this state means that drop will simply be ignored.
It is unclear what Unity developers expected DnD source window to do when
user releases mouse while XdndCollectionWindowImp is stealing the data.
Looking at Unity code, it appears that they were hoping to be quick
enough that it would never happen.
Task-number: QTBUG-49464
Change-Id: I10880073f6d843572be44fe9a3c4f78194466299
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
- moved finding of XdndAware target logic in its own function to
reduce size of QXcbDrag::move().
- switched to use categorized logging with more consistent logging messages
- added more comments to avoid constatly looking at the
specification for the meanings of Xdnd* actions and who
sends/receives the action.
- removed dead code (findXdndAwareParent), which should have been
removed in 269fdbdd2b when reimplementing
this logic in XCB.
- removed needless reseting of state variables in various places as
this is handled in QXcbDrag::init() on DnD start.
- renamed variable in QXcbDrag::dndEnable(): xdnd_widget -> window
- and other minor cleanups
Change-Id: Ib667f80ceb4c07b7409a90c041044c98665877f3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
winrt still has some issues with some character sets. These
tests are skipped/blacklisted for now and will be investigated.
Task-number: QTBUG-68297
Change-Id: I898e3383a4673b6dc87815a75e705f3302a4cbba
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
A change between 5.11 and dev has modified the position of testqrc
inside the resource list. Adapt accordingly.
Change-Id: I697103f4b8c9e93bb613e814c47a4e68e9a997ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In order to get winrt CI checked, the network tests are being skipped
for now. As soon as winrt has landed in CI, these will be fixed and
re-enabled.
Task-number: QTBUG-68297
Change-Id: I692d72f9e0c97840bd7396551b4e707eec845ebb
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
The order of the arguments of QHashCombine::operator() was
accidentally swapped -- the first is supposed to be the
accumlated value, the second the new value to combine.
[ChangeLog][QtGui][QMatrix] The qHash() implementation for
QMatrix has been changed.
[ChangeLog][QtGui][QTransform] The qHash() implementation for
QTransform has been changed.
Change-Id: Iba13f76ff734a2184c96184ee0e5748c05db07fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test is somewhat similar to tst_QSslSocket but is smaller (in scope, will
grow in future), it has no QTcpSocket/QAbstractSocket-specific things and
has more DTLS-specific code. At the moment it does not use our network
test server, all work is done in the same process with two QUdpSockets
and two QDtls objects. We test (both on client/server ends):
- parameters validation (for all functions that do this) and
the correctness of error codes/handshake states
- handshake procedure (with/out certificates and with pre-shared keys)
- timeouts and re-transmissions during (D)TLS handshake
- peer verification (and related verification errors)
- aborted/resumed handshake
- encrypted I/O
- DTLS shutdown
For now, this test is OpenSSL-only.
Task-number: QTBUG-67597
Change-Id: I27006bfe3d6c02b89596889e8482a782c630402a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It's a simple DTLS server, implemented with QUdpSocket,
QDtlsClientVerifier and QDtls. The server is configured
to use PSK only (it has no certificate/key).
The server uses a single QUdpSocket socket and
de-multiplexes UDP datagrams internally (thus
it can work with several clients simultaneously).
Future update will probably add more options (like
configuring with certificate/key, etc). For now -
it's as minimalistic and simple as possible.
Task-number: QTBUG-67596
Change-Id: Ic7d18dbab6dbcc9ed44c82e69a2b364df24aa256
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This is comparable to what we do on macOS, except that the scroll phase
and inverted state are missing.
Task-number: QTBUG-38570
Task-number: QTBUG-56075
Change-Id: I27502e1e2667317ab701f30f1fc601ae1e0591d0
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
List the values that are compared by the comparison operator overloads,
rather than the less specific "all values".
Task-number: QTBUG-68877
Change-Id: Id4df02b9019e13113fd38a598b8349293fab7915
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
For now the new feature depends on openssl as that is the only supported
implementation. Once we get an implementation for SecureTransport, we
can change the condition.
The feature needs to be public because qdtls.h is a public header.
Change-Id: Ie3e4acbeb2888f2fb13453b3ecdc19bacc83f6e6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The inline operators are referenced by the container serialization
helper code above the definition, causing g++ 8.1/MinGW to complain:
In file included from ..\..\include/QtCore/qdatastream.h:1,
from access\qnetworkaccessdebugpipebackend.cpp:41:
..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:349:21: error: 'QDataStream& QDataStream::operator>>(quint32&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]
inline QDataStream &QDataStream::operator>>(quint32 &i)
^~~~~~~~~~~
..\..\include/QtCore/../../src/corelib/serialization/qdatastream.h:361:21: error: 'QDataStream& QDataStream::operator<<(quint32)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]
inline QDataStream &QDataStream::operator<<(quint32 i)
Declare the operators to be inline to fix this.
Task-number: QTBUG-68742
Task-number: QTQAINFRA-2095
Change-Id: Ifa075aff8749df5c7a56148b8b9a0e3ec1e853aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change a0a22037cd wrongly introduced
a level of indirection when passing the MSG * as void * to
QWindowSystemInterface::handleNativeEvent() in
QWindowsContext::filterNativeEvent(). Remove the indirection.
Task-number: QTBUG-67095
Change-Id: Ibc2db7ae56bca38f79bafabfabb6127d6ff8cf09
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Add menu bar with Help->About that contains a short description of the
example application.
Remove redundant title string between menu and application content.
Task-number: QTBUG-68652
Change-Id: I31fb386ab9c01eff86b8ed3ef274ba8cfdb0148b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
... by adding a prefix to the resource.
On android there is a resource ("qpdf") which gets included in the root
in all applications, included from "src/gui/painting/painting.pri".
So we move the test data to a sub-folder.
Task-number: QTBUG-68596
Change-Id: I67f2ed79a32c68d9a76cafba8ef23fe0da7c0fe8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When cross-compiling for Android on Windows the 'relative to test
source' option could end up possibly matching with a matching folder in
root ('/') because file is a Windows path and the canonicalFilePath of
that path is "".
Fixes tst_qxmlstream (and possibly others) on Android when Qt is
compiled on Windows.
Task-number: QTBUG-68596
Change-Id: I378374e41eea80f43680b3941adaa91fa604934a
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
"terminate" and "terminated" both fail on Android since
QThread::terminate not supported on Android. So we should skip them.
Task-number: QTBUG-68596
Change-Id: Id0d1dde2cfa02bb2978e5dd16087bf8f3bf112b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>