Commit Graph

44807 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
adc1be3c33 Get rid of QRegExp usage in qfiledialog
and replace with QRegularExpression

Change-Id: Ic692fc0ea24da84dd4b6bb4c8a846c0fcc62c3cb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-30 11:33:11 +01: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
Lars Knoll
2e0070d42c Remove QRegExp dependencies and mentions
Change-Id: I399f8980f56eda5d60b554aa942bf045ab91e0d6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-30 11:33:02 +01:00
Lars Knoll
3151c510e8 Remove some leftovers of QRegExpValidator
Amends dee55af0a5

Change-Id: I59c02c6c289028abb86cdab1b2f2b3efdcea7821
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-30 11:32:57 +01:00
Martin Storsjö
907652e1ed Extend the configure test for C++17 filesystem
If recent versions of libc++ are built with filesystem support disabled,
the filesystem header still is installed., The std::filesystem::path()
constructor is completely defined inline in that header, making the test
pass on such configurations, despite C++17 filesystem not being
implemented.

Test a call to std::filesystem::copy instead, which requires the actual
library implementation to be available as well (on recent libc++).

Change-Id: Id997ab75f3299d8431b13cad871f2901f4d9f6ed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-30 13:31:05 +03:00
Morten Johan Sørvig
c3a4d36082 High-DPI: Remove usages of Qt::AA_UseHighDpiPixmaps
Remove usages of Qt::AA_UseHighDpiPixmaps from examples/.
This flag is now on by default, and can't be disabled.

Task-number: QTBUG-83092
Change-Id: Ie28622f816da2fe28d4ab272d45ea20bd051d5f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-03-30 08:43:02 +01:00
Volker Hilsheimer
b61ea367a5 Fix deprecation warnings in QCocoaCursor
Explicitly use the Qt APIs that return QPixmap and QBitmap by value, and
fix the API taking those to use const references rather than pointers
or const values.

Change-Id: I2bb7ad1edb3b65f806f0475fca383e5b9bdb61f3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-03-30 00:11:51 +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
Konstantin Ritt
e3d0184065 Follow bundled Harfbuzz update
as we raised the minimum requirement for harfbuzz to version 2.6.0:
* use new HB_SCRIPT values instead of tags
* get rid of deprecated (and no-more-used) callbacks
* replace deprecated hb_ot_tags_from_script() usage with a more
  flexible and up-to-date hb_ot_tags_from_script_and_language()

Change-Id: I0eafdd2d2028c353fa3a93f5868efceccd364a70
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-28 13:44:19 +03: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
Konstantin Ritt
b8be5b4002 HB-to-Qt bridge: get rid of stale/dubious safety checks
these aren't needed for quite a long time already

Change-Id: I3a5ce3199cee467d7dfba3c68256d214fee4d83c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-28 04:17:28 +03:00
Simon Hausmann
865d3846d8 Revert "QMetaType: support manual unregistration"
This reverts commit cf000d080c.

Reason for revert: This API is not needed (anymore) by qtdeclarative.

Change-Id: I8af604c2babe3afc11f183ddb3ce3a9038a456ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-27 16:57:05 +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
Tor Arne Vestbø
80be47ae06 macOS: Fix or ignore deprecated API in 10.14
Fixes: QTBUG-82128
Change-Id: I11abfcf7f245a7a25733625b50e207b07abba289
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-27 09:00:11 +00:00
Tor Arne Vestbø
78f774da70 qmake: Silence GL deprecations on macOS
Change-Id: I5a33cbe30a9368ee35afb230c7a6c17d4d99f201
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-27 09:00:11 +00: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
Leander Beernaert
9968a211f9 CMake: Fix pkgconfig calls when cross-compiling
When cross-compiling with CMake, before this patch pkgconfig calls would
find libraries which are part of the host system and not the target
system.

The current approach used is based of the discussion present in
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4478, and should
be considered a temporary solution until the issue is properly addressed
in upstream CMake.

