Commit Graph

10205 Commits

Author SHA1 Message Date
Fabian Kosmale
a97703d33a Enable qmetatype test with CMake
Change-Id: I34dcc0ae9187092ae1e277c2b3676d551a76991a
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-01 10:29:33 +02:00
Lars Knoll
ef0f1429ae Remove QRegExp based API and QRegExp usage from QTextDocument
Change-Id: Ib5cc2d747f215a483585b703f9b4f6415e0d59f7
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-04-01 10:29:26 +02:00
Lars Knoll
70beac08af Remove all QRegExp dependencies from widgets
QRegExp is deprecated in Qt6 and will get moved to the Qt 5 compat
library. As such we need to remove all API and usages of QRegExp
in Qt.

Change-Id: I33fb56701d3d7c577f98a304c1d4e6f626fcb397
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-04-01 10:29:26 +02:00
Lars Knoll
66f06a930d Make QLocale(QString) explicit
We should not implicitly convert a QString to a QLocale object. It can
easily create unwanted side effects.

Change-Id: I7bd9b4a4e4512c0e60176ee4d241d172f00fdc32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-04-01 09:29:26 +01:00
Timur Pocheptsov
44ceb56455 QFuture - add ability to move results from QFuture
QFuture's original design pre-dates C++11 and its
introduction of move semantics. QFuture is documented
as requiring copy-constructible classes and uses copy
operations for results (which in Qt's universe in general
is relatively cheap, due to the use of COW/data sharing).
QFuture::result(), QFuture::results(), QFuture::resultAt()
return copies. Now that the year is 2020, it makes some
sense to add support for move semantics and, in particular,
move-only types, like std::unique_ptr (that cannot be
obtained from QFuture using result etc.). Taking a result
or results from a QFuture renders it invalid.  This patch
adds QFuture<T>::takeResults(), takeResult() and isValid().
'Taking' functions are 'enabled_if' for non-void types only
to improve the compiler's diagnostic (which would otherwise
spit some semi-articulate diagnostic).
As a bonus a bug was found in the pre-existing code (after
initially copy and pasted into the new function) - the one
where we incorrectly report ready results in (rather obscure)
filter mode.

Fixes: QTBUG-81941
Fixes: QTBUG-83182
Change-Id: I8ccdfc50aa310a3a79eef2cdc55f5ea210f889c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-31 15:28:23 +02:00
Lars Knoll
986cfe312e Port autotest to QRegularExpression
Change-Id: Id632ed191add8beab6a857c4c949cc78e4c5eccf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-31 15:28:23 +02:00
Lars Knoll
21a9b67cdb Port autotest away from QRegExp
Change-Id: I630fb93eca3f087f20d44a76058f7d6fe988ba5f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-31 15:28:23 +02:00
Lars Knoll
7f267360f2 Port test to QRegularExpression
Change-Id: I4026fa2fa5da34974cdc37353e7ea5a8e8806033
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-31 15:28:23 +02:00
Lars Knoll
3af596402a Remove QRegExp usage from QSslCertificate and QSslSocket
Change-Id: I81abe1ab2173af922fa4b5fad58d25fa602c523b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-31 15:28:23 +02:00
Lars Knoll
d4a416df2c Remove Qt5 BIC test data
Qt6 is binary incompatible with Qt5, no need to keep the old data.

Change-Id: I7fc4592a79ed0a8b79569926a31ef6deb5d3f983
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-31 15:28:23 +02:00
Mitch Curtis
3f73995a03 Move undo framework out of Qt Widgets
- Moves QUndo* classes (except QUndoView) from src/widgets/utils to src/gui/utils
- Moves related auto tests from widgets to gui
- Replaces QUndoAction with lambdas that do text prefixing

[ChangeLog][Undo Framework] QUndo* classes (except QUndoView) were moved from Qt
Widgets to Qt GUI.

Done-with: volker.hilsheimer@qt.io
Fixes: QTBUG-40040
Change-Id: I3bd8d4d32c64f8dee548f62159a1df2126da89d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-30 12:36:29 +02:00
Lars Knoll
3532c0256d Make MatchRegExp an alias to MatchRegularExpression
All matching happens using QRegularExpression now.

Change-Id: I10bfcefbf4d9c79d235242e3e05116cdf7af02d1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-30 11:33:07 +01:00
Vitaly Fanaskov
5a0d4f3313 QtConcurrent: add fluent interface to configure a task before run
Task-number: QTBUG-82950
Change-Id: I449da938b6b501a7646b3425edde5c880d6ca87e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
2020-03-29 20:44:32 +01:00
Volker Hilsheimer
d975ad4ed7 Merge QGuiShortcut and QShortcut again in QtGui
QShortcut has only one widget specific feature, which is whatsThis; that
is just a QString, so the setters and getters can just as well be in
QtGui.

