Commit Graph

45874 Commits

Author SHA1 Message Date
Lars Knoll
88c72d972a Don't access QArrayData::sharedNull() from QByteArray anymore
Change-Id: I1292f8d2d62fa96ae4c6aa91c7c95c1f3a18570f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-17 20:37:42 +02:00
Marc Mutz
fae7a47bb3 QChar: make fullConvertCase()'s result type more usable
Move it into the function, give it an explicit size and make it
iterable and indicate to QStringView that it's a compatible container.

Change-Id: I483d9225ac73ad93f2037489f2d32473c377e8b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-17 18:06:17 +02:00
Joerg Bornemann
e875f45805 CMake: Don't create *Depends header for header-only modules
Set the target property INTERFACE_MODULE_IS_HEADER_ONLY for
header-only modules, and only create *Depends header files if this
property is falsy.

Change-Id: Ic6b100787d18b3ff1f7b9d0f2b5c744018b1f295
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-16 22:02:10 +02:00
Marc Mutz
395fa85403 Add central macro to disable float comparison warnings
QParsedNumber will need it, as do some others, like QAngle.

Change-Id: Iee09f498d2cdbb28d43b94301328ec7858661ad2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-16 20:24:32 +02:00
Marc Mutz
3df3bdcdb3 QTaggedPointer: verify constexpr'ness of some ctors
Change-Id: I44196ba3a823ce04b7c82aacfb9da301cc0f1886
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-16 08:55:28 +02:00
Sona Kurazyan
1a5cc8d13d Add support of cancellation handler callbacks to QFuture
Added QFuture::onCanceled() method, for attaching handlers to be called
when the QFuture gets canceled.

Change-Id: I1f01647d6173ba0c1db6641e14140108b33ac7c4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-15 22:35:30 +02:00
Sona Kurazyan
612f6999c8 Add support of connecting signals to QFuture
Introduced QtFuture::connect(sender, signal) function returning a
QFuture object, which is resolved when the signal is emitted.

Task-number: QTBUG-81589
Change-Id: Idbe301eb247b468b9b34f3470c3359d6a7af2f3a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-15 22:35:06 +02:00
Takao Fujiwara
54aa63be9b IBus: Use WAYLAND_DISPLAY on Wayland sessions to make up socket names
A recent change in IBus made it prefer the WAYLAND_DISPLAY envvar in
order to compose its socket path for Wayland sessions. This is because
DISPLAY is unreliable in those environment: It might not be there, there
might be several displays pointing to the same Xwayland server (as it's
the case in GNOME 3.36), or there might even be multiple Xwayland servers
(eg. to enforce inter-app isolation with X11 apps).

Fixes: QTBUG-82910
Pick-To: 5.15
Change-Id: I4883b5d06863ba284883dd95281bed2ce7203e29
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-15 20:11:11 +00:00
Marc Mutz
5ffa5808f8 QTaggedPointer: some API cleanups
- don't refer to the class with template arguments in the body of the class
  (incl. one where we got the template args wrong)
- make namespace-level swap a non-member friend
- make default ctor constexpr and non-explicit
  (default ctors should never be explicit)