Change-Id: I535d4d48c2a5d34689082b80501b3b6ae30d7845
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-26 12:46:16 +01:00
Lars Knoll
f2208c59e7 Add a public qsimd.h header
This header only covers a part of what qsimd_p.h does, namely
the compile time detection of simd extensions.

Change-Id: I05f1d987f194a5bec335f2405cc2846fbaa88b66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-26 09:15:37 +01:00
Lars Knoll
f2f32b88b8 Move qsimd* from corelib/tools to corelib/global
It's not used in tools at all and fits a lot better in global.

Also fix the qsimd_x86* files to have a proper copyright
header.

Change-Id: Id3d8e7cfcd7769a1ca9f3d8cf6d357a31a99ba40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-26 09:15:32 +01:00
BogDan Vatra
c0538d5ff3 Revert "Android: Fix compile on arm64"
This reverts commit 81d6906ad9.

Fixed upstream. \sa https://github.com/harfbuzz/harfbuzz/issues/1308

Change-Id: I7759e2bb199ffd11d42239be59704c4e1f7ddb9f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-26 01:57:11 +03:00
Lars Knoll
6fea5b4dd8 Make QCborValue::toCbor() const
Those methods don't modify the CBOR value, they should be const.

Change-Id: I213984ed82e43429413344999a22ad1c4c3beac8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-03-25 23:33:57 +01:00
Fabian Kosmale
fe275c75ae QMetaType: Do copy constuctible check at compile time
Change-Id: I2f6a9bbaa0153fa33fc6a0b68bcedfbe3b9b1a7c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 17:55:29 +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
Leander Beernaert
b6446a5ffa CMake: Fix exception in pro2cmake about missing v1 api
This patch silences the exception about missing v1 api entry for the
qt_add_3rdparty_library() function.

Change-Id: I74a473ed1c063b13f0a9ca64dcb568b8f8b27235
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 17:00:27 +01:00
Mårten Nordheim
eb13e75f56 QHttpNetworkReplyPrivate: Remove unused variable
Oh, and re-remove the spdy protocol handler.

Change-Id: I9ca3517b14ac202eac19ae75d481cfd78d431abb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-25 16:44:17 +01:00
Leander Beernaert
8dcf7d2674 CMake: Add support for bundled SQLite library
Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 13:52:05 +01:00
Joni Poikelin
d0b30de542 Avoid recreating QRegularExpression for every text block
With very complex regular expressions this makes a significant
difference in performance.

Change-Id: I5267bf71cae98dffb58ec7a1fc982dae639ff312
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-25 12:33:26 +02:00
Lars Knoll
7b5e4b6944 Don't call QSet::erase() on an end iterator
hash.erase(hash.constFind()) is bound to crash if the hash doesn't
contain the item we're looking for.

Change-Id: Icbefca87b0258970373ec55d5dc113e6ab39c5f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-25 11:33:23 +01:00
Joerg Bornemann
c269d8f086 CMake: Fix the re-computed value of INSTALL_*DIR variables
For INSTALL_*DIR variables that have the the same value as
CMAKE_INSTALL_PREFIX, a second cmake run cleared the value. This is
because file(RELATIVE_PATH) returns the empty string if we pass the same
absolute paths.

Fix this by checking the return value of file(RELATIVE_PATH) for the
empty string and setting it to ".".

It's a limitation of qmake that empty strings are not handled as ".".

Change-Id: I8fc4d1eabcc9d5634be2f3741b0002a347dd17e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 11:16:48 +01:00
Leander Beernaert
f716a87352 CMake: Fix configuration of FEATURE_JPEG
Without this patch JPEG support is always disabled, even though we can
build it from 3rdparty sources.

Change-Id: I9e619f0ca8ec3ca3e7c58981bb6af9b33426a029
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 10:51:55 +01:00
Alexandru Croitor
0446bf5ba3 CMake: Fix auto-detection of precompiled header support
PCH files were only used while building qtbase. Make sure the value
is exported to the BuildInternalsConfig file, so the value is re-used
when building other repositories.