The widgets specific implementation of shortcut matching and of showing
the whatsThis balloon stays in QtWidgets, in the private implementation.
Using virtual functions in the private we can override the empty default
in QtGui, and by adding a virtual factory function in QGuiApplication,
the correct private is instantiated depending on the kind of application
running.

Change-Id: I09ae4a5482f9fb70940c5e2bfe76d3d7fd710afc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-29 19:31:14 +01:00
Volker Hilsheimer
bcaff2b06f Remove QGuiAction again and split QAction implementation up instead
Duplicating the number of classes is a high price to pay to be able to
have some QAction functionality behave differently, or be only available
in widgets applications.

Instead, declare the entire API in QtGui in QAction* classes, and
delegate the implementation of QtWidgets specific functionality to
the private. The creation of the private is then delegated to the
Q(Gui)ApplicationPrivate instance through a virtual factory function.

Change some public APIs that are primarily useful for specialized tools
such as Designer to operate on QObject* rather than QWidget*. APIs that
depend on QtWidgets types have been turned into inline template
functions, so that they are instantiated only at the caller side, where
we can expect the respective types to be fully defined. This way, we
only need to forward declare a few classes in the header, and don't
need to generate any additional code for e.g. language bindings.

Change-Id: Id0b27f9187652ec531a2e8b1b9837e82dc81625c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-29 11:18:57 +01:00
Christian Ehrlicher
8de62d3432 QAbstractItemView::dataChanged(): optimize call to QWidget::update()
When topLeft and bottomRight are different in QAIV::dataChanged(), the
current implementation simply calls QWidget::update() without checking
if the affected cells are visible. This results in a big performance hit
when cells are updated frequently.
Now try to compute the exact update rect by iterating through the
modified indexes.

Fixes: QTBUG-58580
Change-Id: I97de567d494e40ed8cdb1ea1f5b3cf3a2f60455e
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-28 09:03:18 +01:00
Simon Hausmann
f3ce9e9332 Make QPropertyBindingPrivate accessible to QtQml
QtQml needs the private just for one detail which nobody else should
need it for: Tracking additional dependencies and marking the binding as
dirty. Exporting the private requires hiding some variables and
providing accessors, to compile with MSVC - including the removal of
QVarLengthArray usage. Upside: The binding structure shrinks by 8 bytes
and the encapsulation makes it a little easier to change things without
breaking declarative, ... in the unlikely event ;-)

Also remove setDirty() from the public API as it's not needed by QtQml
and using it is dangerous, because it means that there's a risk of
somebody keeping a reference (count) to the untyped binding from within
the binding closure, which introduces a memory leak.

Change-Id: I43bd56f4bdf218efb54fa23e2d627ad3acfafeb5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-27 13:29:47 +01:00
Simon Hausmann
96de3e26db Add QProperty tests to the cmake build
Change-Id: I043ea1db316618871b387213ee379075d756d0b5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-27 13:29:47 +01:00
Christian Ehrlicher
ddcf0df7d7 Speed up QSortFilterProxyModel filtering
Speed up the QSortFilterProxyModel filtering by only updating the
source_to_proxy entries which are really changed - When proxy intervals
are added or removed, it is not needed to update the proxy_to_source
indexes which were not touched.

Change-Id: I35459ff1b04f4610ec74f4b01d58a71832a9ae22
Reviewed-by: David Faure <david.faure@kdab.com>
2020-03-27 06:56:23 +01:00
Fabian Kosmale
98ca319819 QMetaType::fromType: support classes with inaccessible dtors
Change-Id: I60a1b2496d48651a8166173b420da37f59d7a395
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 17:55:28 +01:00
Lars Knoll
53f8f23369 Get rid of QRegExp usage in rcc
As a drive-by, enable testing of rcc in the cmake build.

Change-Id: I4150ff3ffe7404bab0cbc72f80b23b47a60cf33d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-25 09:34:37 +01:00
Kai Koehne
de67bca44e Remove qt6_use_modules
qt5_use_modules has been deprecated in 2013 (commit d9ea4bb144)
and removed for the first time in 2018, but then brought back - see
discussion in https://lists.qt-project.org/pipermail/development/2018-June/032837.html .

Anyhow, I think we can finally put it to a rest in Qt 6.

Change-Id: I770f7e93406ad68535d1d90e4a3bacfb920e2d5a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 08:39:43 +01:00
Tor Arne Vestbø
9fc9fefdc9 Restructure testlib selftest project
The use of a single subdirectory only for the test binary, but not the
actual source file, just made things harder to discover when looking
for the test code. Now all subdirectories are actual sub-tests.

