Commit Graph

11282 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
1e8d623340 QThread::create: remove the pre-C++17 codepaths
As we require C++17 now. The configure-time test checking for
future/async is left in for the moment being.

Change-Id: Ifde39d420673f70a2277f5a645bfaad30935a381
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-07 20:54:12 +02:00
Shawn Rutledge
c7c28b3406 Separate QPD::tabletDevice into priv tabletDevice and queryTabletDevice
There doesn't seem to be any reason users will need to query tablet
devices by their IDs, because every event comes with a complete
instance already, and we have QInputDevice::devices() to list them all.

QPointingDevicePrivate::tabletDevice() can create a new instance if a
matching one is not found (and complains about that); it's intended
for use in QtGui, as a way to find the device if it was not part of the
QWSI event. Now it sets the parent of those auto-created instances
to QCoreApplication to avoid a memory leak.

On the other hand, queryTabletDevice() is intended for use in platform plugins
that need to check whether an instance exists; but they will take care
of creating new instances themselves, and thus have more control over the
parent and the details being stored. Now that the systemId can also be given,
the search is more likely to have a unique result, on window systems
that provide device IDs.

Rename id() to systemId() to clarify that it's a system-specific unique
device ID of some sort, not the same as the uniqueId that a stylus has.
However it seems that in practice, this will often be 0; so clarify that
if it's not unique, QInputDevicePrivate::fromId() and queryTabletDevice()
may not always find the right instance.

Clarify the function usage via comments.

Change-Id: I82bb8d1c26eeaf06f07c290828aa17ec4a31646b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 16:14:58 +00:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:51:48 +02:00
Jani Hautakangas
d9cc149995 Fix floating point clip rectangle rounding in raster and opengl paint engine
Fixes: QTBUG-83229
Pick-to: 5.15
Change-Id: If94028f27c9085e391acb9c423cde1b7c12bca36
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-07-07 11:50:09 +02:00
Jarek Kobus
989fca660c Use QList instead of QVector in corelib tests
Task-number: QTBUG-84469
Change-Id: Ic80fde5517aed363f17d0da55cadcc958c3c8895
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Jarek Kobus
d33655a953 Use QList instead of QVector in other qtbase tests
Task-number: QTBUG-84469
Change-Id: Ie0455c890c048c52eacad1badd6d21df999badf9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Lars Knoll
9117e3850b Rename from() to sliced()
After API discussions, agreement was that from(n) is a bad name
for the method. Let's go with sliced(n) instead.

Change-Id: I0338cc150148a5008c3ee72bd8fda96fb93e9c35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:35 +02:00
Lars Knoll
792cb3989a Add support for first(n), last(n) and sliced() to QList
This keeps the API symmetric with what we have in our string
classes.

Change-Id: I94c5b39b718ca2472f9ca645e7a42e4314636f67
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:25 +02:00
Lars Knoll
9a9a1a2a2e Port QString to qsizetype
Change-Id: Id9477ccfabadd578546bb265a9483f128efb6736
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:20 +02:00
Lars Knoll
df853fed66 Use qsizetype in QList
The change creates a slight source incompatibility. The main
things to take care of are

* code using printf statements on list.size(). Using qsizetype in
printf statements will always require a cast to work on both 32
and 64 bit.
* A few places where overloads now get ambiguous. One example is
QRandomGenerator::bounded() that has overloads for int, uint and
double, but not int64.
* Streaming list.size() to a QDataStream will change the format
depending on the architecture.

[ChangeLog][QtCore][QList] QList now uses qsizetype to index into
elements.

Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:14 +02:00
Lars Knoll
215ca73534 Allow allocating more than 2G items in a vector
Also adjust qCalculateBlockSize() to be able to handle large
allocations.

QVector::length() is currently still limited to 2G items, that will
get changed in a later commit.

Change-Id: I3a92fbfd7f281d30844c5fafa3b9a474bc347c19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:01 +02:00
Lars Knoll
fbce2e58e6 Get rid of QArrayData::sharedNull()
Remove the last places where those got used and avoid
allocations when we resize to 0.

Change-Id: Ib553f4e7ce7cc24c31da15a55a86d18bdf1cc5c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:33 +02:00
Lars Knoll
f8a53388a7 Get rid of unused flags in QArrayData
Change-Id: I3ea754b44fb33e33baba0781d9ae15b7f3b3d8eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:19 +02:00
Lars Knoll
a46caf087c Simplify Q_ARRAY_LITERAL
And clean up some unused pieces of code.

