Need to do the same for startsWith() and endsWith(). indexOf() is a lot
harder.
[ChangeLog][QtCore][QByteArray] Added compare(), which takes
Qt::CaseSensitivity as one of the parameters. This function is more
efficient than using toLower() or toUpper() and then comparing.
Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
When an internal DnD occoures in IconMode, the item is moved to it's new
place but the logic in filterStartDrag() has no clue about the fact that
an internal move happend. Therefore the item gets deleted. Fix it by
changing the event's drop action to Qt::CopyAction to avoid the deletion
as it is done within QListWidget DnD code.
[ChangeLog][QtWidgets][QListView] Do not delete item on internal move.
Task-number: QTBUG-67440
Change-Id: I873d3c9fa76e107e108d9af0dcf8cecd1e18a18f
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
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>
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>
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 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>
This part of DTLS is relatively easy to test: we never do a complete
handshake. Certificates, verification, ciphers, etc. - do not matter
at this stage (to be tested in tst_QDtls). Errors are mostly insignificant
and can be ignored or handled trivially.
The test is OpenSSL-only: SecureTransport failed to correctly implement/
support server-side DTLS, the problem reported quite some time ago and
no fixes from Apple so far.
Task-number: QTBUG-67597
Change-Id: I21ad4907de444ef95d5d83b50083ffe211a184f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When an item is explicitly hidden, then it should stay that way even if
its parent is reparented. The item itself needs to be explicitly shown
for it to be made visible.
Task-number: QTBUG-54843
Change-Id: I0c6eea9a936f82d5874e3246292bd16365440411
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This autotest fails on Ubuntu 18.04 builds.
Task-number: QTBUG-68865
Change-Id: Ia245f72826be071e5617c417e3d9f50bdcc689a9
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This autotest fails on Ubuntu 18.04 builds.
Task-number: QTBUG-68864
Change-Id: Ib4baa458b80eea5861e89145b85d865e9a78989c
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This autotest fails on Ubuntu 18.04 builds.
Task-number: QTBUG-68862
Change-Id: Ib02c28ede135c9ba4303dbf0224b32b080762a31
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This autotest fails on Ubuntu 18.04 builds.
Task-number: QTBUG-68861
Change-Id: I343d8b583d105a7e1cc336e94399cde9eb261e9c
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This autotest fails on QEMU armv7 builds.
Task-number: QTBUG-68866
Change-Id: Idb4bf39712a22c40f6d779a46ad2dd1f456ef48b
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This autotest fails on Ubuntu 18.04 and QEMU builds.
Task-number: QTBUG-68860
Change-Id: I1907e713e8c743cf5cf8e284df516600a0c03dba
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
It's not possible to ask for window activation on Wayland, and some Wayland
compositors—such as Weston—don't give window focus to newly created window
either.
Task-number: QTBUG-62188
Change-Id: Ibebb2a14e03127fec703d79498627fccf65b2f88
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
It was the same in all test rows, so move it from the _data() to a
fixed value in the test. Also, don't implicitly coerce C-string
literals to QString.
Change-Id: Ieee4c7ffbf251c4b69b5acd79125dfa93eb51d6e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This property allows to change the default behavior in
which list items occupy the entire width of their column.
Setting it to Qt::{AlignLeft,AlignRight,AlignHCenter} will
reduce their widths to the minimum values, thus allowing to
have intermediate free space. Then the user will be able to
begin selections by mouse from this space.
[ChangeLog][QtWidgets][QListView] Added itemAlignment property.
Task-number: QTBUG-56606
Change-Id: Iae55c251379be4e45d0c0d69175ff4388b5785b4
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This is very similar to QJsonDocument, but there's no QCborDocument.
QCborValue is that.
[ChangeLog][QtCore] Added QCborValue, QCborArray and QCborMap, classes
that permit DOM-like access to CBOR data. The API is similar to
QJsonValue, QJsonArray and QJsonObject, respectively.
Change-Id: I9741f017961b410c910dfffd14ffca50dd8ef3ba
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When pasting text, it is possible that part of the text is still pasted
but part of it is not. For example, if there is a maximum length set then
only the first part of the text is pasted and the rest is dropped. In
this case it should still emit inputRejected() as not all of the input
was accepted. This amends c901cdadc0.
Change-Id: If7906767be27e88ed9914c50bf0427833de5b8fa
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QIODevice represents considreable overhead, even with just QBuffer, for
parsing simple things. Benchmarking showed it was spending 25% of the
parsing time inside one QIODevice function or another. So this commit
accomplishes two things:
1) it increases the buffer size from 9 bytes to up to 256, which should
reduce the number of calls into the QIODevice
2) if the source data is a QByteArray, then use it directly and bypass
the QIODevice, thus increasing performance considerably
Change-Id: I56b444f9d6274221a3b7fffd150c531c9d28e54b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Adjust line positions to deal with negative leading which isn't included
in height of QTextLine.
Change-Id: Id7918968c0f9d7e65700b9e7a08fc5d761883f22
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
As the full range of TIME is '-838:59:59' to '838:59:59' then we cannot
use QTime as the object to store this data in. Therefore a QString is
used instead for passing the data to and from. This does not impact
existing code using QTime already as it will still convert it from
the QString to a QTime to give the same result as before.
[ChangeLog][QtSql][MySQL] The TIME data type is now treated like a
string-based type in order to respect the full range of the TIME data
type.
Task-number: QTBUG-57028
Change-Id: Ieb7105bff3043b845f76bc873d088e6bac1e4f10
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
If the fbo had samples > 0 set, it would use a temporary fbo with
a default configuration losing the HDR precision.
Change-Id: I7e9966165b3100f148c4ad24738f3ee71273f29a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The implementation of QTransform::transposed() had a wrong assumption
about the type of the result.
Task-number: QTBUG-68630
Change-Id: Ia5ce794efe773d74fb5fdaff3da8cae2b452e7e5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The test doesn't make much sense on platforms that don't support window
activation.
Task-number: QTBUG-66849
Change-Id: I875314d026d666173ec345d0864ad41d66179783
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The test is actually passing, so just enable it.
Task-number: QTBUG-66849
Change-Id: Ie1566b9e5e19f5ab6d919624aa14662a1d4483ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Link to a bug report so we can track the failures and figure out how to fix
it in Qt Wayland or if we should skip the tests in a proper way. I.e. with
platform capabilities or similar.
Task-number: QTBUG-66849
Change-Id: I7a16333c7d2284eb9da6efd4515891438e9976b3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Unlike QNAM, our toy http2 server sends payload as one big chunk as soon as
it fits in the receive window's size. Internally, 'frame writer' splits this
payload into many DATA frames of the appropriate size (imposed either by the
default value or the one from the client's SETTINGS frame). If some test fails,
we can end up with a server waiting for the writer to send all the DATA frames
though it is not needed anymore - there is nobody to receive them after a failure.
This patch moves such a loop into the test server instead and stops the loop early
if needed.
Change-Id: Iea2dcd718d8f83386fd16004807f6447bf999435
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Currently when doing comparison with std::tuple the fallback toString
method is called which returns a Q_NULLPTR thus not allowing proper
diagnostic of the values that triggered an error. This patch
adds support for std::tuple to improve the tests output readability.
[ChangeLog][QtTest][QCOMPARE] Now outputs contents of std::tuple on
failure.
Change-Id: I046a55e2ce44c3f7728d51e4745120d38aa5e007
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtWidgets][QLineEdit] Added inputRejected() signal for when
a key press is not accepted by the QLineEdit. For instance, when an
invalid key is pressed for a validator set.
Task-number: QTBUG-57448
Change-Id: I39182a78b07b37c6da01905b8da4c57930e3454b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Nothing in this test references date-times.
Change-Id: I4005cda550d54abe46370963b1e91fab9829298d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Similar to Qt::GlobalColor, the presets allow the user to create
brushes based on predefined gradients, quickly getting pretty pixels
on screen.
The presets are based on the linear gradients from WebGradients, a
free collection of gradients, hosted at https://webgradients.com/.
The few radial and blended gradient presets have been excluded.
Change-Id: I1ce8f2210a6045c9edb8829ab3eddcc313549127
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Avoids an unused function warning.
Change-Id: Id221595920e9a34eb83b66fe123d664f60fcae05
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
qFuzzyIsNull has a fixed range, where qFuzzyCompare can tell if numbers
are different in a more relative range. Without it QPointFs that are
heavily scaled will be interpreted as identical, when they are quite
different at their own scale.
Task-number: QTBUG-60359
Task-number: QTBUG-62161
Change-Id: Ic4ba90e9e994aedff5548d690f053eb309b0a60b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a QComboBox is used as the editor for a relation inside a view then
it could end up showing the contents of the EditRole. This would be the
field which is used to represent the entry as opposed to the DisplayRole
which is what the user would expect to see is.
Therefore, setEditorData() is overridden to ensure that it is showing
the right data to the user. When the model gets updated, it will take the
corresponding EditRole value as before to ensure it is updated correctly.
Task-number: QTBUG-59632
Change-Id: Ibbccc3e9477de1cdefb654051b97dd111df36382
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>