Change-Id: Ia3e308ba8d231cc8ead1491b10a34801f76669b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-24 21:04:43 +01:00
Mårten Nordheim
737fe89691 Q{File,FileInfo,Dir}: add std::filesystem::path overloads
Add some overloads where (I thought) it makes sense for QDir and QFile
to accept std::filesystem::path objects. Currently my thinking is to
not add overloads for static functions where std::filesystem can already
do the same job, e.g. create directory or file.

Template and enable_if is needed due to both QString and
std::filesystem::path being able to be constructed from string literals.

The common shared code is currently in QFile because QDir had an
implicit include of QFile, made explicit in this patch, and QFileInfo
has an include to QFile as well.

The QT_HAS_STD_FILESYSTEM macro is visible in user-code which I
currently take advantage of in the tests, and users could too.

Change-Id: I8d05d3c34c6c17e20972a6a2053862b8891d6c3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-24 16:20:03 +01:00
Eskil Abrahamsen Blomfeldt
c4ef0b92d5 Expect failure in QLabel test for certain condition
While investigating QTBUG-80554, it was discovered that a small
mismatch in how heights are calculated in QTextDocument and
QPainter will cause the tst_QLabel::sizeHint() autotest to
fail if ceil(ascent+descent+leading) is higher than
ceil(ascent+descent). This is currently blocking the fix for
QTBUG-80554, because this exposes the bug by detecting the
correct leading for a font where we previously ignored it.

Task-number: QTBUG-82954
Change-Id: I99323c8e1a0fa281aa8d754ba71432468fcb2d4c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-24 08:19:11 +01:00
Leander Beernaert
3e5ba7ff7d tst_sqlquery: Skip datetime test if no database drivers are available
Change-Id: I4a4619f2edc3c82fc37605d54e9bedc36abd7388
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 13:09:00 +01:00
Simon Hausmann
cef009b1e4 Change QTaggedPointer API to be more similar to other smart pointers in Qt
* Rename pointer() to data()

Change-Id: I8ef3e552d45c9990fee4b7efa98e2d878ed2cf98
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-19 19:01:31 +01:00
Leander Beernaert
2d955428ae CMake: Regenerate selftest with latest fixes
Change-Id: I7453c2439a62331cdc2d7ffaeafb05cd831191c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-19 13:19:21 +01:00
Simon Hausmann
1fcce51053 Enable generic property bindings to QProperty<T>
A generic binding allows implementing the binding function in a way that
enables the QML engine to run binding scripts and convert the V4::Value
into a QVariant and then assign the value to the property with the help
of QMetaType::construct.

Change-Id: Id4807be92eee7e3501908e6c5e4c861cfcb7772a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-19 13:08:56 +01:00
Leander Beernaert
dc4872be38 CMake: Regenerate and fix qtcpsocket test
Change-Id: I1293ee604bd0a61abd7f6a5fa305defc4d6c9ae9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-18 16:36:26 +01:00
Leander Beernaert
dfd37e27ca CMake: Enable testlib selftests
This patch adds the equivalent of testlib's selfcover.pri and is enabled
for both testlib and the respective selftests test.

This patch also fixes the selftests so that they can run without
FEATURE_testlib_selfcover enabled.

Change-Id: I15913de2d572ac79804ce3e652cee66de74318f8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-18 16:28:30 +01:00
Leander Beernaert
0eb93886ae CMake: Disable two graphicsview tests
Disable tst_qgraphicsproxywidget and tst_qgraphicswiddget as they are
never run in coin with the current .pro file.

Change-Id: I562fa70e03f7c5e547c52507e3e41f4762c0382a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-18 15:44:06 +01:00
Qt Forward Merge Bot
08b9539b7a Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-18 15:43:52 +01:00
Simon Hausmann
d4f0445331 Add support for exposing public QProperty members in the meta-object system
At the moment this makes the type as well as the setter/getter available
through the meta-call as well as the ability to register observers and
bindings. Only QProperty members that are annotated with
Q_PROPERTY(type name) are made public through the meta-object.

Change-Id: I16b98fd318122c722b85ce61e39975284e0c2404
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-18 15:42:58 +01:00
Giulio Camuffo
b5f6a85d27 Add a way to filter only rows or columns in QSortFilterProxyModel
If we want to filter away a column without changing the filtering
for the rows calling invalidateFilter() is wasteful because it will
call filterAcceptsRow() for all rows even though that is not needed.
This commit add two functions, invalidateRowsFilter() and
invalidateColumnsFilter() that work the same way as invalidateFilter()
except that they will invoke respectively only filterAcceptsRow() and
filterAcceptsColumn().