Change-Id: I285b6862dc67b7130af66d3e08f652b1a56b990e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-06 21:30:06 +02:00
Lars Knoll
76004502ba Get rid of shared null for QByteArray, QString and QVector
As a side effect, data() can now return a nullptr. This
has the potential to cause crashes in existig code. To work
around this, return an empty string from QString::data()
and QByteArray::data() for now.

For Qt 6 (and once all our internal issues are fixed), data()
will by default return a nullptr for a null QString, but we'll
offer a #define to enable backwards compatible behavior.

Change-Id: I4f66d97ff1dce3eb99a239f1eab9106fa9b1741a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:29:58 +02:00
Andy Shaw
96cea3b168 Export the letter and word spacing settings set on the default format
When the default format has letter and word spacing set then these
should be exported in the HTML's body tag. This also adds support
for the reading of letter-spacing and word-spacing set too, so that
the same html outputted can be read back in.

Fixes: QTBUG-83718
Change-Id: Ic4afca21eb05efb779dbf99c6b3c13373e851f15
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-06 14:35:57 +02:00
Lars Schmertmann
18cfabafa6 Remove unnecessary ; after function implementations
Task-number: QTBUG-82978
Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-06 11:46:39 +02:00
Lars Schmertmann
11b3092cc4 Refactor tst_Collections
This improves the readability and avoids code duplication
in tst_Collections::forwardDeclared. Also some warnings
are fixed:
* qSort is deprecated.
* The = operator for LargeStatic needs to be implemented
  explicitly when a copy constructor is given.
* QMap::insertMulti is deprecated, a MultiMap is required.

Task-number: QTBUG-82978
Change-Id: I577f851394edfaa30154bd3417ce391635cc546d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-06 09:42:36 +00:00
Lars Schmertmann
ae890390e5 Avoid use of Q_UNUSED by eliminating the parameter names
This change only happens to files touched
by the commit to add missing ; to Q_UNUSED.

Task-number: QTBUG-82978
Change-Id: I10e6993a2bb3952cf9a262708b8573550e0dbe63
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-03 21:10:09 +02:00
Lars Schmertmann
d4c04acc65 Remove deprecated empty macro
Change-Id: Ib2a646ee22a7f97dae584e6f068f17378fe2b494
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-02 20:51:52 +02:00
Edward Welbourne
057329c24c Make feature datetimeparser depend on feature datestring
No client of QDateTimeParser actually uses it unless datestring was
enabled, nor is it any use without datestring. Various methods
conditioned on datestring are broken unless datetimeparser is enabled.
We can't condition public API on datetimeparser, as it's a private
feature, but client code can condition use of it on the private
feature. All string-to-date/time conversions that use a string format
(this includes all locale-specific formats) depend on feature
datetimeparser.

Change #if-ery (or add it) in all client (including test) code to test
the right feature.

Tidied up some code in the process. Killed some already-redundant
textdate #if-ery. Renamed a test whose name claimed it involved
locale, which it doesn't, in the course of #if-ing it.

This simplifies the condition for feature datetimeedit (which overtly
depended on textdate, redundantly since it depends on datestring which
depends on textdate; its dependence on datetimeparser now makes its
dependency on datestring also redundant).

It also removes the need for assorted datestring checks in
QDateTimeParser itself.

Change-Id: I5dfe3a977042134b2cfb16cbcc795070634e7adf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-02 15:35:18 +02:00
Edward Welbourne
c30e0c656f Update tests/auto/corelib/time/'s CMake config
Recent changes in .pro files hadn't been propagated.
Re-ran pro2cmake.py and saved the results.

Change-Id: I91e4cd513329bce10ce8cbd0ddae8240af050213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-02 15:35:17 +02:00
Edward Welbourne
ca8b2a3632 Remove assortee pre-Qt6 code from date/time tests
Assume QT_VERSION >= QT_VERSION_CHECK(6,0,0) throughout.