Also disable PCH when building simulator_and_device iOS builds, because
CMake doesn't currently generate separate PCH files per architecture.

Change-Id: I79955ebc557b800bc3c704deac519fe80012c229
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-25 10:46:46 +01:00
Lars Knoll
874c6b00dd Remove QSignalMapper::mappedWidget()
mappedObject() can do exactly the same thing, there's no need for a
mappedWidget() signal as well

This removes a reverse dependency between Qt Widgets and Qt Core where
QWidget pointers are being used inside Qt Core.

[ChangeLog][QtCore] Removed QSignalMapper::mappedWidget. Connect to
mappedObject instead, and use qobject_cast<QWidget *> to handle Widgets.

Change-Id: I60618a34dd94575e993bd6d8a2cead95cfd71d55
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-25 09:46:15 +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
Lars Knoll
a7fe1af609 Remove QRegExp usage from the XBM handler
Change-Id: Ie7141c2a04c233bc1298195aebfc0437e43df0d1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-25 09:34:32 +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
Konstantin Ritt
5e213a41ce HB-to-Qt: stop propagating helpers and types not used outside QtGui
Change-Id: I039efaeabc83bc0367bb3ab949057d2cbc6c2742
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-25 02:22:14 +03: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
Konstantin Ritt
7c3700c070 Darwin: get rid of Harfbuzz/CoreText specific code
once CoreText shaper in Harfbuzz has been disabled, we do not need
the hack-ish enablers to support it

Follows-up 21c242f9fd

Change-Id: I40d598b2c9b57ca7953716a56e4e119b2fc06a9b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-24 02:00:22 +03:00
Konstantin Ritt
1ab2e4baef Harfbuzz: get rid of Qt-specific patch in CoreText shaper code
this code isn't used as of 21c242f9fd
and thus we do not need to keep the patch around

Change-Id: Ic3b836c6a68f40b8e450542a39db968ef3b09101
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-24 01:58:08 +03:00
Konstantin Ritt
12d3d32f31 QTextEngine: stop guessing the same language in a loop
Change-Id: I155b9380a4ff412d59c7939c377d20f4783e4730
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-24 01:57:09 +03:00
Volker Hilsheimer
c14f3deca9 Fix deprecation warnings from NSColor(Space) with macOS 10.14 SDK
The support for handling color spaces by names is deprecated in
recent AppKit versions, and should be replaced by using
NSColor.type, and operations on the type-specific properties of
the color.

Merge the two implementations from qcoregraphics.mm and
qcocoacolordialoghelper.mm, which also fixes the inconsistent
interpretation of color components as device dependent (in
qcoregraphics) or generic (in qcocoacolordialoghelper). We now
always populate the QColor with device independent components.

Change-Id: Id79c609736ff1962bebe4bd7158781a6d1b4475e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-23 17:36:52 +01:00
Sona Kurazyan
9ff75d4ea1 Make QFuture::d private
Change-Id: I5820fa1d6d0f003a7cb95db115ef90b32f380a79
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-23 16:47:55 +01:00
Sona Kurazyan
1005c86c61 Clean-up the duplicate code in QFuture and QFutureWatcher
QFuture<void> and QFutureWatcher<void> are specialized to not contain
any of result fetching methods, but otherwise they share almost the same
implementation with QFuture<T> and QFutureWatcher<T> respectively.

This change unifies their implementations to get rid of unnecessary code
duplication.

Change-Id: I9494ddc58c6db192c66edb988105927da6d61a3b
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-03-23 16:47:47 +01:00
Giulio Camuffo
20eabb72de Fix memory leak
When creating a new QColorSpacePrivate it must be reffed otherwise in
the destructor the deref() will bring the count to -1 which is true
and will not delete the d_ptr.

Change-Id: Id569bae22134b56bf6ad37158d7079b495599fd7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-03-23 16:47:22 +01:00