Change-Id: Ib4351cf08c229bd97bbbfee6da92397dca579a84
Reviewed-by: David Faure <david.faure@kdab.com>
2020-03-18 15:42:58 +01:00
Qt Forward Merge Bot
18b69ae8a4 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia79c2457f20f3428ef1b4358c1094e8dc1bbc33e
2020-03-18 11:45:08 +01:00
Simon Hausmann
733ae8a04b Make it possible to use QTaggedPointer within classes
A common pattern in declarative is to use the unused bits in linked list
next pointers for additional information storage. The "next" pointer is
typically then a tagged pointer of the containing class, which is not
fully defined yet. Therefore alignof() can't be used at tagged pointer
instantiation time. This patch delays the calls to alignment, etc. until
the corresponding functions are used, as in principle the tagged pointer
is just a quintptr and no additional information should be needed until
operating on it.

Change-Id: I87a3578ee921d471e1b60ed5903b549ef0610b97
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-17 17:55:27 +01:00
Cristian Adam
7150b07041 QLocale: Fix test on MinGW 8.1.0 32 bit
The call of _control87 would crash because of the previous test.

Change-Id: I254efe9c2e9892a473a02663e5ff7016791d5d6d
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2020-03-17 15:35:34 +01:00
Sona Kurazyan
b345087dde Log the possible socket error code for the flaky test
tst_QSocks5SocketEngine::simpleConnectToIMAP() is flaky. It may be
useful to log the socket error, to provide more info in case the
test fails again.

Change-Id: Ia5518dce13fd9da1fa5bfb3d5cf3a52a908b8698
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-17 11:22:59 +01:00
Tor Arne Vestbø
165de10027 Introduce helper class QTaggedPointer
Useful for attaching small bits of information in the alignment bits of
a naked pointer. For use in the new property system as well as in
qtdeclarative (where currently a similar class exists as private API).

Change-Id: Idf9b93e714e15129f302e16425dbeda94bcd207b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-17 10:01:04 +01:00
Lars Knoll
dee55af0a5 Remove QRegExpValidator
As QRegExp will be moved to a compat library in Qt 6.

Change-Id: I181aec45bd798f49d2c50a0e7fb64782e004b854
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-17 08:35:50 +01:00
Simon Hausmann
c2f167b412 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-16 20:43:50 +01:00
Simon Hausmann
ff922e7b87 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/kernel/qmetatype.cpp

Change-Id: I88eb0d3e9c9a38abf7241a51e370c655ae74e38a
2020-03-16 18:41:27 +01:00
Simon Hausmann
9f9049b486 Initial import of the Qt C++ property binding system
This implements the core value based property binding system with
automatic dependency tracking. More features are to be added later, and
the documentation will need further improvements as well.

Change-Id: I77ec9163ba4dace6c4451f5933962ebe1b3b4b14
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-16 18:19:45 +01:00
Tor Arne Vestbø
77885f8402 cmake: Remove APPLE prefix from platform names
None of the other platforms have it.

Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:56 +01:00
Tor Arne Vestbø
db745fdd2d cmake: Fix naming when referring to Apple macOS
Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:52 +01:00
Mårten Nordheim
3e9014ed61 QNetworkReply: stabilize sslSessionSharing test
Sometimes this test would fail due to the session not actually being
reused. The cause of this was that the requests were sometimes being
completed 1-by-1, enabling the individual requests to re-use the
already-connected socket completely because it stayed connected.

Setting the Connection-header to close lets us be sure that
the socket cannot be re-used when the request is finished.

Fixes: QTBUG-82846
Change-Id: I5da8baa50a3a45fb60f1e1613e500e3e9c034fb0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-16 12:12:29 +01:00
Christian Ehrlicher
f5213ab799 QMySQL: return QVariant::ByteArray for POINT column
qDecodeMYSQLType() did not handle FIELD_TYPE_GEOMETRY and therefore the
type for a POINT column was incorrectly treated as QVariant::String.
Even the type can not (yet) be properly decoded to a QPoint, treating it
as QVariant::ByteArray is the better option here.

Fixes: QTBUG-72140
Change-Id: I12e75b326ae3acb75cb36f2e650464528bd43c0e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-03-15 23:00:41 +01:00
Edward Welbourne
54f8be6cc0 Update UCD to Revision 26
Include WordBreakTest.html, since a test uses sample strings from it,
albeit without actually reading the file.

Had to comment out more of the new tests, as at Revision 24, pending
an update to harfbuzz and the text boundary detection code.

Task-number: QTBUG-79631
Task-number: QTBUG-79418
Task-number: QTBUG-82747
Change-Id: I0082294b09d67ffdc6a9b5c15acf77ad3b86f65f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-14 11:26:59 +01:00
Lars Knoll
e87768a880 Use qsizetype for size related methods in QVarlengthArray
Change-Id: Ib94b9a4e6e17da21f592e71a36fd1b97d42dfe62
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-14 10:36:56 +01:00