Change-Id: If70c59f9319f72549de581fc446fd60d32b02521
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-02 11:33:01 +02:00
Tor Arne Vestbø
6ff79478a4 Introduce platform API abstraction for QOpenGLContext
The API is available by including qopenglcontext.h as usual,
but scoped in the QPlatformInterface namespace. The namespace
exposes platform specific type-safe interfaces that provide:

 a) Factory functions for adopting native contexts, e.g.

    QCocoaGLContext::fromNative(nsContext, shareContext);

 b) Access to underlying native handles, e.g.

    openGLContext->platformInterface<QCocoaGLContext>->nativeContext()

 c) Platform specific functionality, e.g.

    static QWGLContext::openGLModuleHandle()

    openGLContext->platformInterface<QEGLContext>->doSomething();

The platform interfaces live close to the classes they extend,
removing the need for complex indirection and plumbing, and
avoids kitchen-sink modules and APIs such as the extras modules,
QPlatformFunctions, or QPlatformNativeInterface.

In the case of QOpenGLContext these platform APIs are backed
by the platform plugin, so dynamic_cast is used to ensure the
platform plugin supports the requested interface, but this is
and implementation detail. The interface APIs are agnostic
to where the implementation lives, while still being available
to the user as part of the APIs they extend/augment.

The documentation will be restored when the dust settles.

Task-number: QTBUG-80233
Change-Id: Iac612403383991c4b24064332542a6e4bcbb3293
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-02 10:27:50 +02:00
Wang Chuan
c513b1214e QTabBar: make sure the tab is repainted after releasing mouse
The tab has to be repainted even f the mouse release event happened
outside the tab bar, otherwise it will look like the tab is still
pressed.

As a drive-by, replace the repaint() call with update(); there is
no need for synchronous painting in an event handler.

Pick-to: 5.15
Fixes: QTBUG-81637
Change-Id: Ia55182be906511ac3b462f00add8a621c6c05fc3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-02 04:17:52 +02:00
Edward Welbourne
da7f4a4c76 Replace a constant with a predicate function using it
Rather than naming a "GMT" string so as to repeatedly test whether a
date-time's string representation ends in it, use a simple lambda to
do the test, so that the string is only used in one place anyway.
Makes the test code more readable.

Change-Id: I5afad9ad5d58702bea7f24e5e5688ea4d738ae0d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-01 16:00:34 +02:00
Alexandru Croitor
5d6705c567 CMake: Skip / ignore failing tests on CMake platforms
Skip crashing tests and ignore failing tests on CMake platforms.

Add missing QTEST_ENVIRONMENT=ci env var assignment to Coin test
instructions. This was hardcoded by the Coin code for qmake
configurations.

Task-number: QTBUG-85364
Change-Id: Id2312e504a0d36b8f8596d4cebaa49c63731406e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-01 14:55:29 +02:00
Volker Hilsheimer
ab6861b01f Fix delivery of MouseMove events to newly opened popup windows
Amend d934fd7f54, which was too naive in
assuming that any change to the popup stack while a popup had been
pressed into should result in mouse move events to be delivered without
buttons.

Instead, add a new flag that is set explicitly when the qt_popup_down
widget is closed, and remove buttons from the move move events only when
that flag is set.

Add the sorely missing test case as well, even if we have to accept that
not all behavior can be tested reliably. Ie. on macOS, the simulated
mouse event differs from the event we do get from the QPA plugin or the
system; on Xcb, some of the behavior depends on the window manager.
This is something we could try to clean up for Qt 6.

Change-Id: Ibf0a0a6fb7d401915057365788947e5a35aa20c3
Fixes: QTBUG-84926
Task-number: QTBUG-82538
Pick-to: 5.15
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-07-01 14:52:49 +02:00
Timur Pocheptsov
37d9e44cd0 QSslConfiguration::setCiphers - introduce the overload taking QString
We had such an overloaded version in QSslSocket, it was deprecated without
providing any alternative. Now this function has some use and may be
introduced in Qt6, as QSslConfiguration::setCiphers(const QString &).
Last but not the least - a useless and strange auto-test was removed
(it was creating a list of 5 QSslCiphers each with isNull() == true).
That's becasue '!MD5' or 'ALL' (for example) is not a cipher to be found
in supportedCiphers.

Change-Id: I47eb4c0faa9b52885e883751dd992cd9cb3d26fe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-07-01 11:26:15 +02:00
Alexandru Croitor
fb55e1e71e Sql: Fix heap-user-after-free for globally initialized db objects
Becaues the database objects were created as globals, there was a
possible use-after-free issue when deleting the objects on application
exit.