- make ctor from std::nullptr_t constexpr
- remove op= from std::nullptr (will be handled by op=(T*) anyway)
- pass QTaggedPointer by value (it's a Trivial Type, so can be passed in registers)
- fix missing QTypeInfo for non-default Tag types
- remove unused include limits.h
- make qHash-able (why is the tag ignored?)

Change-Id: Idee1d685ac365c988698a8637fd5df3accfc1396
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-15 20:00:24 +02:00
Joerg Bornemann
e5683c5e5f CMake: Add MODULE_INCLUDE_NAME one-value-keyword to qt_add_module
This value is the equivalent of qt_module.prf's MODULE_INCNAME and can
be used to specify a name for the module's include subdirectory. The
default is Qt<ModuleName>.

The include name is stored in the module's target property
MODULE_INCLUDE_NAME.

Change-Id: Ie6c8f6882ee2c3db78884ae5781593c803be3c05
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-15 18:56:27 +02:00
Volker Hilsheimer
2b10a192a1 Remove deprecated method from QFont, QFontMetrics, and QFontInfo
Change-Id: Ifc8fb5c5d53359b33b8abab3bbee3de61bfef539
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-05-15 18:56:20 +02:00
Fabian Kosmale
794150e5bd QMetaType: Support char16_t and char32_t
Change-Id: Ieec6d4bc64967d875ea12b31638aab05bc682ea3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-15 18:46:39 +02:00
Volker Hilsheimer
45cf8da63c Reduce QDesktopWidget API to bare minimum
The class is documented as obsolete, and the majority of APIs is marked
as deprecated. In this first phase, remove all explicitly deprecated
APIs and trivial implementations.

The test case is complete removed; what's left when code that uses any
of those deprecated methods is removed is not testing anything
meaningful.

For some methods, there is no practical replacement using QScreen yet,
and QDesktopWidget is still used in QWidget internals. Those require
refactoring to only use QScreen before the rest can be removed.

Change-Id: I8f7c968ec566820077221d37b817843758d51d49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-15 18:46:39 +02:00
Andy Shaw
9803ba9b6f Deprecate QGuiApplication::paletteChanged() signal
Rather than have a paletteChanged() signal which can be connected to for
tracking when the application palette has changed, then it is better to
use the event that is sent to all windows and the application itself.
That way it is easy for a window/widget or item that cares about the
change to the application font to catch it in the event() function.

[ChangeLog][QtGui][QGuiApplication] Deprecated paletteChanged() signal
in favor of QEvent::ApplicationPaletteChanged.

Change-Id: I95da211e30590e357007cc14d8ee266baceba7b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-15 18:46:39 +02:00
Mårten Nordheim
bd3b978701 QNetworkReply: Remove some bearer management leftovers
migrating backend was done if the QNetworkSession changed. With
QNetworkSession gone this was no longer called from anywhere.

Change-Id: I8c995001f9d4c7ae83446b4d29fa62c954c79889
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-15 15:44:22 +02:00
Andy Shaw
035c16e9ff Use correct order of arguments when calling QCalendar::daysInMonth()
Change-Id: Ic4e30d8ffea80c1dc1dc8da1f97f4bb0d21b63e3
Pick-to: 5.15
Fixes: QTBUG-83870
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-15 15:44:22 +02:00
Fabian Kosmale
40c6fe88a4 cmake: QTestCase: enable threading support
Change-Id: I55a9b57172659ae420890556e55810bf7f4a725c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-15 11:47:11 +02:00
Alexandru Croitor
0cdcbb40a1 CMake: Enable default usage of utf8 sources for Qt consumers
And enable the same default when building Qt itself (it's implicit).

Allow opting out on a target-by-target basis, by using the public
qt_disable_utf8_sources() API call.

Change-Id: Ifc19a744d57b96b1c74a6926a0c6628c2a820464
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-15 11:47:09 +02:00
Joerg Bornemann
d5cb44cd3a pro2cmake: Fix Scope.get_string for list values
QMake variables are always string lists, but some variables are used to
represent single string values. People tend to fill those variables with
multiple values and expect them to be joined by spaces.

Exhibit A: qtdeclarative/tools/qml/qml.pro
    QMAKE_TARGET_DESCRIPTION = QML Runtime

QMake supports this for many values. Do the same for Scope.get_string().

Change-Id: I6af22bc1bfed07a4d8eac94d7315051a5bcb7a4d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-15 08:54:21 +02:00
Marc Mutz
c5f7cb7e14 QString: remove more functions overloaded on char
These functions mess in bad ways with the overload set (they, fatally,
attract char16_t, e.g.).

The no-ascii warning now comes from the QChar(char) constructor, so
it's not lost.

[ChangeLog][QtCore][QString] Also removed op=(char), op+(char,
QString), op+(QString, char).

Change-Id: I1471c9ddb4c6869aff6e527516e2c78b80b7d7d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-15 05:01:00 +02:00
Marc Mutz
b655734965 QString: fix an aliasing issue in remove(QString)
Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with
the advent of substring sharing, this will become even more
pronounced. Use the same fix as was already used in QString::insert().

Pick-to: 5.15
Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-15 03:00:45 +00:00
Andy Shaw
f468f76455 Add an option to set the alignment of the text in QComboBox
Change-Id: Ic9dca8864643302b2b3ff7dbd86260efdb0ab1d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-05-15 05:00:10 +02:00
Volker Hilsheimer
6028e16b86 Remove deprecated QAccessible::updateAccessibility overload
Change-Id: Ib953e584685804b0f34ec6b305e2a9a6b8062c07
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-05-15 04:59:30 +02:00
Volker Hilsheimer
6f34c0c650 Initialize TextureOp and BufferOp structs
Fixes Coverity warnings, and avoids hard-to-debug errors, at minimal
overhead.

Change-Id: I3ff530a9263693d1123932458b3e186e79a14b7e
Coverity-Id: 263692
Coverity-Id: 263693
Coverity-Id: 263699
Coverity-Id: 263700
Coverity-Id: 263702
Coverity-Id: 263705
Pick-to: 5.15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-15 04:59:20 +02:00
Volker Hilsheimer
7bee4e9cb3 QLabel: lay out text using a text control when label can get focus
QLabel ensures a text control in its focusInEvent, and from that point
on lays the text out using the control. A label with text control will
place the text so that there is space for a cursor and text selection,
resulting in text shifting when a label receives focus without having
had a text control before.

Instead of creating the control only on focusIn, ensure that it's
created for any QLabel that can receive focus.

Change-Id: I26c9df3affa08f2360ad4b94de43bd85e2e2e164
Fixes: QTBUG-84080
Pick-to: 5.15
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-05-15 04:59:07 +02:00
Dmitry Kazakov
d26ee69140 Fix artifacts when rendering multisubpath dashed QPainterPath with openGL
It might happen that the resulting subpath generated by the QDashStroker
will have no lines at all. It happens when further LineToElement items
compare as equal to the starting MoveToElement when compared in 'float'
space. In such case QTriangulatingStroker::process() skips LineTo elements
and the vertexBuffer ends up with unconnected vertices, which generate
unwanted triangles.

See related bugs:
https://bugs.kde.org/show_bug.cgi?id=419240
https://bugs.kde.org/show_bug.cgi?id=413220

Change-Id: Ie70955287da47e9f7aa9cdeaea506e1c817b2317
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-15 02:06:25 +03:00
Marc Mutz
3b7f278d38 tst_qstringref: remove some wtf?
As best as I can guess, this used the QString::operator=(char), which
I locally removed. Before that lands in Qt, remove this ... wtf?

Pick-to: 5.15
Change-Id: Ie083fe69500d6b5b633416f89f5dd1d7068c20b2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-14 20:30:35 +00:00
Marc Mutz
49e69827d2 QString: fix quadratic behavior in QString::remove(QString)
Calling linear-complexity remove(int, int) in a loop is O(N²).

Fix by implementing a remove_if()-like algorithm which ensures each
character is written at most once, which is linear.

[ChangeLog][QtCore][QString] Fixed quadratic worst-case complexity of
remove(QString). The function now has linear complexity in all cases.

Pick-to: 5.15
Change-Id: I12f70fbc83fb5da4a9aae4bd02f525d7657cc940
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-14 20:30:22 +00:00
Joerg Bornemann
786ae0141a CMake: Don't hard-code the sysroot in Qt5XXXConfigExtras.cmake
Instead of writing the hard-coded sysroot into the .cmake file, write
the variable ${CMAKE_SYSROOT}. This makes it possible to relocate the
build to a machine where the sysroot is different from the build
machine.

Fixes: QTBUG-83335
Change-Id: Iaa69feb9a140b050f6b5547929cc940ee0f039ce
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-14 21:36:59 +02:00
Lars Knoll
7ea6cee525 Don't enable -headerclean by default even for developer builds
The CI system can test this, but there's little reason to blow
up every developers compile time by 30%.

Change-Id: I7677b0411103fb1301ad087c884cc9bd22a5aee2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-14 19:16:33 +02:00
Lars Knoll
b4fd377aa9 Make utf8_source the default for qmake builds
We now assume that source code is encoded in UTF-8 by default on
all platforms (and verify this with an auto test). Provide
a CONFIG+=no_utf8_source option for backwards compatibility.

[ChangeLog][qmake] qmake will tell the compiler that source code is
encoded in utf-8 by default. This mainly has an effect on Windows, where
MSVC still assumes source code is encoded in the current ANSI code page.
Use CONFIG+=no_utf8_source to get back the Qt 5 behavior.

Change-Id: I6dcafcaeefdea7d3907ccb723aeb7d23ccc0f04f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 19:14:51 +02:00
Giuseppe D'Angelo
9e1dc1e8a9 QStringView: add converting constructor from array-like containers
Centralize, rather than keeping adding constructors from any
array-like container.

A more robust implementation, likely following the converting
constructor for std::span ([span.cons]), is out of scope for C++17
and will require C++20's ranges and concepts.

[ChangeLog][QtCore][QStringView] QStringView can now be constructed
from any contiguous container, as long as they hold string-like data.
For instance, it's now possible to create a QStringView object
from a std::vector<char16_t>, a QVarLengthArray<ushort> and so on.

Change-Id: I7043eb194f617e98bd1f8af1237777a93a6c5e75
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-14 12:19:47 +00:00
Giuseppe D'Angelo
594abde1a2 Enforce that statically allocated array-like containers have 0 capacity
It has been the case for both QStringLiteral and QByteArrayLiteral
since Qt 5.0, and Q_ARRAY_LITERAL since Qt 6.0.

Since it's definitely surprising, add a note in the docs, which
is "somehow" consistent with the interpretation of capacity as
the biggest possible size before we reallocate. Since it's 0,
any manipulation of the size will cause a reallocation.
(Alternatively: the capacity() is for how many elements memory was
requested from the free store. No memory was allocated, so 0...)

Task-number: QTBUG-84069
Change-Id: I5c7d21a22d1bd8b8d9b71143e33d537ca0224acd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 14:19:47 +02:00
Alexander Volkov
af3caa2271 QBasicDrag: Send QDragMoveEvent when modifiers change
... without moving the mouse.
This allows to update drop action and cursor.

Task-number: QTBUG-56218
Task-number: QTBUG-82934
Pick-to: 5.15
Change-Id: I8b0ac2a008a9dbcc4c2d6abce282e6f169c2f542
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-05-14 15:19:47 +03:00
Lars Knoll
45ed28a9d3 Remove QRegExp from QVariant
Add an operator QVariant() to QRegExp to keep things at source compatible
as possible.

Add a hack to QVariant::load/save() to recognize the old typeid
for QRegExp and stream them correctly as long as the streaming operators
for QRegExp are registered.

Also move the datastream test for QRegExp to tst_qregexp, and adjust it to
the qvariant changes.

Change-Id: I120b38a7541b43ec07a21b17f7f35c55f071eb75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-14 12:19:47 +00:00
Lars Knoll
b2ee684a13 Remove QRegExp support from QString and StringList
Replacement methods do now exist in QRegExp, or
for QRegularExpression when porting to it.

Remove all autotests associated with the old methods.

Change-Id: I3ff1e0da4b53adb64d5a48a30aecd8b960f5e633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 14:19:47 +02:00
Lars Knoll
7370b60cfe Move methods using QRegExp in QString(List) over to QRegExp
The prepares for the removal of those methods from QString and
QStringList. The new methods in QRegExp are left as a porting help.

Change-Id: Ieffa33a79caf53b83029e9b070c4eb5cadca1418
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-14 14:19:47 +02:00
Marc Mutz
7a3a9b8eb5 QStringMatcher: port internals to QStringView and char16_t
Change-Id: If540b094d003ad373d3c581e1de8c526ad4c7d73
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-05-14 14:19:47 +02:00
Qt Forward Merge Bot
76fe36645e Merge remote-tracking branch 'origin/5.15.0' into 5.15
Change-Id: I06396fa0a3d1687a0935e48d290358edbb0e59e8
2020-05-14 14:01:32 +02:00
Marc Mutz
d68f3a81c9 Small fixes for the Q*Ref deprecation stuff
- don't force the deprecation sentence into a separate memory location
  (gives the compiler more leeway in how to lay stuff out)
- split the switch (will be useful when extending)
- fix a spelling mistake in one of the messages

Change-Id: Ied137dc8eee7047177983660e1a6776a0bf46bde
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-14 08:20:45 +02:00
Lars Knoll
57037145f5 Streamline the code in the conversion to and from utf8
Move pre/and post condition handling out of the main loop
to make that one as fast as possible.

Remove special handling of a corner case when the input length
is zero, where the utf8 decoder did something else than all
other decoders.

Change-Id: I94992767ea15405b38f7953adadaa6ff98b20b6f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:45 +02:00
Lars Knoll
751a003d1e Update QUtfFunctions and QUtfTraits to use qsizetype
Change-Id: Ic7d76513395645dba05f0023fdfcef0692c9b03b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:39 +02:00
Lars Knoll
1a6bf6c549 Remove QTextCodec dependency in the old SAX parser
Just so we can get this cleaned up as well and remove it from
Qt Core.

Change-Id: I2b5b821b039ce2c024ec3cb7338a1a9becdd2157
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:32 +02:00
Lars Knoll
b88720eb82 Remove QTextCodec references from QString docs
Change-Id: I2882f8aed61d92ed5eff6efd2e65679e6688454f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:26 +02:00
Lars Knoll
2b8863a98c Get rid of some QTextCodec leftovers
There's no real dependency to QTextCodec in those files anymore.

Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:20 +02:00
Lars Knoll
ada608d46d Get rid of QTextCodec in the textedit example
And refactor the code a bit to not convert to unicode twice and
use the mime database instead of Qt::mightBeRichText().

Change-Id: I56f9a732c8ad593e7f050eaad401be536bdf6f98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2020-05-14 07:51:15 +02:00
Lars Knoll
666b4a485b Get rid of QTextCodec in the cups support
This should all be utf-8 anyway, but right now simply exchange the
text codec with a string converter.

Change-Id: If0a230776824598b6378bb402d692c941e371104
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:11 +02:00
Lars Knoll
02980cd01d Remove qtextcodec.h from the pch for Qt Core
Change-Id: I32e34675fc0579ba3d4bdffb3474ef452bc4bffc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:05 +02:00
Lars Knoll
65821814ff Remove QTextCodec dependency from qmacmime.mm
Change-Id: I99f95d026683299c5d437b52803cb5a3a0ad0263
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-14 07:51:00 +02:00
Lars Knoll
8a84eb6c4a Remove autotest for codecForHtml
The test was rather bogus anyway...

Change-Id: I81b4f87bb811b2894ce88b1fdbb3183fc7259057
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:50:54 +02:00