Commit Graph

10195 Commits

Author SHA1 Message Date
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
Lars Knoll
d013aa16ef Extend QContiguousCache to use qsizetype for size and indices
Allow for more than 2^31 items and large offsets.

Change-Id: I42f7bf20ce0e4af43dbb2e2083abf0e232e68282
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-14 10:36:47 +01:00
Alexandru Croitor
8facb31fde CMake: Regenerate tests projects
Change-Id: I559bf2c82d83fac9bd3c52a331d99e1e83bc3f87
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:39 +01:00
Sona Kurazyan
0ae6803d39 Try to stabilize flaky test cases of tst_qsequentialanimationgroup
Use QTRY_COMPARE in the flaky tests instead of waiting.

Change-Id: Ic18fc5fde3fa47f3b3ef21e6acd876bd6990981d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-03-12 09:40:43 +01:00
Allan Sandfeld Jensen
7cec37572a Add test for conversion of "large" images
This exercises the multi-threaded codepath and also tests precision
a bit higher.

To avoid quadratic blowup, only a short set of formats are tested in
the larger conversion tests.

Task-number: QTBUG-82818
Change-Id: I411deb97aea61a69fbdb24cbaf6559dd9436b703
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-11 18:45:46 +00:00
Qt Forward Merge Bot
3d315860cd Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-11 15:39:56 +01:00
Qt Forward Merge Bot
865afac250 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
2020-03-11 15:34:21 +01:00
Vitaly Fanaskov
c977e74afd QtConcurrent::run: accept more then five function's arguments
[ChangeLog][Potentially Source-Incompatible Changes] QtConcurrent::run
has the following signatures: run(Function &&f, Args &&...args) and
run(QThreadPool *pool, Function &&f, Args &&...args). If f is a member
pointer, the first argument of args should be an object for which that
member is defined (or a reference, or a pointer to it). See the
documentation for more details.

Fixes: QTBUG-82383
Change-Id: I18f7fcfb2adbdd9f75b29c346bd3516304e32d31
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-03-11 14:46:25 +01:00
Qt Forward Merge Bot
116d68f105 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/plugin/qlibrary.cpp
	src/corelib/plugin/qlibrary_unix.cpp
	src/corelib/plugin/qpluginloader.cpp

Change-Id: I866feaaa2a4936ee5389679724c8471a5b4b583d
2020-03-11 11:27:49 +01:00
Allan Sandfeld Jensen
bd3c82f8db Fix non-trivial soft-hyphen line breaks
The effect of the soft-hyphen needs to be updated once the final the
break point has been found.

This change cleans the logic by using two variables keeping track of
soft-hyphen at current evaluated position and at last confirmed break
point. Also adds tests for supression of soft-hyphens in the tight
WrapAnywhere case.

Fixes: QTBUG-35940
Fixes: QTBUG-44257
Change-Id: I7a89a8ef991b87691879bb7ce40cec4a3605fdd5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-10 21:58:21 +01:00
Eskil Abrahamsen Blomfeldt
761197e9d2 Fix distribution of font properties in QTextFormat
The area reserved for font properties was too small for
the properties we needed, and as a result font properties
were added outside of the area and special-cased (in the case
of FontLetterSpacingType) or ignored (in the case of
FontStretch) by conditions that check if the property is
within the designated area.

We reorganize the enum values now that we can, and allocate
some more space for the font properties area.

Fixes: QTBUG-65345
Change-Id: I8121ff7f72102d8022c6a6d2f8ed9c35dcdbb321
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-10 10:58:03 +01:00