Move the initialization of the database objects into static variables
inside the test constructor.

As a drive-by, also add one missing test to the CMake projects.

Fixes: QTBUG-85357
Change-Id: I2c8f2c5daee96bb9d1d21dae37950a2da5ffdf27
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-01 10:03:57 +02:00
Volker Hilsheimer
980795dc55 Let QScreen::grabWindow's winId parameter default to 0 and add test
The platform plugins are implemented to grab the entire screen if
no window ID is provided. They do not grab the entire virtual
screen, just the screen the method is called on.

On macOS, the implementation ignored the window parameter, and
always grabbed the entire virtual screen. This change fixes the
cocoa implementation. The test passes in local tests (with two
displays with different dpr). Since grabbing a screen returns an
image with managed colors, we need to convert it to sRGB color
spec first, otherwise displaying a grabbed image will produce
different results. This will need to be changed once Qt supports
a fully color managed flow.

The test does not cover the case where a window spans multiple
displays, since this is generally not supported at least on macOS.
The code that exists in QCocoaScreen to handle that case is
untested, but with the exception of the optimization it is also
unchanged.

Done-with: Morten Sørvig <morten.sorvig@qt.io>
Change-Id: I8ac1233e56d559230ff9e10111abfb6227431e8c
Fixes: QTBUG-84876
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-01 07:09:24 +02:00
Jarek Kobus
c70c4e4266 Use QList instead of QVector in corelib docs
Task-number: QTBUG-84469
Task-number: QTBUG-85221
Change-Id: Ieb0ba7d82409e3c053a5788a01e92ea495505643
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-06-29 18:00:13 +02:00
Timur Pocheptsov
45c0f45e04 Move QAlertLevel and QAlertType enums into the namespace QSsl
Not to pollute the global namespace with rather generic names
(especially in case QT_NAMESPACE is none); also drop the
(now)redundant 'Q' prefix in the names.

Change-Id: I57ea7e3996cced705f7ddbdbc1e0231191b31c43
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-29 17:08:13 +02:00
David Faure
eb54646984 Fix QUrl::toDisplayString(PreferLocalFile) returning an encoded path
It's supposed to return the same as toLocalFile(), for local files,
which means passing QUrl::FullyDecoded just like QUrl::toLocalFile()
does.

But a few code paths were testing component formatting options without masking
other FormattingOptions like RemovePassword, so this had to be fixed.

Fixes: QTBUG-84594
Change-Id: I82f15148b6d93516200f9ad6258d474e7f10924a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-29 16:45:31 +02:00
Christian Ehrlicher
ab1e0961d4 QFileDialog: remove deprecated mode QFileDialog::DirectoryOnly
Change-Id: Ia06e80c1bbed3e5bb80793aebd0a4780eb81a36b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-26 22:40:34 +02:00
Alexandru Croitor
167741717f CMake: Fix tst_qmake not to hang and re-enable it
We don't really know why, but using the ctest
--force-new-ctest-process flag stops the test from hanging.

Also re-enable the test.

Task-number: QTBUG-78449
Task-number: QTBUG-81365
Change-Id: I33094696dfe3f610dc257089074b1c2a9926f651
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-26 22:14:09 +02:00
Joerg Bornemann
9a4391271b Remove superfluous define from tst_qmake
The QMAKE_CROSS_COMPILED define isn't used since 2011.

Change-Id: I9f03791e9f7c0ef439db5e65d930c0b7cb928974
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-26 21:24:52 +02:00
Joerg Bornemann
af61b5ca5c CMake: Fix tst_qmake::resources() on Windows
This test calls qmake on a project that generates a .qrc file. On
Windows, where debug_and_release is on by default, the generated qrc
file ends up in a "debug" or "release" subdirectory. On other
platforms the file is generated directly in the build dir.

To guess the right location, the preprocessor defines RELEASE_BUILD
and DEBUG_BUILD were passed to tst_qmake.cpp by the test's .pro file.
While the mapping from debug_and_release was fine for the .pro file,
it was commented out in the automatically converted CMakeLists.txt.

Instead of trying to fix the condition, we're going the easier route
that's used in all other .pro files of tst_qmake: make sure that
debug_and_release doesn't get in the way. In other tests this is done
by setting
    DESTDIR = ./
which doesn't work for the generated qrc file. That's why we simply do
    CONFIG -= debug_and_release
to make sure that everything is generated directly in the build dir.

Change-Id: I557ac4e21d7b385004d369fae8a3f727d76d4d88
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-26 21:24:50 +02:00
Alexandru Croitor
554d40da58 CMake: Skip building tst_qprocess test when cross compiling
tst_qprocess hangs on the qemu armv7 configuration.

Task-number: QTBUG-85287
Change-Id: I5a77a81a24bb1bd315edfcf14f3bcbfd5b925e4d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-26 14:54:32 +02:00
Laszlo Agocs
db61e43c81 rhi: Enable specifying just an adapter or phys dev
Required by OpenXR. A VkPhysicalDevice or an adapter LUID + feature
level pair should be adoptable while leaving the rest (device, queue,
etc. setup) to QRhi as normal.

Change-Id: Iada0972671b037b4efb03e7831b7c9b8c5f2393d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-06-26 14:42:42 +02:00
Laszlo Agocs
b60f516aca Fix qsizetype fallout in rhi manual tests
Change-Id: I574a2930b5eeb4b3e1f3c6fca6d70dbda64ec324
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-06-26 14:42:36 +02:00
Lars Knoll
e81330d327 Add explicit encode()/decode() methods to QStringConverter
The functional style interface is nice, but does feel alien in some
contexts, so better also have explicit encode and decode methods.

Change-Id: Ic07ced15f65cdb3a7f1cf044041e341d2ef87f79
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-26 14:41:42 +02:00
Robert Loehning
873c099788 Fuzzing: Add fuzz target for QCryptographicHash::result
Pick-to: 5.15
Change-Id: Ifc12358dd8cb932fe62c13975554d753a4f1afd9
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-26 14:41:42 +02:00
Jarek Kobus
0475460102 Use QList instead of QVector in corelib
Applied to headers only. Source file to be changed separately.
Omitted statemachine for now to avoid conflicts.
Omitted qmetatype.h for now - to be handled later.

Task-number: QTBUG-84469
Change-Id: I317376037a62467c313467d92955ad0b7473aa97
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-25 22:30:59 +02:00
Simon Hausmann
b20c7df63a Remove QPropertyMemberChangeHandler again
Adding support for a static notifier within QProperty itself - through a
QProperty "sister" class - is more efficient in terms of memory
consumption and run-time performance.

The MemberChangeHandler permanently takes up at least three pointers,
while the notified properties only cost one pointer in the binding.

Change-Id: Ia1a8c2b66f1f3c2fe13ae0ad9f12cdb6bdcc35ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-25 14:11:56 +02:00
Fabian Kosmale
e18a060c03 QNotifiedProperty: Add guard callback
A guard callback is a predicate which takes the new value set by
setValue or computed as the result of a binding expression. If it
returns false, the value is discarded and the old value is kept.
Note that due to lazyness, when setting a binding, we still notify
everyone as the binding is only evaluated on demand, and the guard can
thus only run when someone actually queries the value.
Note further that a guard is allowed to modify the value that is passed
to it (e.g. to clamp it to a certain range).

Task-number: QTBUG-85032
Change-Id: I3551e4357fe5780fb75da80bf8be208ec152dc2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-25 14:11:56 +02:00
Fabian Kosmale
6a24ac7c4e QNotifiedProperty: pass old value to callback if requested
Check at compile time whether the static callback takes an argument
(which has to be of the same time as the type of the property). If so,
retrieve the old value and pass it to the callback.

Change-Id: Ib1c4c9e05b826b6be492b03f66fa72ad015963ee
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-25 14:11:56 +02:00
Jarek Kobus
e721ec269e Use QList instead of QVector in other tests
Task-number: QTBUG-84469
Change-Id: I656c9f73bd2364be39ee67747524e7c4a25c0935
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-25 10:14:24 +02:00
Jarek Kobus
88cfcd7f3f Use QList instead of QVector in sql tests
Task-number: QTBUG-84469
Change-Id: Id429ce85da027541b53d516045a78b739c2e9745
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-25 10:14:15 +02:00
Jarek Kobus
fe5b04346c Use QList instead of QVector in testlib tests
Task-number: QTBUG-84469
Change-Id: I36a69021c8d3491a4fd622f3ecb218e1be8a77bc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-25 10:13:58 +02:00