Commit Graph

37100 Commits

Author SHA1 Message Date
Laszlo Agocs
d136299bb8 rhi: gl: Attempt reading back floating point formats
...in the hope that they may work. If not, that's it, but at least we
tried.

Task-number: QTBUG-76970
Change-Id: I134c5cc4cfb5ad1e6f9edbfcf506df20022e127a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-02-03 10:40:47 +01:00
Richard Moe Gustavsen
eadbf2dd0b QGuiApplication: use global position to create local position for synthetic mouse events
When QWidgetWindow handles a QTouchEvent, it will call
updateTouchPointsForWidget() for each widget it tries
to deliver the touch event to. This will make sure that
the point's position() is updated to be local to the
widget being processed.

The problem is that we never reset this overwriting of
local positions in the event after we're done. So if we
later try to synthesize a mouse event from it, the local
position in the fake mouse event will be based on the local
position inside a random widget, and not the original local
position sent from QPA.

Rather than trying to store all the original local
positions inside the event before going through this delivery
logic, and reset it afterwards, we base the local position of
the synthesized mouse event on the (unmodified) global
position instead.

Fixes: QTBUG-90033
Change-Id: I1588351482de7cce9c06d102db3686ea8dd0c118
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-03 09:05:21 +00:00
Assam Boudjelthia
4493b90224 Android: fix compiler warnings for Android input
QPointingDevice requires using the constructor to set its settings
in Qt 6.

Replace + with | operator and return QKeyCombination instead of int.

Change-Id: Id3da469cc13b34ec7b55afa751dbc04601880df6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-03 11:02:24 +02:00
Mitch Curtis
b1d750d59b Improve and expand QShortcutMap debug output
- Replace vague symbols with descriptive words.
- Use qScopeGuard() to ensure that removeShortcut prints the number of
  removed shortcuts for all execution paths.

Change-Id: I4d36366445756b41b1dc40bbb1e987dce669a723
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-03 09:46:40 +01:00
Eskil Abrahamsen Blomfeldt
fccd419dd6 Remove false Q_UNREACHABLE from shaping code
This was added by 9ff76c27b9 on
the basis that it signifies a shaping error and would later assert
or crash.

But the line is easily reachable by user code. If Harfbuzz returns
0 glyphs, it just means it is unable to shape the string, for instance
if the input string only contains default ignorables (like a ZWJ)
and does not have any appropriate glyph to use for replacement.

Qt expects there to always be at least one glyph in the output
(num_glyphs == 0 is used to indicate shaping is not yet done), so
to avoid asserts later on, we simply populate the output with a
single 0 token, which is a required entry in the font that is
reserved for representing unrepresentable characters.

This also adds a test and therefore a zero-width joiner to the test
font to reproduce the issue.

[ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts
when shaping strings consisting only of control characters.

Fixes: QTBUG-89155
Pick-to: 5.15
Pick-to: 6.0
Change-Id: Ia0dd6a04844c9be90dcab6c464bebe339a3dab11
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-02-03 09:44:44 +01:00
Andreas Buhr
52fcd0b6d7 Add method to conditionally remove binding to QObjectCompatProperty
Setters of QObjectCompatProperty need to remove the binding, but
only if it is not in the wrapper. This patch adds this method to
the public interface.

Change-Id: Ibc96418fe15b0aeeb2059411ea910ba1f733c255
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 09:32:12 +01:00
Joerg Bornemann
74f549b402 Fix static build with tests
A static build of Qt with QT_BUILD_TESTS=ON would fail with errors like
this:

FAILED: tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2
undefined reference to `qRegisterResourceData(...)'

We create object libraries for resources. In this case, for the
mimetypes of QtCore.

For static builds we added the object files to INTERFACE_LINK_LIBRARIES
of the Qt module the resource belongs to:
    target_link_libraries(Core INTERFACE
        "$<TARGET_OBJECTS:$<TARGET_NAME:${resource_target}>>")

That is, however, a problem for projects that link only against QtCore,
like testProcessEcho2 above. On the linker command line Qt6Core.a is
before qrc_mimetypes.cpp.o and that doesn't work, because the latter
needs symbols of the former.

To have the resource object files before any other libraries on the
linker's command line, we now treat them as source files.

Pick-to: 6.0
Fixes: QTBUG-90582
Change-Id: Ia2786beb5f7c2eba194e8f00ae8785572df1cf6e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-03 09:22:21 +01:00
Allan Sandfeld Jensen
936d499ed4 Optimize RGBA64->RGBA64PM for SSE2/AVX2
And remove the direct conversion so we can get both the SIMD
optimization and threading applied.

Change-Id: Id032ea91cc40c1cbf1c8a1da0386de35aa36cfb5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-03 08:22:16 +01:00
Allan Sandfeld Jensen
ba6b29a367 Fix inefficient use of qToBigEndian
It can do unaligned access directly as well.

Change-Id: I4046cf69e2ad8eb628b8b53bfa521800bb35dc6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-02 13:06:16 +02:00
Li Xinwei
fce1019133 qtlskey_schannel_p.cpp: fix a compilation error
qtlskey_schannel.cpp(183): error C3861: 'lcSsl': identifier not found

Change-Id: I406860f87a7b7f93ac2c0ca3d426dfa88615a90e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-02 18:34:26 +08:00
Tor Arne Vestbø
3d341ae882 macOS: Reduce duplicated code for showing file dialogs
The initialization was duplicated across the different modes. We now do
the setup once, in a shared showPanel:withParent function.

This also simplifies and removes the need to store the return code.

Change-Id: I3c4da48cfef92bcc59c76cffa15b40150de1a9e1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:16 +01:00
Tor Arne Vestbø
1724fccb01 macOS: Reduce duplicated updates of file dialog properties
Change-Id: I2017bfdfa6d5598405d700680ecaaf04fd6023fd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:13 +01:00
Tor Arne Vestbø
7f8a80ebf8 macOS: Refactor computing of accepted extensions in file dialogs
Change-Id: Ie71db5a0ab66dd9d157b53297cbb9aba248fa8af
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:29:11 +01:00
Tor Arne Vestbø
9366e034d9 macOS: Use single variable to track file dialog in QCocoaFileDialogHelper
Relying on Objective-C's no-op behavior when sending messages to nil was
nifty, but a bit confusing when trying to track the ownership model of
the class.

It's now explicit at the call sites what's going on (a cast).

The canSelectHiddenExtension property is valid both save and open
panels, but AppKit will only show it for save panels.

Change-Id: I8e12d629639e2179d155b2ecda1bb2dab2a5757d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-02 11:26:17 +01:00
Mårten Nordheim
a3b58a7844 NetworkListManager based backend for QNetworkInformation
For Windows. Based on the code I wrote for QNetworkStatusMonitor.
It also renames the netlistmgr feature, avoiding the abbreviation.
Locally my MinGW fails the networklistmanager feature test so it may
not be supported on MinGW, likely leaving it without a backend at all.

Change-Id: I13bbe4127edc2a9c0bb91602c95f1cb206a85a69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-02 11:10:06 +01:00
Morten Sørvig
dc3446c1e3 Make setSelectionOnFocusObject() take native pixels
Change the setSelectionOnFocusObject() to take geometry
arguments in native pixels, in order to be consistent with
other QPlatformInputContext API.

Calling code which pass non-native geometry must be updated
(in practice only the Android platform plugin).

Change-Id: I1c61b8cf583afe607567d6056ca7ff23cc3de3f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-02 10:22:52 +01:00
Christian Strømme
8ad66a1488 Android: Replace magic number for TYPE_NUMBER_VARIATION_PASSWORD
This field has been defined since API level 11, so no reason why we
shouldn't just use that instead.

Pick-to: 6.0
Change-Id: I8e3ffde3680e41f26d776e1f0474f632186a6b27
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-02 09:17:22 +00:00
Christian Strømme
5e95fab53f Android: Fix input method hints for ImhHiddenText
If ImhHiddenText is set then that should take precedence over the
other input method hints. Also, certain combinations aren't really
possible. E.g., ImhEmailCharactersOnly and ImhHiddenText doesn't have
its own specific variation on Android.
ImhSensitiveData and ImhNoPredictiveText are also likely to not work
as TYPE_TEXT_FLAG_NO_SUGGESTIONS is normally ignored by Android
keyboards. A common workaround is to use the visible password variation
but since this will force the layout to use latin characters it's not
something we can use as an universal workaround, so users will need to
manually enable it through the environment variable
QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT

Fixes: QTBUG-85787
Pick-to: 6.0 5.15
Change-Id: I0ff591ec9acf8dd556c7987e6d997cff3ddfe38e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-02 11:17:07 +02:00
Assam Boudjelthia
c00ab6f8ea Fix QJniObject::registerNativeMethods use of global reference
registerNativeMethods() should be using the local jclass from
findClass() instead of the global reference.

Task-number: QTBUG-89633
Change-Id: I469a9a1ecff95ab9948421baa5c88735ba7ad776
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-02 10:32:36 +02:00
Allan Sandfeld Jensen
9f4098937b Fix nullptr dereference on out-of-memory conditions
Fixes two static analysis warnings.

Change-Id: Id4644d1944e97c9c53d2268a9a71e5f6347d3946
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-02 09:32:36 +01:00
Allan Sandfeld Jensen
feb6711a79 Segment qimage conversion block irrelevant of depth
Always try segments from 64k to 128k pixels, this matches
qimagescale logic, and gives a one percent speedup locally.

Change-Id: I3ef468eac9dca4b84f04850e970f3d15a4f16255
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-02 09:32:36 +01:00
Morten Sørvig
b23f5621d7 iOS: Use new QPlatformInputContext geometry API
This enables support for QT_SCALE_FACTOR on iOS.

Fixes: QTBUG-74978
Change-Id: Ibcf0741c178e44802065e472e096a5f4c7d6f3cf
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 22:44:51 +01:00
Morten Johan Sørvig
dafe9e2363 Windows: Fix frame margins calculation
Passing nullptr to QHighDpi::toNativePixels() is seldom
correct, and will work only on the main screen.

Instead, call frameMargins() on the platform window
(instead of on the QWindow) and get the margins directly
in native pixels.

Pick-to: 5.15
Fixes: QTBUG-90716
Change-Id: Id7b31ec3246010c367781b64ed832c589bbaeb0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-01 22:43:59 +01:00
Joerg Bornemann
a4574bfd34 Fix duplicate symbols warnings in bundled freetype
Some of the listed source files are already included and must not be
compiled.

Pick-to: 6.0
Fixes: QTBUG-90777
Change-Id: I80b4ca6a50b882445aca513d800ef8375070d786
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-01 20:13:38 +00:00
Friedemann Kleint
90dc13ae5f Windows: Fix flicker when resizing translucent windows with QSizeGrip
Do not use the startSystemResize() functionality in that case.

Fixes: QTBUG-90628
Fixes: QTBUG-73011
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I8d4843c1715c7f75f9b41c904e6f1aebbf0e02d7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 20:44:27 +01:00
Jonas Karlsson
c5e9708ce6 Support cubemap ktx files
Change-Id: I6905c393647d31fab958cdd9471bb0a6ffe83596
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-02-01 20:28:37 +01:00
Timur Pocheptsov
5caf4b074e Schannel - fix a compilation error
While rebasing and resolving conflicts, I've acidentally removed a
declaration of supportsTls13() making a call expression invalid.

Change-Id: If561091db36f0354b61fa050ff9f72b29eddce53
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-01 20:25:59 +01:00
Morten Johan Sørvig
fddc0b34df Add geometry accessors to QPlatformInputContext
Currently the platform plugins use the public QInputMethod
API when querying geometry. However, QInputMethod returns
geometry in device independent pixels, while the platform
plugins require geometry in native pixels.

Add new API to QPlatformInputContext which returns input
geometry in the native window coordinate system:

    QRectF inputItemRectangle()
    QRectF inputItemClipRectangle()
    QRectF cursorRectangle()
    QRectF anchorRectangle()
    QRectF keyboardRectangle()

These make the relevant QHighDpi calls internally, and
such calls can then be moved out of the platform plugins.

Disambiguate inputItemRectangle() in qandroidinputcontext.cpp
by renaming it to screenInputItemRectangle().

Change-Id: I561745b64fb197d64e3dfddcf0751528bb8d0605
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-02-01 20:06:52 +01:00
Edward Welbourne
38a72af4fd Fix handling of Sunday in POSIX time-zone rules
Dating from the origins of our support for the zoneinfo file format,
the mapping of POSIX's day-numbering (0 = Sunday through 6 = Saturday,
see [*]) to Qt's (1 = Monday through 7 = Sunday) was done by mapping 0
to 1, when it should have been 7.

[*] http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

Corrected a QTimeZone test that trusted the results it got without
checking which day of the week those were: they were all Mondays.
Verified that the corrected dates are in fact Sundays.
Checked the zone abbreviations, too.

Fixes: QTBUG-90553
Pick-to: 6.0 5.15
Change-Id: I84b4b14f9892ff687918cd3c42c7c9807e45313c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-01 16:28:26 +01:00
Ulf Hermann
38d1444a60 Do delete on QMetaType::destroy() even without dtor
As we call operator new on create(), we also need to delete on
destroy(). Otherwise we leak memory.

Change-Id: Ib80fe96c4173cba6fa474d3c81d88fe603d1ded2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-01 15:46:39 +01:00
Craig Scott
d6a8560eae Ensure Core target has INTERFACE_QT_COORD_TYPE property defined
In order for other Qt modules to be able to reliably use this property,
it needs to be defined under all supported scenarios. Previously, it
would only have been defined for a per-repo build and not for a top
level superbuild. The only place it was being set was in the
Qt6CoreConfigExtras.cmake file and only when QT_NO_CREATE_TARGETS was
false (so it wouldn't be defined for examples even in a per-repo build).

It was also noticed that INTERFACE_QT_MAJOR_VERSION was also being
handled in Qt6CoreConfigExtras.cmake, but this was not needed. This was
already being done as part of a call to qt_autogen_tools_initial_setup()
which occurs inside qt_internal_add_module().

Fixes: QTBUG-90617
Change-Id: I589316ffb8138bd2df8a1d49fdd6335d2e2836f1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-02 00:59:01 +11:00
Richard Moe Gustavsen
3811be28ad iOS: always hide edit menu when showing the magnifier glass
Bug: If you do a press and hold on a line edit, the edit menu
will show to let you select a word etc. If you now do
another press and hold to bring back the magnifier glass,
the edit menu will stay open while you move the magnifier glass.

This patch will ensure that we always hide the edit menu when
we show the magnifier. There is never a case where both of
them should show at the same time. By hiding the menu from
the place where we show the magnifier means that we can
remove code from the QIOSSelectionRecognizer that used
to do this for one of the cases from before.

Pick-to: 6.0 5.15
Fixes: QTBUG-90743
Change-Id: If2a92f94422c730c2b223129d96f5bc3bf3deeee
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-02-01 14:50:33 +01:00
Eirik Aavitsland
93243b5d6a Avoid int overflow in gradient drawing
Fixes oss-fuzz 29348

Pick-to: 6.0 5.15
Change-Id: I3568a0a7a7e8d87881f5b052c6c00831b53b3842
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-02-01 14:47:58 +01:00
Robert Loehning
c08ebbeca9 Fix compilation with 32-bit clang
Currently fails with: undefined reference to `__mulodi4'

Change-Id: Iefa321d6fd7cb989dd4a00166ed65e5b7f3ba33f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-01 13:47:13 +00:00
Andreas Buhr
f1cebefd01 Fix compilation of ibase sqldriver plugin, added override
With gcc 10.2, I cannot compile qtbase without this patch.

Pick-to: 6.0 5.15
Change-Id: I5be48947e2301d5befeec397291c0da597f7eb63
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-02-01 14:44:48 +01:00
Timur Pocheptsov
1a0da3ae69 QSsl::TlsKey - provide the interface and implementations
which will become parts of TLS plugins in the future.

Task-number: QTBUG-65922
Change-Id: I4ee3c59c435fc34a9f4dacd3ff0e3cfb44251e23
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-01 14:36:40 +01:00
Alexey Edelev
59252a3a96 Remove the 'corewlan' feature
Remove 'corewlan' feature from the network related configure.json.

The 'bearer' component was removed in the Network module. It was
the only consumer of the 'corewlan' feature. There are no
plans, yet, to use CoreWLAN framework in the future.

Pick-to: 6.0
Fixes: QTBUG-90672
Change-Id: I1afb7b04ea75f8cb09cb570d820d16f54a130cf9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 13:34:53 +00:00
Alexey Edelev
566ba523ad Move static PCRE2 defines to non-system PCRE2 section
Private PCRE2-specific definitions should be only used with the
built-in PCRE2 library.

Ammends 7c69eb8868

Fixes: QTBUG-90556
Change-Id: If47e0b9eaaece290676d6c2b484bb52281aa7c68
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 14:34:46 +01:00
Alexey Edelev
295d4d6955 Remove usage of the definitions that are never defined
The QT_BUILD_QMAKE_BOOTSTRAP and QT_BUILD_QMAKE_LIBRARY definitions
are never defined in the project since migrating to CMake build.

Change-Id: I7108c92387005a2fde6ebdb2d74843e3efc6413e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-01 14:34:41 +01:00
Edward Welbourne
658b93386e Update double-conversion library to current master
Turned our local diffs into a side-branch in the upstream repo, got
material changes upstreamed (leaving only our #include changes),
rebased it to master, copied back to our version. Upstream has made no
new release since 3.1.5 in 2019 May, but there is substantial change
since then, including acceptance of our upstreaming. Our patches have
been refined in the process of upstreaming.

The list of source files is slightly changed. The double-conversion.*
files are split in two, string-to-double.* and double-to-string.*, but
the old double-conversion.h header is retained, simply pulling in its
two halves. These thus need to be present in the include directory.

Changed the patches/ directory to be in git format-patch form, for
sending or applying to the upstream repo, before copying files into
the qtbase source tree. This should make future upstreaming easier.

Task-number: QTBUG-90214
Change-Id: Id94198f58ef7bdf02af117c35cb9678b5c34ac0e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-02-01 14:31:30 +01:00
Giuseppe D'Angelo
784c443ab0 QMatrix4x4: implement operator*(QVector3D/QPoint(F)) in terms of map
Rather than the other way around, in preparation for deprecation.

Change-Id: I001d7617425a24e960871925130c5314c393ea8c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-01 00:23:22 +01:00
Piotr Mikolajczyk
36ddabfa52 Shrink the memory footprint of QLocalSocketPrivate
Member variables have been reordered to reduce the memory
footprint by 8 bytes.

Change-Id: Ib03f916c065861fa317f8802695363fd152e314a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-01 00:23:22 +01:00
Andreas Buhr
a1a2d97e34 Remove QObjectCompatProperty::operator= for safer usage
Introduction of QObjectCompatProperty requires every write to
the property to be examined whether it is OK or should be replaced
by a setValueBypassingBindings/markDirty combination. The existence
of operator= make this difficult as it is easy to miss places where
it is written. By not having operator=, we can help developers
make sure they had a conscious decision about each write to the
property.

Change-Id: Ia61ea4722eb0bab26ce7684b85dd03d710cd1751
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-29 16:06:19 +01:00
Andy Shaw
115bcdb862 Cocoa: When validating menus, account for modal window only if active
When a modal window is WindowModal then it is possible for another top
level window to be active and therefore the menus shown may be valid
for the window. So we can still allow the menu items to be validated in
the context of that window.

Fixes: QTBUG-74088
Pick-to: 6.0 5.15
Change-Id: Ifb9c3fe12654b2972e0e3c368dc093fae1ed4cc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-29 11:55:43 +01:00
Alex Trotsenko
8f9222db3b QEventDispatcherGlib: do not omit active notifiers on source dispatching
It is quite common for a socket notifier to be disabled in a slot
connected to its activated() signal. But the event dispatcher did not
update the position in the list of registered notifiers, which caused
the next notifier to be omitted. Of course, on the next iteration of
the event loop, the omitted notifier would fire again, but this reduced
the scalability of applications that use a large number of sockets.

To solve the problem, we update the current position in the list when
a notifier becomes unregistered.

Change-Id: I6565bf23500d9e38ce84b34784d89d227fa166e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 10:55:42 +00:00
Alex Trotsenko
f9896cb3cd QProcess/Unix: remove dead function
findExitCode() doesn't do anything on Unix.

Change-Id: I3efdc1380a39437c4c029073f3b10ccf7a65e580
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 12:55:42 +02:00
Allan Sandfeld Jensen
f2c3b52c6c Revert "Port QThreadPool to the new property system"
This reverts commit 8f8405e046.

Reason for revert: Appears not entirely thread-safe and caused QTBUG-90705

Change-Id: I390c0b1a555a18e6a095b52010371d017071e26b
Fixes: QTBUG-90705
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-29 10:55:42 +00:00
Christian Ehrlicher
0ca3f1732a QDial: fix painting QDial when the rect has an offset
When the QDial should be painted with an offset, the dial was not draw
correct.

Fixes: QTBUG-89574
Change-Id: I646c3d42fba34e8c603a8f81f363ed827f04d5de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-29 07:26:56 +01:00
Christian Ehrlicher
180c662b07 QHeaderView: Mark the drop section during section move
Currently there is no visual feedback where the section move will end
up. Therefore mark the drop section to show where the dragged section
will be inserted.

Fixes: QTBUG-673
Fixes: QTBUG-1114
Change-Id: I3e45a9a9c0604342bb0286fc7cd4c89c757c28cd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-29 06:26:55 +00:00
Hou Lei
693aa08ddf Specification of pointer usage
Avoid C-style casts when possible.

Change-Id: I8e86eb8c439b456da41d52a5666190330edeeda2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-29 02:23:46 +00:00
Fabian Kosmale
40bfbe7dd9 QVariant: Use QMetaTypeInferface directly
There is no reason for QVariant to go through QMetaType when it can use
the QMetaTypeInterface directly. Without LTO, the QMetaType method calls
are opaque, and we therefore risk to lose optimizations.
Additionally, avoid constructing a QMetaType from a type id if we
already have the QMetaType.

Fixes: QTBUG-90673
Change-Id: I7069ff6aff70d5baecdf5cf5760014c3dda81784
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-28 18:51:22 +01:00
Fabian Kosmale
af53fb0e00 QProperty: Treat change listener modifying its source property as a loop
This is in line with QML where

import QtQuick 2.15
Rectangle {
  width: 100
  height: 100
  color: "red"
  Rectangle {
    id:  inner
    x: 10
    y: x
    width: 50
    height: 50
    onYChanged: { console.log("hey"); inner.x = 10}
    TapHandler {
      onTapped: inner.x = 20
    }
  }
}

results in a binding loop warning when the tap handler triggers. While
the change handler would only run once, we cannot statically determine
if we need to loop once, twice, or if there actually is a diverging
loop. Thus we unconditionally warn about the binding loop and stop
executing the binding.

As a drive-by, verify in the related test that a change handler which
overwrites its properties binding itself removes the binding.

Change-Id: I5372019c2389ab724c49cd7489ecbd3ebced1c69
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-28 18:51:19 +01:00
Andreas Buhr
127147feb0 Create bindable property overview documentation
So far, all documentation about bindable properties was in the
corresponding classes QProperty and QObjectBindableProperty.
This patch creates one documentation page for a general
introduction to bindable properties and information
concerning all of those classes.

Change-Id: Ib718dbeb385c3899fb34cc2ce03bec7a8d43a034
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-28 18:50:48 +01:00
Andreas Buhr
a7ca8b1a28 Safer setting of interval in QTimer
There are two methods which set the interval and do things
afterwards. Setting the interval might trigger other code. This
patch uses setValueBypassingBindings and marks the interval dirty
later, just to be safe.

Change-Id: I2cae3e4a9f040007dfd246c424250034e8df10a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2021-01-28 18:50:37 +01:00
Timur Pocheptsov
1a2dd92767 TLS backend: merge with its factory
QTlsBackend is a factory itself - it creates TLS/X509 objects. Having
an intermediary between Factory->Backend->TLS primitive does not look
very natural thus let's squash the first two parts. Backend is a factory
creating TLS primitives, but its static functions also provide information
about backends availablei and give access to those backends.

Fixes: QTBUG-90606
Task-number: QTBUG-65922
Change-Id: I8409d81fd11fb46e6ab4465b4937a7680a8c2447
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-28 16:21:07 +01:00
Zhang Hao
795ea19ca0 QLineEdit Cursor show white area
fix QLineEdit Cursor Rect and InputMask area overlapping,
the cursor rect area is white. when inputMask is set,we don't
need draw cursor.

Fixes: QTBUG-89578
Pick-to: 5.15 6.0
Change-Id: Ibec7f8f1f7331a12438fd821c2002903260da10a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-28 18:02:18 +08:00
Eirik Aavitsland
bfc09b8d8f Avoid overflow in text layout
Fixes oss-fuzz issue 29313.

Pick-to: 6.0 5.15
Change-Id: Idbabd162fa9e0dbce687981bdbcc75be37189a61
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-01-28 11:02:18 +01:00
Mårten Nordheim
ed05ef7758 Fix static analysis warnings concerning QNetworkInformation
By marking undeclared and unused copy/move constructors as deleted.

Change-Id: Ie74b9cb015090dbb425b701a55eadb9d80ab0285
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-27 17:03:37 +01:00
Timur Pocheptsov
7687e2a429 Port QLocalServer to the new property system
Task-number: QTBUG-85520
Change-Id: Iee43a2e9e2d4847dad3b8be345d562af9aa3b690
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-27 16:54:46 +01:00
Timur Pocheptsov
061254ed12 QDnsLookup - port to the new property system
Read/write/notify properties, 3 out of 5 defined in this class.

Task-number: QTBUG-85520
Change-Id: Ic6c74f90a2fa3c71d71cf9a5d557f1b6fc489d35
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-27 16:54:38 +01:00
Fabian Kosmale
9b239b7fac Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS: Silence warnings properly
Same reason as for the version without args. Amends
1461df2ce4.

Change-Id: Ib9f0d8f27d858ff35134001c3cd7945b17668ae4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-01-27 16:51:07 +01:00
Alex Trotsenko
821af41cf2 QProcess/Unix: simplify notifiers deactivation
To minimize code duplication, move the socket notifier deletion to the
closeChannel() function, where the pipe descriptor will be closed.

Change-Id: If75ba1c955c706ae6e2b3d9f53f7a25e4aa32fa7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-27 17:28:44 +02:00
Assam Boudjelthia
4e60681c87 Make QJniObject and QJniEnvironment public API
As part of Qt 6 restructring for the extras modules, this change exposes
the Jni APIs which are very important for Android platform. This patch
adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based
from private QtCore and QtAndroidExtras.

The Jni interface is cross-platform which justifies the name, but
currently, this API is used mainly for Android, and the naming comes
generic without Android keyword to avoid any future limitation on
supporting other platforms.

[ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and
QJniExceptionCleaner APIs.

Task-number: QTBUG-89482
Fixes: QTBUG-89633
Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-01-27 17:23:04 +02:00
Nico Vertriest
407ce5c0af Doc: Fix CI warnings qtbase
Change-Id: I4e5a2d3494b86008bde234447ef701ea2d6447f6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-01-27 14:46:36 +00:00
Sona Kurazyan
3a5a404a53 Port QMovie to the new property system
Task-number: QTBUG-85520
Task-number: QTBUG-85521
Change-Id: Ib936020260cf01a5221b63fb1eb0ccb23f5553a3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-27 15:16:20 +01:00
Sona Kurazyan
67ced4da5a QMovie: initialize the private members while declaring them
Change-Id: Ie9c1484c8ad3483da3d559e1703770cdf22cec5e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-27 15:16:16 +01:00
Allan Sandfeld Jensen
f0ab1c02d7 Optimize subpixel positioning
Dividing by (1/x) is the same as multiplying with x.

Change-Id: Ica854d1e012ad83437e32f12de0d3513a42ae6f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-27 15:09:58 +01:00
Fabian Kosmale
0f4d512dc4 Q(Untyped)Bindable: add takeBinding method
We missed takeBinding as a supported operation on Q(Untyped)Bindable.
To avoid adding version checks to code dealing with QBindableInterface,
we simply synthesize takeBinding as a combination of binding to retrieve
the binding and setBinding with a default-constructed
QUntypedPropertyBinding.

Change-Id: I43803a0dfe210353d0235f0373d2257f75ffe534
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-27 15:01:56 +01:00
Fabian Kosmale
f07c6f52ac QBindable: add initial documentation
Change-Id: I43681093c8819289037c76bd9c05b88a6da8311b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-27 15:01:54 +01:00
Allan Sandfeld Jensen
16b8d766ab Fix division by zero
Consider a zero we need to divide with illegal input.

Fixes oss-fuzz 29347

Pick-to: 5.15 6.0
Change-Id: I2aae1d765d2dd81c95d423038ef5cb878d4f8026
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-01-27 15:00:57 +01:00
Edward Welbourne
3c9013b76a QTzTimeZonePrivate::init(): fix handling of empty ID
We were using the first abbreviation in the list, where the current
time's one is probably more apt.

We look up displayName() using ICU, when in use, but that abbreviatio
may be unknown to it. So ensure, when using abbreviation in place of
empty id, that we get the system zone for ICU, for use if we're asked
for the display name.

This is a follow up to b12d6c6a8a.

Pick-to: 6.0 5.15
Change-Id: I177db55de1ffbc763def8a0423642f2b3da74fa6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-27 15:00:57 +01:00
Edward Welbourne
b08368d99f Add qHypot() to qmath.h, exposing and extending std::hypot()
We have plenty of places where we add some squares and take a square
root; this may be done more accurately and faster by hypot().
Introduce QHypotHelper to handle hypot with more than 3 parameters,
and with 3 when the C++17 version is missing (which it never should
be). Include an overload taking arbitrarily many valus and ensure that
we can use qHypot() with qfloat16.  Illustrate with some example uses,
add some tests.

[ChangeLog][QtCore][QMath] Header <QMath> now provides qHypot(), an
implementation of std::hypot() taking arbitrarily many numeric values,
including support for qfloat16, while avoiding the overflow and
underflow problems that arise when naively taking the square root of a
sum of squares.

Change-Id: Ia4e3913fe83fc27d17d8e7f1a52f03ad445c1fed
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-27 15:00:57 +01:00
Edward Welbourne
ad16f79e5f Update public suffix list to today's latest
Fetched from the authoritative source, verified the content matches
that of the current master revision in the github repository.

Amend one cookie jar test to find the last group in the last chunk
correctly - each group arises from a non-empty hsah-table entry, but
the last few hash-table entries may be empty, in which case the last
group isn't just before the last index, it's earlier by the number of
empty hash table entries. In the process, amend this test and the
related test of the end of the first chunk to iterate all the entries
in the group (in the present version, as it happens, each end-group
has just one entry, but that may vary).

Task-number: QTBUG-90214
Pick-to: 6.0 5.15
Change-Id: I6da365a6ca558124f8275e392735071dc77e04bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-27 15:00:57 +01:00
Edward Welbourne
05e67fbcab Update to CLDR v38.1, adding Yukon Standard Time
No change to QLocale's data, one addition to the Windows time-zone
data. What was formerly "Us Mountain Standard time / Canada" is now
Yukon Standard Time.

Fixes: QTBUG-89784
Pick-to: 6.0 5.15
Change-Id: I4c9a23620e74ea379be8a4c5ba0896d35fe9b594
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-27 15:00:57 +01:00
Sona Kurazyan
8f8405e046 Port QThreadPool to the new property system
Ported all properties, except activeThreadCount. Marking it dirty may
cause a re-evaluation of properties depending on it, which may reault in
a deadlock in case of trying to read activeThreadCount property which is
being marked as dirty.

Task-number: QTBUG-85520
Change-Id: Id073b0895c89a9e6b05b57ad520db994e550a1c9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-27 15:00:56 +01:00
Mårten Nordheim
d3735ff838 Fix schannel compilation issues
Amends 7cf8e5ada9

Change-Id: I6e188675ab53fd173bd75defe9d190a509f4adad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-27 15:00:56 +01:00
Allan Sandfeld Jensen
05741b404a Protect against sign-change of size on 32bit
Since qsizetype is signed and the profileSize unsigned, it can turn
negative circumventing the test here.

Fixes oss-fuzz issue 29278.

Pick-to: 6.0 5.15
Change-Id: I1e211c78db6f4ff150613f52d8fc29807f0088ff
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-27 10:30:26 +01:00
Timur Pocheptsov
dcbca2975f Q_GLOBAL_STATIC - deal with static code analysers
At least some of them don't like the fact we have classes with
non-trivial destructors but trivial move/copy constructors -
disable them explicitly, hopefully those analysers are smart
enough to stop complaining.

Change-Id: I285711a2d21bff89661af928ba326ecd5b69823f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-27 10:30:26 +01:00
Fabian Kosmale
bf7b1a2aa8 QVariant: Do not destroy trivial types
perf indicates that we spend quite some time in ~QVariant in the
referenced task's benchmark. With this patch, we significantly reduce
the amount of work we do in the destructor for trivial types: Instead of
calling an out-of-line function, which does a few checks and then does
an indirect call through a function pointer to a do-nothing dtor before
freeing the memory, we now simply free the memory.

We achieve this by changing QMetaTypeInterface to leave the dtor
function pointer null if the type is trivially destructible. Then, in
QVariant we use the QMetaTypeInterface directly instead of going through
QMetaType.

Task-number: QTBUG-90560
Change-Id: Iaf87036710e1680323842e1ba703a5d3d0e5027a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-27 10:30:26 +01:00
Thiago Macieira
00b759a8d0 QJsonObject::take: add missing detach() call
We were modifying shared objects.

Pick-to: 6.0 5.15
Fixes: QTBUG-89625
Change-Id: Id6bc735b79cf4beb9454fffd165c56476a5dec04
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-27 05:11:39 +00:00
ChunLin Wang
6da6b6da44 Fix that the placeholdertext of QCombobox is not drawn
If the current index is invalid,a placeholdertext will be displayed.

Fixes: QTBUG-90595
Pick-to: 6.0 5.15.2
Change-Id: Id4c6b9c959242b96ee0944b8fc3131a9a2fdcccc
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-27 09:11:42 +08:00
Valery Volgutov
f7f618b312 evdevtouch: Fix normalizedPosition
Set the available virtual screen geometry. This geometry is needed for
QEventPoint::normalizedPosition calculation.

Pick-to: 6.0
Change-Id: I7e25488d62a5099c14b5c15fa2b4040ea32b9ecd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
2021-01-27 00:56:05 +00:00
Sona Kurazyan
ba62256c5a Port QStandardItemModel to the new property system
Task-number: QTBUG-85520
Task-number: QTBUG-85521
Change-Id: I2f9bbe8bc06838fcbadd446e111fb697120f550c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-26 21:48:00 +01:00
Ivan Solovev
709a0942aa QTimer: port to new property system
Task-number: QTBUG-85520
Change-Id: I1f92b86619f2ca186c505251b21463f396af0ac6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-01-26 21:47:50 +01:00
Sona Kurazyan
519420641f Port QPauseAnimation to the new property system
Task-number: QTBUG-85520
Change-Id: I8c0ee86598f4c0f093f64b2891ee835a43964b84
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-26 21:47:47 +01:00
Andy Shaw
feb20459bd ibase: Fix the compilation and include it again so it can be detected
Change-Id: I38721155f090173862da8beab8cb04b2e015dcff
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-26 21:47:36 +01:00
Ivan Solovev
fe7cbf8fe6 QRegularExpression: add move constructor
- Add move constructors to QRegularExpression, QRegularExpressionMatch
  and QRegularExpressionMatchIterator.
- Update the documentation to explicitly state that only destructor
  and assignment operators can be called for a moved-from object

Task-number: QTBUG-86634
Change-Id: I06b4f54e300541033a9a18339c97338717a06da0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-01-26 17:20:01 +01:00
Bastien Bouclet
b69b04c479 QIcon: Use the @nx pixmaps in the paint method
Make use of the device pixel ratio in the QIcon paint method so the @nx
hi-dpi pixmaps are selected when appropriate when painting to a
QPainter.

Pick-to: 6.0
Fixes: QTBUG-90042
Change-Id: I53995a2285ef879e3c4fddb9f8da702e256a260f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-26 15:33:08 +00:00
Alexey Edelev
e3e1fc4820 Add upstream version of FindPostgreSQL.cmake
Add CMake upstream(3.20.0) version of FindPostgreSQL.cmake, to avoid
server-related headers lookup.
Avoid using the Qt version of the PostgreSQL module, if it's
older than the CMake's one.

Fixes: QTBUG-89639
Change-Id: I71a0c3508000901969933aea8a08d1ad431db711
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-26 16:05:05 +01:00
Fabian Kosmale
293b7fab55 Workaround MinGW not handling error suppression macro correctly
Fixes: QTBUG-90353
Change-Id: I9270f4107f3f7083d28228f2426b34bc1e198112
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-26 15:55:21 +01:00
Volodymyr Samokhatko
976f28e7bb Fix populating selection clipboard with keyboard
Task-number: QTBUG-59879
Pick-to: 6.0 5.15
Change-Id: I6948919fc90995c60a34b5bd6b4a225c1a59fd9b
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-01-26 12:28:49 +00:00
Andy Nichols
3509fc3a1f Android: Fix deprecated QVariant usage
Change-Id: Ib14bbba726d1da352933ed418931d69443720946
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-26 13:28:35 +01:00
Mårten Nordheim
6cd5448404 Don't forward-declare non-Qt things with QT_FORWARD_DECLARE_*
As it breaks in namespace builds

Change-Id: I1a278330eeea6b2b89c8a57c0df828dff94ebf7a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-26 13:28:35 +01:00
Tor Arne Vestbø
c4c0c54ba1 Clean up QCocoaFileDialogHelper
- Remove indirections via helper functions that did nothing but
   redirect.
 - Remove unneeded checks of !m_helper in delegate. The helper is
   always valid for a delegate.
 - Use m_ prefix for member variables, as in the rest of Qt.
 - Implement init: as per modern Objective-C recommendations.
 - Remove respondsToSelector checks that were not needed.
 - Use modern Objective-C property syntax.
 - Fix code style issues/formatting.
 - Remove unused functions.
 - Reorder and remove unused includes.
 - Class-initialize member variables.

Change-Id: Iedc084b67bb496b2ef13001a0e6aa46d4574eb57
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-26 13:28:35 +01:00
Tor Arne Vestbø
d7c07578bc macOS: Don't restrict non-modal file dialogs to open-dialogs only
None of the APIs used for non-modal operation require NSOpenPanel.

Pick-to: 6.0 5.15
Change-Id: I7ea49a8dad6e724a8a0d4321ea443d4cdcc5a6b1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-26 13:28:35 +01:00
Tor Arne Vestbø
fce391fefb macOS: Show system tray icon on mouse button press, not release
This was a regression from 395e2d9bc4.

The system behavior is to show the menu on press, so we follow that.

This is also documented at:

 https://doc.qt.io/qt-5/qsystemtrayicon.html#ActivationReason-enum

Fixes: QTBUG-86518
Pick-to: 6.0 5.15
Change-Id: Ia4dc5356bf0377a9d55f238caf5bf1becd95648d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-26 13:28:35 +01:00
Fabian Kosmale
37b0bad8ad QVariant: avoid superfluous QMetaType lookup
Constructing a QMetaType from an id requires a lookup which isn't free,
even for builtin types. When constructing a QVariant from an integer,
this leads to a noticeable performance loss.

In the mirco-benchmark of the linked bug, we improve from
100000000 965
to
100000000 789
on Linux, Intel i5-4690, clang 11.01 with a CMake release build.
This however still does not recover the performance we had in Qt 5.

Task-number: QTBUG-90560
Change-Id: I26440bdc04ef131ce91d3698957f0df43a4c4017
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-01-26 11:36:48 +01:00
Ulf Hermann
606b03d0a3 Partially revert 813a928c7c
Otherwise ASAN complains about mismatched new/delete.

Change-Id: I76ddcc388309e20055c93c68b9b6fa8a11b884e1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-01-26 10:57:42 +01:00
Lars Knoll
92db806aa8 Update QMutexLocker documentation
And add an entry about the API changes to qt6-changed.qdoc.

Pick-to: 6.0
Task-number: QTBUG-89429
Change-Id: I146574acd3e4aa5ed6f1629fc68888f009472f19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-26 10:04:11 +01:00
Andrei Golubev
37e26d2b30 Extend alignment of QArrayData to std::max_align_t in allocation
Make stricter alignment requirements for the allocated header

This strict alignment allows reallocateUnaligned() to property account
for the padding occurring in cases when
alignof(QArrayData) < alignof(T) <= alignof(std::max_align_t), which
happens to be the case on e.g. 32-bit platforms with specific alignment
requirements.

This adds 4 bytes (the difference between alignof(std::max_align_t) and
sizeof(QArrayData)) of overhead for QString, QByteArray and certain QLists
on 32-bit systems.

Task-number: QTBUG-90359
Pick-to: 6.0
Change-Id: I8176a4cc79f100ee772b09425e88fe8ff3ae226a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-26 08:01:27 +00:00
Alexey Edelev
7c69eb8868 Use system PCRE2 for Bootstrap library
By default, use system PCRE2 for Bootstrap library, if not
cross-compiling.

Fixes: QTBUG-90556
Change-Id: I7291927565484073cadacec9a381b54b44ebeaec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-25 20:55:14 +01:00
Kai Köhne
87ffd79622 QMimeDatabase/xml: support both 'xmlstarlet' and 'xml' for minifying XML
Commit 370324f6e2 changed the call to 'xml' to 'xmlstarlet' because
some Linux distributions do not provide a binary called xml. Anyhow,
the official Windows packages of xmlstarlet only provide 'xml.exe'.

Therefore just check for both.

Pick-to: 5.15 6.0
Change-Id: I4381b256850e4101b760df21f2b0baffb4414620
Reviewed-by: Eric Lemanissier <eric.lemanissier@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-25 19:00:53 +00:00
Kai Köhne
9165866b19 Bump copyright year to 2021
Change-Id: I18a9c2de391ca51655148b2e3cc9abdfbb8ddbcf
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-25 20:00:44 +01:00
Kai Köhne
e7c028bb9c QLocale: Allow direct conversion from language, country, and script codes
This complements patch a148c7b5d71d244, where languageToCode(),
countryToCode() scriptToCode() methods were introduced, with matching
codeToLanguage(), codeToCountry(), and codeToScript() methods.

This allows us to remove the use of private Qt Core API in Qt Linguist.

[ChangeLog][QtCore][QLocale] Added static codeToLanguage(),
codeToCountry(), codeToScript() methods that convert ISO code strings
to the respective enum values.

Change-Id: If5c0843a718c006ade086a6f74ceb86ac6e0fce4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-25 19:56:59 +01:00
Tor Arne Vestbø
aa3b42d634 macOS: Don't exec file dialogs via runModal unless they are app modal
Non-modal or window modal dialogs are shown at show(), via AppKit APIs
that are non-blocking. If we want to block execution at this point, we
need to spin our own event loop. The runModal API of NSSavePanel is not
meant to be used for blocking execution for already shown dialogs, but
is reserved for application modal dialogs.

This means we no longer trip over AppKit's understanding of what state
the dialog is in, which would result in the dialog not reporting back
any files. It also allows us to remove the guard for closing dialogs
twice.

We now also correctly close and end the application modal session if
the dialog is closed programmatically using Qt APIs.

Task-number: QTBUG-89959
Fixes: QTBUG-85547
Pick-to: 6.0 5.15
Change-Id: Ida3dc404417789d4823822ecfbf0935591c23878
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-25 18:26:47 +01:00
Edward Welbourne
0180a1ab82 Make QCalendar's backend registration reentrant-safe
Previously, different threads instantiating the same back-end could
collide in the register, with various unwelcome results.

Give Registry an atomic status flag to track whether it has been
populated or is being destroyed; and protect it with a mutex to ensure
distinct threads do not collide during registration or attempt to
register while the registry is being destroyed.

Document the correct way to instantiate custom backends, and that no
code other than the QCalendar implementation should instantiate the
built-in ones. Instantiators that follow these rules should be safe
from failed registrations, provided they don't pick a name that
conflicts with some other backend. They can also use the recent change
to semantics of registerAlias() to verify that registration *has*
succeeded.

Done-with: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Pick-to: 6.0 5.15
Task-number: QTBUG-88815
Task-number: QTBUG-85692
Fixes: QTBUG-84575
Change-Id: Ie78e700e71d610454152c05cafb38f6f713649ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-25 18:04:36 +01:00
Allan Sandfeld Jensen
fdc7eb80dd Add QPlatformScreen::colorSpace()
Added for macOS and X11 screens

Task-number: QTBUG-90535
Change-Id: Ifafe7a07ee2abc3c42cd12785db2d7329878375b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-25 17:21:54 +01:00
Christian Ehrlicher
4e2a942369 QSql/PostgreSQL: allow blobs with more than 2^30 bytes
Due to limitations of QByteArray it was not possible to store more than
2^31 bytes. This was fixed in Qt6 so throw away the casts to int in the
postgres plugin

Fixes: QTBUG-79059
Change-Id: I8ae7276a04d4936bcf5ba6c413e3412f6c342ff5
Pick-to: 6.0
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-25 16:37:25 +01:00
Eskil Abrahamsen Blomfeldt
d79a9b1a4f Implement vertical subpixel positioning where available
For some use cases, vertical subpixel positioning may be
useful, as it allows you to vertically align text with
other painting primitives. This does impose an overhead,
so we make it opt-int with a render hint on the painter.

Note that this is only supported on Freetype currently.
It might be possible to support on older macOS versions,
prior to Mojave (which has disabled subpixel positioning
entirely), but since it would have limited usefulness
and Freetype is cross-platform anyway, I skipped that.

Note: This drive-by-fixes an issue with subpixel
positioning where glyphs would always be offset by 1/64,
because we added the aliasing offset *after* we had
determined the closest subpixel position. The idea of
this, as far as I can understand, is rather to snap to
nearest subpixel position upwards, not to add an offset
to all glyphs, so it should be added before finding the
correct position. It had a subtle visual effect when
animating the position. It might be that we could get
rid of it entirely, as I haven't been able to reproduce
any issues with that, but I have moved it instead, to
match what I believe the intention was.

[ChangeLog][QtGui][Text] Added render hint flag
QPainter::VerticalSubpixelPositioning which will position
text at subpixel positions vertically whenever supported.
In absence of this, text position will be rounded
vertically as before.

Fixes: QTBUG-35682
Change-Id: I8ce7a72a64e5a0924dac7c244e3e07c2938bfd09
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-01-25 15:56:50 +01:00
Kimmo Ollila
77cfbd755a Add correct prefix for GHS compiler
This fixes INTEGRITY build error:

cannot access position 53 in array of 49 elements
          constexpr const char *begin = func + prefix;

and many "expression must have a constant value" errors.

Change-Id: I0e043028fbcb479c6657b59ea144b4536cc65651
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-25 08:37:06 +02:00
Christian Ehrlicher
1a9095e1fa QComboBox/Fusion style: elide text when it's too long
The fusion style did not elide a very long text in a QComboBox as it's
done in other styles / non-popup mode.

Fixes: QTBUG-86632
Pick-to: 6.0 5.15
Change-Id: I356a61809220d41717a9039d2b33dd706d034941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-23 15:03:36 +00:00
Joerg Bornemann
88e24e6a25 Remove the QT_CMAKE_BUILD preprocessor define
Qt is now always built with CMake.

The "cmake" keyword for QtTest blacklists remains for now. Removal is
tracked in QTBUG-90545.

Change-Id: I0011d56176a07c82698b2eb9aa330e77efa6cd34
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-22 19:22:15 +01:00
Alex Trotsenko
3fc6b45cbb QProcess/Win: move pipe draining into QWindowsPipeReader
... where it belongs.

To avoid the loop, introduce the drainAndStop() function, which allows
QWindowsPipeReader to flush the pipe itself. It determines the number of
bytes pending and blocks until the remainder of the process output is
received.

Note that the loop in drainOutputPipes() didn't actually have to
interleave the two pipes (because we're presuming that the operations
will finish instantly), so we don't do it now. Also, the code violated
the API contract: 'true' was returned when the 'wrong' channel received
data; this is now fixed as a side effect.

Change-Id: I38ed4861a238e39e793c3716e856e5bfdeed3d74
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-22 16:26:39 +02:00
Friedemann Kleint
db942d6125 QTestlib: Speed up comparison of qsizetype
Add a qCompare() overload for qsizetype, preventing it
falling back to the slow code path pre-formatting expected/actual.
toString() should use the correct format from the already present
int-types (see macro TO_STRING_IMPL).

Complements  94aa350621.

Task-number: QTBUG-38890
Change-Id: Ieb8cea7de086141a2c80f93b4c1be01572be96df
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-22 12:11:39 +01:00
Thiago Macieira
cbdf2ba46a Update TinyCBOR
Updated to commit e6a4fa4862bcc3a6f6b07cf9d9b784d0ab6068b4.

Pick-to: 6.0
Fixes: QTBUG-89650
Task-number: QTBUG-90214
Change-Id: I6edce5101800424a8093fffd15cdf6591cbf809d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-22 03:02:39 -08:00
Laszlo Agocs
df0e98d408 rhi: Pipeline cache load/save
Add QRhi APIs to retrieve and reload the contents of the "pipeline
cache".

The only API where there is a true pipeline cache is object is Vulkan
(VkPipelineCache). For OpenGL, the other backend where we support this,
it is simulated with program binaries. The Qt 5 style OpenGL program
binary disk cache continues to work like before, but one has now the
option to do things in a more modern, graphics API agnostic way, that
leads to generating a single blob instead of a large set of files in
some system location, allowing easier "pre-baking" of the cache content.

It is expected that Qt Quick exposes the two new functions in form
if QSG_RHI_ environment variables, thus allowing easy testing and
cache file generation.

As an example for the performance improvements this can give, consider
Vulkan, where we do not have any existing persistent caching mechanism
in place:

Running BenchmarkDemoQt6.exe --scene flythrough --mode demo creates 18
QRhiGraphicsPipeline objects from Qt Quick and Qt Quick 3D.

The total time spent in QRhiGraphicsPipeline::create() during application
startup for these 18 pipelines is 35-40 ms on a given Windows (NVIDIA)
system.

When exporting the pipeline cache contents to a file, and then, in a
subsequent run, reloading the cache contents, this is reduced to 5-7 ms
on the same system, meaning we get a 6-7x improvement.

The generated data is always specific to a given Qt version, RHI
backend, graphics device, and driver version. Much of the implementation
consists of adding and verifying the appropriate header to the blobs
retrieved from the driver, to allow gracefully ignoring data that was
generated with a device or driver that differs from the one used at
run time. This should provide robustness, even if the Vulkan or OpenGL
implementation is for some reason not prepared to identity and reject
incompatible cache/program blobs.

Fixes: QTBUG-90398
Change-Id: I67b197f393562434f372c7b7377f638abab85cb3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-22 10:26:03 +01:00
Timur Pocheptsov
7cf8e5ada9 QSsl: add a new private API
This is an abstraction for TLS backend and its factory, preparing to transition
to plugin-based design.

Task-number: QTBUG-65922
Change-Id: Ibe810e77fd1b715a6bea66cd3f44312b015ac274
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-22 09:09:46 +01:00
Timur Pocheptsov
ee89f3a6e3 QSslSocket - introduce the API providing information about backends
This API gives the names of available backends and provides a basic
information about features/protocols supported by those backends.
Also, it has the 'loadBackend' functions which allow to select
a particular backend (which are becoming plugins).

At the moment, the implementation is still 'hardcoded', the
follow-up patch will allow to select different backends in runtime.

Task-number: QTBUG-65922
Change-Id: I05877de9c02857594e76b24d52e7578bdb01df69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-21 23:01:33 +01:00
Jonas Karlsson
509196b1d9 Add face support to texture file
Task-Id: QTBUG-76970
Change-Id: I3bbd43357c7fcce8949522b089a4572b948f08f4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-21 18:33:59 +01:00
Joerg Bornemann
d95a1a8bd4 Fix separately building SQL plugins with CMake 3.16
Also move the cmake_minimum_required call to the top of the file,
because the line before already requires some policy settings, which is
what cmake_minimum_required() is establishing.

For the standard Qt build, we make sure to get appropriate policy
settings by calling qt_internal_upgrade_cmake_policies().

Pick-to: 6.0
Change-Id: If97556a9dd00646e83957959d0f9f16916625160
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-01-21 16:18:40 +00:00
Andy Shaw
722a7dda56 SQLite: Update to 3.34.0
[ChangeLog][QtSQL][SQLite] Updated to 3.34.0

Fixes: QTBUG-90226
Pick-to: 6.0 5.15
Change-Id: I2a489bec1fee2bdee7ea474094ca3db308699753
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-21 17:06:21 +01:00
Edward Welbourne
d5eda37baa Hold references to zone IDs alive during use
Restore holding of a getID() call's return in a QJNIObjectPrivate
eliminated in commit 78cde1bfd94521bbe4972f31a79c959d0990ea77; this
keeps the Java internal object alive for its lifetime, where it might
otherwise be garbage-collected before we're done with it.

Fixes: QTBUG-88610
Pick-to: 5.15 6.0
Change-Id: Id65b059012f7bd3377a6562c1b647feb75a13679
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-01-21 17:03:47 +01:00
Fabian Kosmale
3861ec735e QProperty: Add private isAnyBindingEvaluating function
To optimize certain operations, it can be useful to know whether we are
currently evaluating a binding. For instance, we have properties whose
storage is only alloctaed on-demand when they are set. However, we would
also allocate them if they are used in a binding context, as we would
otherwise not properly track the dependency. Using
isAnyBindingEvaluating in the getter, we can detect this
situation, and avoid the allocation if it returns false.

This API is private for now, as it exposes some internals of the
property system and should be used with care. As it needs to access the
TLS variable, it also has a non-negligible cost.

Change-Id: I373aabee644fe7020b2ffba7d6a0ad9a1e1b4ec0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-21 17:00:29 +01:00
Eirik Aavitsland
6797506840 Gracefully reject requests for absurd font sizes
Avoid overflows.

Fixes: QTBUG-89899
Pick-to: 6.0 5.15 5.12
Change-Id: Ic1a83c1704fe20be3d032358dc91ee8e751f2281
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-01-21 14:40:42 +01:00
Christian Ehrlicher
b002c21087 QPushButton: fix drawing pushbutton with a menu
Drawing a QPushButton with a menu results in a clipped label text and a
wrong aligned decoration and menu button.
The position of the menu button was calculated wrong (spacing has to be
subtracted since the start position is the right side). Also the text
label alignment was done before it was adjusted for the menu button
which results in an unaligned (in constrast to a pushbutton without a
menu) label and decoration.

Fixes: QTBUG-89619
Change-Id: I872d39ff2d8eb685fe6843e38c7f727868e1ee9a
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Funning <huangyub@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-20 17:28:10 +01:00
Richard Moe Gustavsen
427e639275 iOS: ensure we close the edit menu when the user taps outside the input area
iOS used to close the edit menu automatically when
the user tapped on the screen (even for menus shown
explicitly using the UIMenuController API). Apperently
this has now changed (probably as a part of
[UIMenuController setMenuVisible:] being deprecated in
iOS 13). So we now need to hide it explicitly.

Because of this, we no longer close the edit menu if
the user taps outside the input area. This patch will
fix this by updating the logic in QIOSTapRecognizer to
close the menu explicitly.

There are some more details around when to show or hide
the menu, which is commented on at the relevant places
directly in the patch.

Pick-to: 6.0 5.15
Fixes: QTBUG-90332
Change-Id: I336e3f4003817b39c7abf63f963fde1f3ef87c20
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-20 16:52:21 +01:00
Richard Moe Gustavsen
2e35a03cd6 iOS: ensure we hide the edit menu while dragging on the selection handles
iOS used to close the edit menu automatically when
the user tapped on the screen (even for menus shown
explicitly using the UIMenuController API). Apperently
this has now changed (probably as a part of
[UIMenuController setMenuVisible:] being deprecated in
iOS 13). So we now need to hide it explicitly instead.

Because of this, the edit menu would be showing together
with the magnifier class while the user was dragging on
any of the handles. This patch will fix this, so that we
close the edit menu explicitly whenever the user starts
dragging on a handle.

Pick-to: 6.0 5.15
Fixes: QTBUG-80298
Change-Id: Iff2032d64db1b582fa7f048c6a1f37ec8a1528af
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-20 16:52:17 +01:00
Sergio Martins
61c3f3539c Make QStyle::proxy() always return the leaf proxy
For example:

  fusion -> proxy1 -> proxy2

Now returns proxy2.

Fixes: QTBUG-85556
Pick-to: 6.0 5.15
Change-Id: I2a60329f948b59ef7d0752d273bee3854a200547
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-20 15:35:46 +00:00
Mårten Nordheim
0875626e22 Long live QNetworkInformation
The plugins are meant to indicate what they do support, meaning users of
QNetworkInformation can choose to not care about which plugin is used
and rather just request what they want.

Task-number: QTBUG-86966
Change-Id: Ie130e1791250ec2a4470e3ba7081d982654af06c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-20 16:21:28 +01:00
Eirik Aavitsland
e1ed570f9d Rasterizer: compute intersection factors only when needed
Fixes oss-fuzz issue 29285

Pick-to: 6.0
Change-Id: I8f7e0bc898b119d153a36cef5a74371249ed7686
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2021-01-20 15:19:37 +01:00
Edward Welbourne
f9fff26b2d Fix QTzTimeZonePrivate::displayName()'s fallback
It previously fell back on abbreviation, a very poor choice.
The base class does better than that, so use its implementation instead.

Pick-to: 6.0
Change-Id: I47cbfce815cd8b2b533d9c6aeebcf398e5852d02
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-20 14:18:46 +00:00
Alexey Edelev
df788cca8b Generate Qt6EntryPointAdditionalTargetInfo independent of platform
Move AdditionalTargetInfo generation for EntryPoint target out of
WIN32 specific block

Fixes: QTBUG-90414
Change-Id: I8dc34c939f12ef2073de630d4440a0892d8be909
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 32734f351b076b8774c490c27ef18ddd2243dcaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-01-20 14:03:45 +00:00
Andy Shaw
15576c9610 iOS: Handle keyboard events when using an external keyboard
This enables the two possible approaches for handling external keyboard
events. While support still exists for before 13.4 then both approaches
are needed. This ensures that all external keyboard events are handled
as key events and passed on accordingly. Additionally, this accounts
for possible shortcuts too, therefore a new function is added to
QShortcutMap to aid that.

As a result, code has now moved from QCocoaKeyMapper to be part of the
gui/platforms/darwin part to make it easier to reuse this code
elsewhere.

Fixes: QTBUG-85727
Change-Id: I349af43468b03fd8dcb16adba02669974affe154
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-20 12:29:38 +01:00
Pekka Gehör
a5bb7b3ca5 [Android] Fix Text select handle misplaced on fields inside QDialog issues
Get cursorPoint from a mapToGlobal with a cursorRectangle of the selected inputMethod

Fixes: QTBUG-65229
Fixes: QTBUG-58503
Pick-to: 6.0 5.15
Change-Id: I89b056fa91c59d260f02164c9bd6672b5ada64d6
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-01-20 08:23:26 +00:00
Giuseppe D'Angelo
ca211da2fa QLocale: add a Q_CHECK_PTR
Avoid complaints from static analyzers that the pointer returned
by malloc might be null.

Change-Id: I3ec3ba03d0b5283dd569200a3040a5fe5990f763
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-20 08:36:00 +01:00
Giuseppe D'Angelo
e1a810c046 QVLA: add a Q_ASSERT
GCC's -fanalyzer complains that `ptr` might be null. It's actually
never null (by class invariant).

Change-Id: I5660b1e766b2cfde3f042b8e87168987e7618591
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-20 08:35:59 +01:00
Eskil Abrahamsen Blomfeldt
d939faeaae Remove debug output
Accidentally committed in d8602ce58b.

Change-Id: I553503720eace59a7bd510a7b9b2aba44c2242a1
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-20 08:33:19 +01:00
Eirik Aavitsland
96e9c8cc8a Correct item indent in checkable menus in stylesheet style
Not only the checkable items need to be indented, but all items in the
same menu, so that they line up.

Pick-to: 6.0 5.15
Fixes: QTBUG-90242
Change-Id: I559005f753b5cd19eaeeeb6658178d62de93b4ef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-20 07:38:50 +01:00
Cameron Gutman
c111aad270 QSsl: fix OpenSSL DLL names for Windows on ARM
OpenSSL adds an '-arm'/'-arm64' suffix to the DLL names when building
for VC-WIN32-ARM or VC-WIN64-ARM. This needs to be accounted for in Qt
to find the OpenSSL DLLs correctly.

Fixes: QTBUG-89647
Pick-to: 5.15
Change-Id: Ibc9b81e06f8e64c0676f335e13024fa7fe3a4fa3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-19 18:09:23 -06:00
Morten Johan Sørvig
fded886ff4 macOS: Remove DontConfirmOverwrite workaround
Does not work any more on recent macOS versions.

As a bonus, Qt now handles file names which contain
“___qt_very_unlikely_prefix_” correctly.

Pick-to: 5.15 6.0
Task-number: QTBUG-39791
Change-Id: I944a68efa18edc72939d953ab32ecb53d8f8e1c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-19 23:41:42 +00:00
Thiago Macieira
9c56d4da2f Fix build with GCC 11: include <limits>
Fixes: QTBUG-90395
Pick-to: 6.0
Change-Id: Iecc74d2000eb40dfbe7bfffd165b5dd3708b7a40
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-19 14:13:08 -08:00
Giuseppe D'Angelo
790b600840 Mark qBadAlloc as [[noreturn]]
So that static analyzers don't get confused by its semantics.
In builds with exceptions disabled, it's not actually called
by client code (e.g. Q_CHECK_PTR will just terminate in that case),
but we still need to make it not return -- add another path that
callss std::terminate(), otherwise we'd have a noreturn function
returning.

Change-Id: Ia8c4ce3e9d971f1757e9c273051cb3dedf23c61f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-19 22:35:17 +01:00
Ville Voutilainen
813a928c7c Build fixes for GCC 11
Task-number: QTBUG-89977
Change-Id: Ic1b7ddbffb8a0a00f8c621d09a868f1d94a52c21
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-19 22:33:38 +02:00
Bartlomiej Moskal
0d5b43bed4 Android: Finish composing text before Key handling
If the sendKeyEvent was invoked, it means that the button not related
with composing text was used. In such case composing text (if it exists)
should be immediately finished.

Fixes: QTBUG-85715
Pick-to: 5.15 6.0
Change-Id: Ifbca067805b8d20f6a90f95b27210595abed964a
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-01-19 19:37:02 +01:00
Assam Boudjelthia
eb6e65e64a Update QOperatingSystemVersion version names for Android
Change-Id: I88c7713cd75f84d11b303e0dad2093c7d5568bc4
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-19 20:10:42 +02:00
Nicolas Fella
9b2df27bb3 Add missing since to QEvent::copy docs
Pick-to: 6.0
Change-Id: Idfadc1801b0e97a5030d2784a65ae658900efd12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-19 19:10:42 +01:00
Sophie Kums
aa09bea00c control scrolling of QTabBar using StyleHint
Mouse wheel/touchpad scroll signals sent to the tab bar trigger
cycling through the tabs. In applications where the tab bar is
close to "mouse click hotspots", the cursor may accidentally be
left over the tab bar instead of the main content of the window.
When the user wants to scroll up/down the main conten, the
scroll signals are thus sent to the tab bar and instead of
scrolling, the focus switches to another tab. This is
confusing to the user, because not only does the application
not carry out the desired action (scrolling through the main
content), it jumps to a different tab. Two common examples of
applications affected by this nuisance are Konsole and any kind
of browser (file browser or web browser), where the address bar
is right below the tab bar. Moreover, on macOS, scroll events
do not have an effect on the tab bar widget of the native UI.
Currently, the code makes use of preprocessor directives to
achieve consistent behavior on macOS (`#ifndef Q_OS_MAC`). This
patch implements the check of a StyleHint in order to determine
if scroll events on the tabbar should have an effect. This
approach is more consistent with Qt coding style than
OS-dependent preprocessor directives and, in addition, makes
the behavior configurable according to the user's preferences.

[ChangeLog][QtWidgets][QStyle] Added
SH_TabBar_AllowWheelScrolling as a style hint to enable/disable
cycling through tabs using the scroll wheel. This defaults to
true in all styles except the macOS one so there is no change in
existing behavior.

Change-Id: I99eeb5a1aab03cbc574fac7187d85a8a2d60cf34
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-19 19:10:41 +01:00
Alexey Edelev
65cc6ec16b Adjust sql drivers documentation to cmake
Update sql drivers build procedure description.

Fixes: QTBUG-89782
Change-Id: I152fad108e24d394c8d21adf95ce6dbd6e7d80bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-19 19:10:41 +01:00
Friedemann Kleint
341b0ef501 Windows QPA: Fix blurry title icons with fractional scale factor
Request the icon pixmaps with DPR=1.

Fixes: QTBUG-90363
Change-Id: I789a72e2ed3379c81c68e1074069823bf633cf2f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-19 14:17:55 +01:00
Alexey Edelev
fd5006eb48 Fix qt_add_big_resources with namespace builds
Add INTERFACE_COMPILE_DEFINITIONS of Qt6::Core to generated rcc object
libraries. This propagates QT_NAMESPACE definition to the object
library.

Fixes: QTBUG-85620
Change-Id: I252d1aaee7b19a49bc321fdd271a5d85a34bf67f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-01-19 14:17:55 +01:00
Laszlo Agocs
43d379797a vkmemalloc: Silence clang warning about unused member var
Change-Id: Id968fd2302e3ff7b4d1a20cd8dd1f4d789588511
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-19 13:17:55 +00:00
Laszlo Agocs
c6d6029909 Update QVulkan(Device)Functions to Vulkan 1.2
This also needs improvements to qvkgen. What we get with this patch
are the Vulkan 1.1 and 1.2 core API's additional 11 instance-level
and 30 device-level commands present in QVulkanFunctions and
QVulkanDeviceFunctions.

All of these are attempted to be resolved upon construction. When the
implementation does not return a valid function pointer for some of them
(e.g. because it is a Vulkan 1.0 instance or physical device), calling
the corresponding wrapper functions will lead to unspecified behavior.
This is in line with how QOpenGLExtraFunctions works. The simple
autotest added to exercise some Vulkan 1.1 APIs demonstrates this in
action.

The member functions in the generated qvulkan(device)functions header
and source files are ifdefed by VK_VERSION_1_{0,1,2}. This is essential
because otherwise a Qt build made on a system with Vulkan 1.2
headers would cause compilation breaks in application build environments
with Vulkan 1.0/1.1 headers when including qvulkanfunctions.h (due to
missing the 1.1/1.2 types and constants, some of which are used in the
function prototypes). In practice this should be alright - the only
caveat to keep in mind is that the Qt builds meant to be distributed
to a wide variety of systems need to be made with a sufficiently new
version of the Vulkan headers installed, just to ensure that the
1.1 and 1.2 wrapper functions are compiled into the Qt libraries.

Task-number: QTBUG-90219
Change-Id: I48360a8a2e915d2709fe82993f65e99b2ccd5d53
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-19 14:17:55 +01:00
Christian Ehrlicher
12d8bb0709 ItemViews: Don't remove items on internal move
When an itemview only allows internal moving of items it can happen that
the target accepts the drag'n'drop operation since it's out of the
control of Qt (e.g. Recycle Bin or an other application). Due to the
nature of a move, the original item is deleted. Therefore check if the
internal move target is the same as the source and don't delete it
otherwse.

Fixes: QTBUG-86020
Pick-to: 6.0
Change-Id: I69de4b8d76d1b0f57338b402aee87580226cd6cb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-18 19:51:07 +01:00
Edward Welbourne
6ee13db700 Correct string comparison in Android's IANA ID matching code
It used QString.compare() and assumed it was returning a bool true on
equality, when it actually returns an int that compares to 0 as the
given strings compare. So it should use compare() == 0.

This fixes several of QTimeZone's blacklisted tests on Android and a
crasher, which we dodged with a QSKIP. Added an id-comparison to a
test. Gave two local variables more informative names, made an early
return into a QSKIP so it explains itself.

Fixes: QTBUG-89905
Fixes: QTBUG-69122
Fixes: QTBUG-69132
Fixes: QTBUG-87435
Pick-to: 6.0 5.15
Change-Id: Icf18ed5a810143d6e65d36e34a70e82faac10b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-01-18 15:55:15 +01:00
Edward Welbourne
50c63446f5 Fix problems with offset-derived ids for QTimeZone
When creating a time-zone from a UTC+offset name that isn't known to
the system, QTimeZone (since the fix to QTBUG-77738 in 5.15.0) falls
back to constructing a suitable UTC-offset backend; however, the id of
this is not guaranteed to match the id passed in to the constructor.
In all other cases, the id of a QTimeZone does match the id passed to
its constructor.

Some utcOffsetId testcases had different id() than the id passed to
the constructor, due to mismatches where a zone was constructed using
the fall-back but the generated id included its minutes (as :00) or
omitted its seconds. The omission of seconds is clearly a bug, but we
also don't want to include :00 for seconds when it's not needed. So
change QTimeZonePrivate::isoOffsetFormat() to accept a
QTimeZone::NameType to configure how much we include in an id. Its
callers other than the relevant constructor (from offset) still get
minutes, even when :00, but will also get seconds added if that isn't
zero; and the constructor from offset now gets the short form obtained
by omitting all trailing zeros.

Since all valid whole-hour offset names that do include :00 for the
minutes field are in fact known standard offset names, the elision of
minutes will only affect zones created by ID in the case of a
whole-hour offset given without :00 minutes specifier, so these shall
necessarily in fact get the ID passed to the constructor. Creating by
UTC-offset with a name that specifies zero seconds will result in a
QTimeZone instance whose id() differs from what was passed to its
constructor (eliding the :00 seconds and potentially also minutes, if
also zero) but this should be the only case where a QTimeZone's id
doesn't match the one passed to the constructor, when constructed by
id.

Fixed inconsistency between the offset-constructor's declaration
(taking offset as int) and definition (taking qint32) in the process.
Added an id check to the utcOffsetId() testcase. Amended two tests of
offset-derived time-zones' IDs, added comments to make clear how one
of those differs from a matching standard name test and converted two
uses of QCOMPARE(, true) to QVERIFY().

[ChangeLog][QtCore][QTimeZone] QTimeZone instances created by offset
from UTC (in seconds) shall now only include minutes in their ID when
the offset is not a whole number of hours. They shall also include the
seconds in their ID when the offset is not a whole number of minutes.

Pick-to: 6.0 5.15
Task-number: QTBUG-87435
Change-Id: I610e0a78e2aca51e12bfe003497434a998e93dc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-18 15:55:05 +01:00
Andrei Golubev
6f520abdab Add new special QObjectPrivate::{connect, disconnect} for QML
Original QML-specific connection mechanism ignores the receiver argument
and uses sender as receiver. This causes uncontrollable memory growth
in certain cases as connections on receiver persist even after receiver
is destroyed

New connect() with receiver parameter uses underlying API correctly,
disconnect is provided for the symmetry (not sure it's really needed)

Task-number: QTBUG-86368
Pick-to: 5.15 6.0
Change-Id: I4580d75b617cb2c4dfb971a4dfb8e943e325572b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-18 15:54:03 +01:00
Giuseppe D'Angelo
5a0e5521e4 QVectorND: make some constructors explicit
QVector2D has implicit conversions towards QVector3D/4D, and
QVector3D has an implicit conversion towards QVector4D. Although
in principle this is fine because it's not a data loss, it's still
sketchy; for instance, it allows mixed operations to compile:

  vector2d + vector3d;
  vector4d - vector3d;
  vector3d * vector4d; // !

(Random observation: the conversion from QPoint(F) to QVectorND are
actually already marked as explicit.)

This is a leftover not done for Qt 6.0. I am not making these opt-out:
having an implicit conversion here is outright *dangerous*, and any usage
that fails to compile needs to be inspected to make sure it was the
intended behavior.

[ChangeLog][Potentially Source-Incompatible Changes] The
QVector2D/3D/4D converting constructors from another QVectorND
now explicit. This was done to prevent a category of bugs resulting
from operations accidentally mixing QVectorND objects.

Fixes: QTBUG-90327
Change-Id: Ifcd873f6a0d3fc10b9e68c935fe1f69f86a2340b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-18 14:53:24 +00:00
Kai Köhne
f1465c621c QLocale: Allow direct conversion to language, country, and script codes
Currently the codes are only exposed in aggregated form, i.e. through
name(), bcp47Name(). There are use cases though where you are only
interested in either language, country, or script codes. One example
is in Qt Linguist.

This patch therefore exposes the static languageToCode(),
countryToCode(), scriptToCode() methods that were so far only available
in the private API also in the public API.

[ChangeLog][QtCore][QLocale] Added static languageToCode(),
countryToCode() scriptToCode() methods that convert enum values
to the respective ISO code strings.

Fixes: QTBUG-39542
Fixes: QTBUG-64942
Change-Id: Ib1d5c3293e2f53245ba4c1fc8159275bcb290080
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-18 15:52:31 +01:00
Fabian Kosmale
2d8757f879 QVariant::fromValue<T>: require T to be copy constructible
In Qt 5, QVariant::fromValue<T> would not compile unless
Q_DECLARE_METATYPE(T) was used, and Q_DECLARE_METATYPE(T) would lead to
a compile error if T were not copy constructible.
In Qt 6, we do not require Q_DECLARE_METATYPE before using fromValue,
and QMetaType itself works with non-copy constructible types just fine.
However, QVariant still requires it, thus we need to now enforce this in
fromValue itself.

Change-Id: Ib6964a438d8c46033dd3a037b9d871de2b42e175
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-18 15:51:18 +01:00
Fabian Kosmale
ec12c30249 QUntypedBindable: Add documentation
Task-number: QTBUG-89505
Change-Id: I4428c3c0eb723e996195f6f6f5ac736757cea33e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-18 15:51:17 +01:00
Oliver Eftevaag
3cb2b5bfe3 Fix small typo in the QMdiArea documentation
Added missing whitespace character in the documentation for QMdiArea,
in the 'detailed explanation' section.

Pick-to: 6.0
Change-Id: I6be1d664bc15e3e461c5fc3d8f82311cc6ea60ea
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-01-18 13:21:15 +01:00
Eskil Abrahamsen Blomfeldt
914a43d8aa macOS: Fix assert with Freetype engine
d8602ce58b removed the internal usage
of the singular fontDef.family, changing this to fontDef.families.first()
instead, which will assert if the families list is empty. To match
old behavior, we set the symbol flag to false if there is no family
name.

Change-Id: I594cf3dfa2798e60b37dc525c172fb2cd9aa7380
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-18 13:21:15 +01:00
Joerg Bornemann
b0add5bf2f QtEntryPoint: Fix linking Release against RelWithDebInfo with MSVC
To be able to link a Release user project against a RelWithDebInfo Qt we
set several IMPORTED_*_RELEASE properties in
the *AdditionalTargetInfo.cmake file of each Qt module.

The EntryPoint module however is a bit special as it is an
INTERFACE_LIBRARY linking publicly against a static
library (EntryPointimplementation). Its *AdditionalTargetInfo.cmake file
was almost empty, because qt_internal_export_additional_targets_file was
called before EntryPointImplementation was set up. Also,
qt_internal_add_module, which calls
qt_internal_export_additional_targets_file, does not know that we want
to export the EntryPointImplementation target.

We fix this by telling qt_internal_add_module(EntryPoint) to not
generate the *AdditionalTargetInfo.cmake file and call
qt_internal_export_additional_targets_file later to take the targets
EntryPoint and EntryPointImplementation into consideration.

qt_internal_add_module learned the option NO_ADDITIONAL_TARGET_INFO to
turn off the generation of *AdditionalTargetInfo.cmake files.

Pick-to: 6.0
Fixes: QTBUG-90039
Change-Id: I68ec7125b538a57567035e7adb8dac3b213f95e6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-18 13:21:15 +01:00
Laszlo Agocs
9f7088fd7f rhi: Stop hardcoding the Vulkan backend's desired instance extensions
Instead, have a static function in QRhiVulkanInitParams then Qt Quick
and anyone else who creates a QVulkanInstance that is then used in
combination with QRhi can query.

Change-Id: I046e0d84541fc00f5487a7527c97be262221527f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-18 13:21:15 +01:00
Laszlo Agocs
036021b0d0 Add qvkgen header template to its own file
...instead of referencing the removed qtbase/header.LGPL.

Amends 9ac8b9c92e

Fixes: QTBUG-90329
Change-Id: Ic46e0adeef51f7bfcf445185c0ab5431df39bce6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-18 13:21:15 +01:00
Laszlo Agocs
7d378bd780 vulkan: Add instance-level version getter
...as described in the Vulkan >= 1.1 spec. One can now call
supportedApiVersion() (before create(), similarly to the other
supported* functions) to determine the available Vulkan
(instance-level) version.

Fixes: QTBUG-90333
Change-Id: Ibe8482402b7f07e4abc48c88252ff0365e4e2faa
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-18 13:21:15 +01:00
Laszlo Agocs
9573441236 eglfs: Use drmClose in drm/EGLDevice backend
Pick-to: 6.0 5.15
Fixes: QTBUG-90350
Change-Id: I29a71e4abc2df7b777a895792bc5385a89223895
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-18 13:21:15 +01:00
Craig Scott
b59f77aab4 FindLibb2: Don't rely solely on pkg-config
Task-number: QTBUG-86283
Change-Id: Ie455d7cfc6e6f9ae8297f8bc0daf2816ccce91b6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-18 15:42:52 +11:00
Andrei Golubev
b101f84f86 Add "Q_UNUSED" to (3rdparty) strtod.cc for a 32 bit code path
Accidentally stepped on this thing. Cannot build Qt Core on 32-bit
Ubuntu 16 without this patch.

Fixes: QTBUG-90354
Pick-to: 6.0 5.15
Change-Id: Iab5b2a317ee18b537b416eff008db29932fc043b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-17 22:27:46 +01:00
Giuseppe D'Angelo
d09a0e485d QMatrix4x4: mark it as Q_PRIMITIVE_TYPE
My guess: it was relocatable because before 6.0/5.15 we didn't
call constructors for Q_PRIMITIVE_TYPEs.

Change-Id: Ibc9e23e41d0c4b9718fc7036d9a647cfdcfa7d47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-17 19:25:53 +01:00
Christian Ehrlicher
09696e3325 QHeaderView: fix moving sections with mouse in RTL mode
Moving sections in RTL mode did not work correctly - in contrast to LTR
mode the secion must be moved much further to the left or right to
actually move it.
Found while implementing an indicator for QTBUG-673

Task-number: QTBUG-673
Change-Id: I5a82d3cdb39415a408b2884d0ee302e0547e884f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-17 13:57:50 +01:00
Allan Sandfeld Jensen
cfd935fe6c Fix XCB launch key mapping
They have been reported wrong since Qt 4, and not fixed for behavior
compatibility, fixing it for Qt 6.

[ChangeLog][X11] XF86LaunchXX keys have been remapped, so the Qt names
and X11 names match, instead of being 2 off.

Pick-to: 6.0
Fixes: QTBUG-25261
Change-Id: Ie3a8676439ae3e93a78218c9e7f4443565e84356
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2021-01-15 22:28:21 +00:00
Allan Sandfeld Jensen
2cf2f99ab1 Get rid of blend_color_rgb16
The generic functions are better optimized anyway, and it this old
method appears to have old bugs.

Fixes: QTBUG-20681
Change-Id: I60e4cc5f6cd90c851e90106ac9badfc6c249cd9f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-15 19:45:04 +01:00
Christian Ehrlicher
c23e8cb582 QSettings: Add support for QMetaType::Float
When writing out a float value, the output string is encoded as QVariant
for no reason. Looks like an oversight when QMetaType::Float was added a
long time ago.

Fixes: QTBUG-21156
Change-Id: I7f5d31e15892d700c1b1e5e731b7733ce3a15730
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-01-15 18:51:15 +01:00
Friedemann Kleint
539553a572 QTestlib/JUnit XML: Log most messages to standard output instead of error output
Add an enumeration for system-out and alog element
for it. Redirect the messages types that are not warnings/errors
to this element. For compatibility, write it out only
if it is not empty. Rename enumerations and members accordingly.

[ChangeLog][QtTestLib] In JUnit XML, output that is
not a warning/error is now logged under <system-out>
instead of <system-err>.

Fixes: QTBUG-86540
Change-Id: I55598eafa7dafa486ac5a8221029c332ff47413b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-15 18:05:40 +01:00
Friedemann Kleint
7f5d41e286 Windows: Fix dialog moving up after closing/reshowing
A resize event delivered after closing the platform window
was causing the stored frame margins to be cleared.
Bail out of QWidgetWindow::updateMargins() if the
platform window is null.

Pick-to: 5.15
Fixes: QTBUG-79147
Change-Id: Iebbc90c3cccafa209cd720baedf45affb3f3c2b8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-15 18:05:19 +01:00
Jarek Kobus
98a89fb711 Hardcode a special case of using qOverload for slots without arguments
Pick-to: 6.0
Fixes: QTBUG-90308
Change-Id: I35cd45679ded626654dd0e7e3eea8a7bb14c1d56
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-01-15 17:39:46 +01:00
Morten Johan Sørvig
9cd3ff2bde macOS: Mark QFileDialog::DontConfirmOverwrite as unsupported
The native NSSavePanel does not have an option corresponding
to DontConfirmOverwrite. Qt has a workaround where
the save-file-name is temporarily given a prefix in
order do bypass the overwrite check, however this has
stopped working on recent versions of macOS. (Confirmed
on macOS 11)

Users who want to use DontConfirmOverwrite should use
Qt’s file dialog instead.

Fixes: QTBUG-39791
Pick-to: 5.15 6.0
Change-Id: Id3b9e6de72c2afc9526c96f1d9fdbce78db92aeb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-15 15:19:24 +00:00
Edward Welbourne
b2a3389cfe Extend qIsInf() and friends to handle integral types sensibly
[ChangeLog][QtCore] qIsInf(), qIsNaN() and qIsFinite() now, like
std::isinf() and friends, accept integral types (returning false,
false and true, respectively) as well as floating-point ones.

Change-Id: I1e2b7f033f0e8166c0b21e31a62b3e6d37b9344a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-15 16:00:40 +01:00
Sona Kurazyan
154573929a Fix setting active window as application's focus widget
When setting the application's focus widget we search for the next
child widget that can hold the focus and call its setFocus() method,
which also updates focus widgets of all its parent wigets.

In case if the focus widget is the active window itself, we only set it
as the application's focus widget, but we don't update the focus widget
of the active window itself. Because of this the focusWidget() method
always results nullptr for the active window. This prevents from setting
the focus back to active window after the focus has changed (for example
after a context menu is closed, as in the bugreport).

Transfer the focus to active window by calling the setFocus() method, as
it is done in case of transferring the focus to any other widget.

Pick-to: 6.0 5.15
Fixes: QTBUG-85846
Change-Id: I91ebf182fd5bb7d451a1186e2f3e38c8d48acc4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-15 15:22:18 +01:00
Laszlo Agocs
b5ce973b29 Document QOpenGLWidget limitations without an alpha channel
Pick-to: 6.0 5.15
Task-number: QTBUG-85869
Change-Id: I20fb70a451fc1ed93089ed699539fa12ac38fe73
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-15 15:21:28 +01:00
Laszlo Agocs
2aa7ad5e67 qvkgen: Skip command elements with alias
Otherwise we end up with generating broken qvulkanfunctions cpp and h
files.

For example, encountering the following command element should lead to
taking no action, this is not something we want to emit a corresponding
wrapper function for:
  <command name="vkResetQueryPoolEXT" alias="vkResetQueryPool"/>

This is required to be able to upgrade the bundled vk.xml to something
newer.

Fixes: QTBUG-90330
Task-number: QTBUG-90219
Change-Id: Ie6e3a8794207e30a172820eb055238bf52a0c0b9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-15 15:21:15 +01:00
Allan Sandfeld Jensen
ade24763c7 Fix convertToRGBA64PM for Grayscale16
The input has been fetch into a set of uint32s, so no longer a
string of ushorts.

Pick-to: 6.0 5.15
Fixes: QTBUG-90246
Change-Id: Id52a6824317b0744310008cc2ce2f726539b4c8c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-15 15:17:19 +01:00
Kai Köhne
ccce1a4e90 RHI: Use QT_BEGIN_LICENSE:LGPL header
Task-number: QTBUG-90321
Pick-to: 6.0
Change-Id: If3b0841f3e9139bb1911c6a5d03a16daf8c1b3d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-01-15 14:14:32 +00:00
Paul Wicking
efa5a69972 Doc: Clarify setLibraryPaths behavior
Fixes: QTBUG-89130
Pick-to: 6.0 5.15
Change-Id: Id8460fd00dcfdcca174d523f8d97baef1a764f6f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-01-15 15:14:31 +01:00
Craig Scott
257edbfa53 Prevent compiler and linker flags from growing every cmake run
Functions in QtFlagHandlingHelpers.cmake try to update the CMake cache
variables for compiler and linker flags. These were using the current
value of those variables and writing the modified ones back to the
cache every time CMake ran. If a toolchain file sets or modifies any of
these variables, that updated value is used and written back into the
cache instead of the original cache variable's value. The next time
CMake executes, the toolchain file re-applies the same change and the
variable grows longer each time with flags repeated. With Ninja, this
causes a complete rebuild every time CMake is re-run. The Android NDK
toolchain file is one example where this behavior is triggered (the
fault is shared, one could argue that the NDK should only be setting
..._INIT variables, but that's out of our control).

Another related bug in the previous implementation was that the flags
used to build after the first CMake execution could be different to
those used for all builds after the second and later CMake runs. This
is because the CMake cache was being updated, but not always the
calling scope of the functions that modified them. If a toolchain file
set any of the compiler or linker flag variables as non-cache
variables, then updating the cache variable would have no effect on
the calling scope. The non-cache variable would continue to take
precedence for that scope for that run. The next time CMake executes
though, the updated cache variable would now have been used by the
toolchain file and the change *will* be part of the non-cache
variable's value.

The above are examples of why you should try to avoid updating these
cache variables from project code. We could leave the cache alone and
always update only non-cache variables, but then a developer looking
at the cache may wonder why the values they see there don't match the
values being used in builds. Or worse, they think the cache values
are being used and don't realize the builds are using something
different. Ultimately, we have to choose which downside we are happy
to live with. The changes here preserve the previous intent of
updating the cache, but it's still a bit fragile.

Fixes: QTBUG-89821
Task-number: QTBUG-85992
Task-number: QTBUG-86866
Change-Id: I8a16753e159bde338e6d2e5dd2ce91fc8ac5c39d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-15 22:26:41 +11:00
Laszlo Agocs
77350b7a71 Update vkmemalloc to 2.3.0
Task-number: QTBUG-90219
Change-Id: I382f59edbc869fd4f3557411264f290e9fd5dee5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-15 12:26:41 +01:00
Qiang Li
3f3d5e6716 Fix the tips still show when cursor move to another action
In this case, the previous action's tip is still displayed
when the cursor moves from one action with tip to another action
without tip.

Fixes: QTBUG-89082
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I0a00595dc3d716725678487be9cbb363c4d3b392
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-15 12:26:41 +01:00
Joerg Bornemann
baff03d3d4 Doc: Document the qt_no_entrypoint target property
Fixes: QTBUG-90031
Change-Id: Ib3e7e9d966ee64f97fdd3df48b3fa5325d19cc6c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-15 12:26:41 +01:00
Friedemann Kleint
f3251bcb87 QTabBar/Windows: Fix close button icons being too small on high-res screens
Add 32x32 versions. Move the icon creation to a helper function.

Fixes: QTBUG-88230
Pick-to: 6.0
Pick-to: 5.15
Change-Id: I6dda2084e0122234eacea17ac191a19f6855f466
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-01-15 12:26:40 +01:00
ChunLin Wang
dafd26acbe Fix QApplication::font returns the font unstable according to the object
If a default font was not registered for the widget's class, it returns the default font of its nearest registered superclass.

Fixes: QTBUG-89910
Pick-to: 5.15 6.0
Change-Id: I6e6b2c6a0044462f84db9f76a03be0c6cfaaae8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-15 14:38:35 +08:00
Ralf Habacker
ab2c61e638 If available, use a version-specific qt<major-version>.conf
To enable the current Qt version to use a qt.conf that is independent
from the previous version, a file named 'qt<major-version>.conf' is
searched for first. If this file does not exist, a file with the
name 'qt.conf' is searched for.

Task-number: QTBUG-88635
Change-Id: If75b63f72a7bdbdf1de7729ea4ecb00810b58d12
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-14 23:30:47 +01:00
Andy Shaw
4d3d981144 Interbase: Don't error out if closing an already closed cursor
Pick-to: 6.0 5.15
Change-Id: If6964f5ae45c5ca4c0b34e417326fea1f33d7628
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-14 19:53:16 +00:00
Ivan Solovev
00505ed2b5 Widgets: fix setTabOrder for QAbstractSpinBox-like widgets
setTabOrder was not considering the case, when a child widget has
its focus proxy set to its parent widget. This happens, for example,
for the QLineEdit that is nested inside the QAbstractSpinBox.
For such cases the lastFocusChild was calculated incorrectly, and, as
a result, such child widgets were not correctly positioned in the
focus chain. This could lead to an error while backtabbing.

Here is a brief example. Suppose we have 3 widgets arranged like this:

auto spinBoxOne = new QDoubleSpinBox;
auto spinBoxTwo = new QDoubleSpinBox;
auto button = new QPushButton;

Then the default widget focus order is:
- spinBoxOne
- lineedit (from spinBoxOne)
- spinBoxTwo
- lineedit (from spinBoxTwo)
- button

Before this commit setting the explicit tab order changed the focus
order in the following way:

QWidget::setTabOrder(spinBoxOne, spinBoxTwo);
QWidget::setTabOrder(spinBoxTwo, button);

- spinBoxOne
- spinBoxTwo
- button
- lineedit (from spinBoxOne)
- lineedit (from spinBoxTwo)

In this case, backtabbing from spinBoxOne actually leads us to
lineedit (from spinBoxTwo), which refers to spinBoxTwo.
And so we're stuck in a loop.

This commit fixes the issue by handling such special case, and
preserving correct focus order.

Note: the actual unit-test in this patch uses QLineEdit instead of
QPushButton, because one can't tab to buttons on macOS by default.
However the general idea is the same.

Pick-to: 6.0 5.15
Fixes: QTBUG-81097
Change-Id: I5d16da7733a4d63f809cab28b8ca9e116b87cffa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-14 20:09:43 +01:00
Shawn Rutledge
aeeac48cbd AA_SynthesizeTouchForUnhandledMouseEvents: keep correct coordinates
QGuiApplicationPrivate::processMouseEvent() sends a
QWindowSystemInterfacePrivate::TouchEvent if the mouse event is not
accepted and AA_SynthesizeTouchForUnhandledMouseEvents is enabled.
A QPA TouchEvent always contains native touch points, which is why
it calls QWindowSystemInterfacePrivate::fromNativeTouchPoints to
translate the QMouseEvent's device-independent position back to the
raw position that it would have had if it came from a real touchscreen.
Therefore we must give that function touchpoints that are actually in
native coordinates.

It may be that some of this transformation could be avoided entirely,
but here we prove that the existing way works correctly, by adding
coordinate checking to the tst_QWindow::mouseToTouchTranslation() test.

Pick-to: 6.0
Task-number: QTBUG-86165
Change-Id: I4c9ca2b11e9eb76d79712c187db3eb9865da581a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-14 19:09:28 +00:00
Christian Ehrlicher
e9ccdf4d84 QPushButton/fusion style: don't ignore QIcon::On icon
The fusion style did ignore the QIcon::On icon because it reset State_On
to avoid the visual shift of a pressed button.
But it's not needed to reset this flag - the shift does not happen
because the fusion style does return 0 as offset for
PM_ButtonShiftHorizontal/PM_ButtonShiftVertical so no shifting will
happen.

Fixes: QTBUG-86736
Fixes: QTBUG-82110
Change-Id: Ie2aaddb14bc67874f5a9a23d9f04d7a08c6d070f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-14 19:09:13 +00:00
Allan Sandfeld Jensen
92ed274475 Add API for creating QColorSpace with multiple color-transfer tables
One table per color channel, as is possible from many inputs.

Change-Id: I9fc723c68f222a228dd2b1458207b028422913bf
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-14 11:05:22 +01:00
Alexander Volkov
cefef116ef Disable copying of QUrlResourceProvider to avoid slicing
Amends 376e3bd8ec

Change-Id: Ib7b0de900c009f3bdb3f699a218444aafbe2eabe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-14 13:01:57 +03:00
Mårten Nordheim
d2e2d0d3a6 QCache: when overwriting, store the new cost instead of the delta
The delta was clearly intended to be used on the total (and still is)
but it also wound up getting stored in the cache, which wouldn't be a
big problem unless the object was removed, in which case we could
incidentally 'free up more space' than intended.

Pick-to: 6.0
Change-Id: Ib2b0f072d30da6d16a93dce60e4c5f6080c109fc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-14 10:00:01 +00:00
Lu Zhen
cb4f853cb0 Add some error handling for the inotify file system watcher
In the readFromInotify() function, add a check whether
the ioctl function is successful or not. In the case of
failure, continuing to execute the following code would cause
errors in the read function because there is no data in the buffer.

Change-Id: Id53037e9e48c97c9eb75835048143875275b6370
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-14 09:47:07 +00:00
Andy Shaw
c2657f9762 QODBC: Preserve the whole value when using HighPrecision
Some ODBC drivers do not properly handle SQL_NO_DATA and therefore
decimal values returned with HighPrecision are cut off because the
decimal point is not taken into account.

Fixes: QTBUG-73286
Pick-to: 6.0 5.15 5.12
Change-Id: I905c947b4d0266a3245d5735300300ca00f77480
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2021-01-14 07:02:43 +00:00
Christian Ehrlicher
1bcfada9f0 QStyle: add name() to return the name of the style
Currently there is no way to get the name of the current style to e.g.
create a QProxyStyle for a specific widget only.
Therefore add QStyle::name() so QProxyStyle(const QString &) can be
called without hard-coding the style name.
Remove an unused doc snippet as drive-by.

Fixes: QTBUG-8004
Change-Id: I466c5e870a5392b238365bdc930f6a2ecee50cdb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-01-14 05:43:14 +00:00
Allan Sandfeld Jensen
47c6b5b91e Fix VNC format conversion
Pass the right from depth to the conversion function, and
set the right format before creating the compositor image
for RGB16 support.

Pick-to: 6.0 5.15
Fixes: QTBUG-85621
Change-Id: I76f46a3c2d8f1d2b040b790035dbdb0a960ff1a7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-01-13 22:22:29 +01:00
Jan Arve Sæther
583668005d a11y: Do not cache classes that don't have a factory plugin
For Qt Widgets we thought it was a good idea to also store in the cache
if a class didn't have a factory plugin. This worked fine there, since
the number of QWidget classnames is quite limited (so the factory plugin
cache will soon reach a limit)

In QML however, classes are often suffixed with e.g. Button_QMLTYPE_123,
Button_QMLTYPE_124 etc.
This number suffix is just increased continuously. This could lead to that
the factory plugin cache will grow ad infinitum, which will cause
"memory leaks" in addition to a performance penalty.

Pick-to: 6.0
Pick-to: 5.15
Fixes: QTBUG-75106
Change-Id: I9ba189f989f0b90ab62a2c54a2e9230236a998d8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-13 19:33:08 +00:00
Christophe Giboudeaux
2d4a40f93f CMake: Fix build with GCC and ltcg
The porting script could not handle this special case.
To achieve the same thing, we'll use an intermediate 'OBJECT' library
which will get the '-fno-lto' build flag if the conditions are met.

Fixes: QTBUG-89426
Pick-to: 6.0
Change-Id: Ied62502ce9c7f7fd6b89fab166f7bccfcd6e7433
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-13 18:04:16 +01:00
Christian Ehrlicher
b3b28faf26 QComboBox: fix select all columns in the view
When the QComboBox gets a custom view with multiple columns, only the
first one is selected even the selection mode of the view is SelectRows.
The selection changes afterwards properly honor the mode though.
Therefore check for the selection mode and call setCurrentIndex() with
the appropriate flags.

Fixes: QTBUG-86776
Pick-to: 6.0
Pick-to: 5.15
Change-Id: Ieba7b9e009358e7b6e802b7847640161ec776c64
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-13 16:44:26 +00:00
Eirik Aavitsland
2054f451b1 Fix read-only pseudo-state in QTextEdit/Browser stylesheet
Was implemented for QLineEdit but not QTextEdit.

Fixes: QTBUG-83056
Pick-to: 6.0 5.15
Change-Id: I1e67ad0f1c230a062a1e12e8bc0b209c5289dc32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-13 17:22:34 +01:00
Volker Hilsheimer
ee409a536e macOS: Add more padding to width of non-editable comboboxes
The width of the combobox took the space for the checkmark and the contents
into account, but didn't provide any padding on the right side, resulting
in the text hitting the right side of the combobox popup.

Add another 12 pixels padding to the sizeFromContents implementation,
which results in a symmetrical padding on both sides of the text.

Fixes: QTBUG-88715
Pick-to: 6.0 5.15
Change-Id: I811da73d11ce935c1fb83efabbe799f9a882e1d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-13 16:16:50 +01:00
Christian Kandeler
b88f692d7d QTestLib: Show the values of unregistered enums
... on a failed QCOMPARE.

Change-Id: I653894927e49fad92c21409d03ed70880ca510f6
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2021-01-13 16:15:06 +01:00
Friedemann Kleint
29b2387587 Windows font engine: Silence warnings about not being able to enumate font families
Turn the warning into a qCDebug() statement and add explanatory comment.

Fixes: QTBUG-85683
Pick-to: 5.15 6.0
Change-Id: I2a6a7a089a660294f3e9c3096299c75635b3b215
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-01-13 11:59:18 +00:00
Laszlo Agocs
c262a69851 rhi: gl: Add some enablers for supporting GL_TEXTURE_EXTERNAL_OES
From QRhi's perspective this consists of two things:

- A shader with samplerExternalOES in it cannot go through the standard
  pipeline. Rather, a QShader with suitable GLSL code in it has to be
  constructed manually. As this is something useful as an autotest
  anyway, add a test case to the qshader autotest that demonstrates
  this.

- When it comes to correctly calling glBindTexture, add a QRhiTexture
  flag. The expectation is that an OpenGL-only client sets this in
  combination with QRhiTexture::createFrom(), thus wrapping an existing
  texture that then gets bound to the GL_TEXTURE_EXTERNAL_OES target
  instead of our usual GL_TEXTURE_2D.

For completeness we also add a SamplerExternalOES variable type to
QShaderDescription, but the sampler type is not actually used by the
QRhi OpenGL backend, as it is the QRhiTexture that defines the
texture target.

Change-Id: I36b52325deb3703b59186ee3d726d0c3015bfc4b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-13 10:08:23 +01:00
Laszlo Agocs
042cd97884 rhi: Expose device name, type, and IDs
...to the extent it is sensible. We have to make compromises still,
meaning some fields will only be applicable with certain APIs.

Most of this is already shown upon QRhi::create() as info debug
prints, when enabled. Now expose it all through the QRhi API as
well.

This is useful for printing in qtdiag, and, while it should be
avoided as much as possible, to make decisions about disabling
3D rendering features depending on the driver and GPU in use.

Change-Id: Iebe1e192965c928b82a094d1c7c50ddf4b38b9a2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-01-13 10:08:23 +01:00
Joerg Bornemann
04f11f9935 Remove .prev_CMakeLists.txt files
Those serve no purpose anymore, now that the .pro files are gone.

Task-number: QTBUG-88742
Change-Id: I39943327b8c9871785b58e9973e4e7602371793e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-12 20:59:13 +01:00
Andy Shaw
bb00b63dee Set the PlaceholderText color in the palette from the stylesheet as well
The color should be used across the board, so the PlaceholderText color
should also be respecting the one passed for Text and so on.

Fixes: QTBUG-89815
Pick-to: 6.0 5.15
Change-Id: I2accb3db35488f95a1c8ebacf2316a08ee416fac
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-01-12 20:24:28 +01:00
Paul Wicking
8c395a20ed Doc: Add details to QFont::toString
Add details that explain the return value.

Pick-to: 6.0 5.15
Fixes: QTBUG-81467
Change-Id: Ifad407a27259711fc9abe1bacc7ba9db105bdcc0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2021-01-12 13:50:26 +01:00
Tor Arne Vestbø
163d9c7cc4 macOS: Don't try to close already-closed/closing file dialog
Doing so results in a warning about "modalSession has been exited
prematurely - check for a reentrant call to endModalSession:", and
on Big Sur will also result in the file failing to save because the
return code from runModal will no longer be NSModalResponseOK.

This would happen when the completion handler for beginSheetModalForWindow
would call QNSOpenSavePanelDelegate_panelClosed, resulting in calls to
QDialog::done(), which in turn tries to hide the dialog, via
QCocoaFileDialogHelper::hideCocoaFilePanel().

Pick-to: 6.0 5.15
Fixes: QTBUG-89959
Change-Id: I048afe3dcc7fe62e0d0273f12b4b2c0237abb052
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-12 12:44:35 +00:00
Alexander Volkov
376e3bd8ec Introduce QUrlResourceProvider to load resources for HTML
QTextDocument and the text editor classes suggest to override
their loadResource() methods to provide data associated with
a text document. This approach has the following drawbacks:
- it requires subclassing
- there is no way to set a global resource provider
- QLabel is missing virtual loadResource() method and
  it can't be added without breaking ABI

QUrlResourceProvider is designed to solve these issues.
One should create a derived class that implements
QUrlResourceProvider::resource(). The objects of the derived
class then can be set for any text document.
The default resource provider can be set with
QUrlResourceProvider::setDefaultProvider().
This change also adds QLabel::setResourceProvider(),
which doesn't break ABI.

[ChangeLog][QtGui][Text] Introduced QUrlResourceProvider that allows to
load resources for HTML. It is intended to replace the use of
QTextDocument::loadResource().

Change-Id: Iaf19b229f522a73508f20715257450fe58f68daf
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-12 15:33:10 +03:00
David Skoland
9e09677c1d Remove QtDBus includes
Per the discussion of QTBUG-88831, we determined that module-wide
imports are unfortunate, especially for compile times. Following this,
all QtDBus includes have been replaced with the headers for the classes
actually used in each file. Additionally, some cleanup of header file
order and format has been performed in the changed files.

Pick-to: 6.0
Change-Id: I62c1b75682a48422f0ba1168dd5d7bd0952808ac
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-01-12 09:19:27 +01:00
Eskil Abrahamsen Blomfeldt
6a3f8cbc3a Use design metrics when adding text to QPainterPath
When we add text to QPainterPath, we will add the design metrics
(unhinted glyphs) and scale these down to match the target font size.
But the glyph positions we pass in are based on the hinted metrics,
samples at the target font size. Thus, on fonts/systems with hinting,
these do not match the scaled design metrics outlines.

To fix this issue, we make sure the text layout uses design metrics
when determining the glyph positions.

[ChangeLog][QtGui][Text] Fixed an issue where QPainterPath::addText()
would get inconsistent kerning for smaller font sizes when hinting is
enabled.

Fixes: QTBUG-20900
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I651997d1a6a86e6271557438afa2cdad078a83ca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-12 09:10:35 +01:00
Friedemann Kleint
7b7dda654a Windows QPA: Fix crashes when using screen reader with Q(Plain)TextEdit
Make sure the search start with valid values.

Pick-to: 6.0 5.15
Task-number: QTBUG-89354
Change-Id: I5b5100db89c62f23748b5c88e9188cfe3811e6e8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-12 07:55:04 +01:00
Christian Ehrlicher
f8f629cc13 QSql/QSqlite: return extended error codes by default
SQlite allows to return fine-granulated error codes but this behavior is
not enabled by default (due to backwards compatibility concerns).
Enable them for the SQLite driver by default but provide an option to
disable them when needed.

[ChangeLog][QtSql][QSQLITE] The plugin now returns the extended error
codes by default.

Change-Id: I59cec9aea46eb03f1e7ca02903d769c003a1ae30
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-11 19:55:43 +01:00
Robert Loehning
ce90248882 QSslCertificate: Guard against accessing empty QByteArray
Fixes oss-fuzz issue 29276.

Pick-to: 5.12 5.15 6.0
Change-Id: I57b0c26e5377bd6b82d9f044ae1d1d13acec996a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-01-11 19:14:21 +01:00
Andreas Buhr
a75bdfda3d Clarify variable names in QPropertyObserverPointer::notify
In QPropertyObserverPointer::notify and its calling sites,
variable names "alreadyKnownToHaveChanged",
"knownIfPropertyChanged", "propertyChanged", and at its calling site
"knownIfChanged" are used. This is confusing. This patch
changes those four to "knownToHaveChanged". For the logic
implemented it is not necessary to track whether we
have knowledge about having changed and whether it has
actually changed (if we have knowledge) separately.

Change-Id: I90b86b276ab67b2ed70dba4e456cd90220588870
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-11 16:14:23 +01:00
Fabian Kosmale
240505457b QBindable: Improve read-only support
If we create a QBindable from a const property, we should obtain a
read-only interface. Besides implementing this feature, this patch adds
a isReadOnly method to Q(Untyped)Bindable which can be used to check
whether one can modify the property via the bindable interface.

Task-number: QTBUG-89505
Task-number: QTBUG-89469
Change-Id: Ic36949a5b84c5119e0060ed0a1cf4ac94a66f341
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-11 15:57:26 +01:00
Morten Johan Sørvig
9f894788dd Revert "Windows QPA: Call QWSI::flushWindowSystemEvents() from WM_PAINT for full update only"
This reverts commit a81dfb32d6.

Paint immediately on WM_PAINT in all cases in order to
avoid flicker on resize.

The cases mentioned in commit a81dfb should no longer
apply:
  - QTBUG-38327: QGLWidget is not supported in Qt 6.
  - QTBUG-39842: Fixed by using ExcludeUserInputEvents.

Fixes: QTBUG-89688
Change-Id: If82cf7703d6663982769048e86a7060223730ce7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-11 14:42:50 +00:00
Paul Wicking
9a12f7e083 Bump version
CMake edition.
Also update default compiled version.

Task-number: QTQAINFRA-4126
Change-Id: Ia6f535f553e73bd6b00e2e20752f4961af21ede5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-11 13:58:55 +01:00
Paul Wicking
149ad1e615 Doc: Explain how boundingRect handles null QRectF
Fixes: QTBUG-87107
Pick-to: 6.0 5.15
Change-Id: Ib7f9bd58b0f3454167dc61f95e0d8e6dec52a5ed
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-11 13:28:17 +01:00
Kai Köhne
1f53189c29 Doc: Generalize timer docs
The snippets do not talk about Qt Widgets specifically.

Pick-to: 6.0 5.15
Change-Id: Icc4f243c93189f08124074e4918d535aa37e6560
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-01-11 09:52:56 +01:00
Paul Wicking
713829b718 Doc: Link to correct location
Reflow text to fit style while at it, to satisfy git clang-format.

Pick-to: 6.0 5.15
Fixes: QTBUG-89709
Change-Id: Iab2bf09399adf2cb0f0219ab40978bb238825ae8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-01-11 07:35:21 +01:00
Craig Scott
0be2ecee37 Doc: Add partial documentation for CMake API (tech preview)
There are still other parts of the CMake API that are not yet
documented. This change only addresses qt_add_executable() and the
Android-related commands it uses.

Fixes: QTBUG-88839
Task-number: QTBUG-84482
Pick-to: 6.0
Change-Id: I761b5ce908d1f62284baabe2d414cd37a0efe83d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-01-11 16:58:28 +11:00
Giuseppe D'Angelo
c34c6af374 Replace some more erase/remove patterns with removeIf
Change-Id: I6c6f33450fbfd798e5ef71a8ba18f590581dc3a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-10 15:02:47 +01:00
Christian Ehrlicher
b211148e4b Sql ODBC driver: add direct support for float and short datatype
This patch adds native support for SQL_REAL (float) and SQL_SMALLINT
(short). Previously those datatypes were mapped to double and integer.

[ChangeLog][QtSql] The ODBC driver now properly maps QMetaType::Float to
real sql datatype and QMetaType::Short to smallint

Fixes: QTBUG-8963
Fixes: QTBUG-57279
Change-Id: Ifec4c609734dbe6165c1ebdadb461c2aae47ba78
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-01-10 13:02:14 +01:00
Alex Trotsenko
161e8f4d5d QProcess/Win: clean up death notifier teardown
To avoid the mostly hypothetical possibility of failure, delete the
processFinishedNotifier before closing the handle on which it operates.
Previously, because of this, we explicitly disabled the notifier in the
processFinished() function, which made the code unclear. Now, we can
remove that safely, because cleanup() works correctly, and doing it
before calling findExitCode() was not necessary to start with.

Change-Id: Ia7095ded2c7eba8f4d738c6b87c7be41aa3cbbc8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-09 20:56:11 +00:00
Alex Trotsenko
4ff41e6ff8 Remove useless call in QProcessPrivate::waitForFinished() on Windows
if pid == nullptr, the child process has already exited and the pipe
readers have been stopped. So the call to drainOutputPipes() is
unnecessary here.

Change-Id: I0bed90d08ac879bb0ae178a1cdc37afb9d825314
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-09 15:16:42 +02:00
Alex Trotsenko
db5c901594 QProcess/Unix: do not activate read notifiers until process has started
Otherwise, the user may receive the readyRead() signal just before
started().

Change-Id: I8d6fd18fdfcef0580a3e609100198b03b18b1175
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-09 15:16:34 +02:00
Alex Trotsenko
6a6d12ea4b Split QProcessPrivate::_q_processDied()
The completion of the child process can take place asynchronously or in
one of the waitFor...() functions. In both cases, we used the same
handler (_q_processDied()), which caused several problems:

  a. technically, waitForReadyRead() should have taken into account the
     result of the calls to _q_canRead...() slots inside the
     _q_processDied() function:

       - the user calls waitForReadyRead();
       - forkfd descriptor becomes signaled, while a grandchild
         process is still alive;
       - as readyRead() signal has not been emitted, _q_processDied()
         is called;
       - the grandchild process writes to stdout pipe;
       - now data arrives, and _q_processDied() will collect it, but
         won't report it.

  b. we had a bug with recursions on Unix:

       - death notification comes asynchronously;
       - waitForDeadChild() closes forkfd;
       - _q_canRead...() emits readyRead();
       - a slot connected to readyRead() calls waitForFinished();
       - waitForFinished() hangs (forkfd == -1).

   c. for blocking functions, drainOutputPipes() was called twice on
      Windows.

By introducing a new processFinished() function, we leave the read
operations in the _q_processDied() slot, while the process completion
code is guaranteed to run only once.

Change-Id: I5f9d09bc68a058169de4d9e490b48fc0b35e94cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-09 13:15:54 +00:00
Christian Ehrlicher
05706bd2b0 QPdfWriter: fix embedding fonts in pdf files
The container size change from int32_t to int64_t created a subtle error
during font serialization. The size of a QByteArray was serialized
without a proper cast and therefore now 8 bytes instead 4 bytes were
written to the stream.

Fixes: QTBUG-89727
Pick-to: 6.0
Change-Id: If9255a5a3124038356bc5053810f98c7c88f8a01
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-01-09 09:04:29 +00:00
Andreas Buhr
d26da5fc09 Remove outdated comment and unnecessary initialization call
In construction of QPropertyBindingPrivate was an initialization
of inlineDependencyObservers with a comment that this is necessary
because of a union. But inlineDependencyObservers is not inside a
union. The comment is outdated and the explicit initialization
superfluous. This patch removes it.

Change-Id: I06544a816533c41af8fc5da3ef44ddd7c18ca86e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-09 10:03:21 +01:00
Ahmad Samir
138fa9f2f4 QDir/QFileInfo: add doc notes about paths starting with ':'
This is an addendum to commit 0da5726a43b; making the note about paths
starting with ':' being treated as absolute paths by the underlying
QFileSystemEngine, more visible, so that users of the class don't hit
that pitfall.

Add similar docs to QFileInfo.

Pick-to: 5.15 6.0
Change-Id: Ib34d066d31bb673d340ec41422ed4daf911765b8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-01-08 18:13:42 +02:00
Allan Sandfeld Jensen
d5a980df97 Send Qt::Key_MediaTogglePlayPause for VK_MEDIA_PLAY_PAUSE
Speculative fix to get the right keys in WebEngine

Pick-to: 6.0 5.15
Fixes: QTBUG-89915
Change-Id: I79519b715a1415dccfc4601aae5025b3222a79ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-08 16:56:27 +01:00
Friedemann Kleint
867b11596b Windows QPA: Fix missing QScreen change updates
Remove the logic compressing WM_DISPLAYCHANGE signals by the
WParam/LParam since it also triggers when the geometry is changed
by rearranging screens.

Fixes: QTBUG-79442
Change-Id: I00042c9e687bdb67fc17d6c507818b79a7aee0a2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-01-08 13:43:47 +01:00
Alex Trotsenko
423e6c3635 QProcess/Unix: consolidate process state tracking socket notifiers
There is no reason to have the startup notifier and the death notifier
be active at the same time, as the former will detect death as well.

Previously, these notifiers were racing, but _q_processDied() ordered
signals by calling _q_startupNotification() manually. Thus, the
started()/finished() sequence was always emitted if the child process
was killed anywhere. Now this ordering is simply not necessary anymore.

This makes it possible to reuse the startup notifier for death
notification.

Change-Id: I5ebed9b5f28b19fe56c80498977a3b21be9288fd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-01-08 14:29:43 +02:00
Edward Welbourne
7fea8a079f Assert that wchar_t's size matches one of the unicode character types
This is assumed in various places, so best checked explicitly.

Change-Id: I475dcf5cbb60c0272dec560acd2893cff73872ce
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-08 12:41:28 +01:00
Edward Welbourne
4724d017ef Minor tidy-up: two sizetype fixes, two \nullptr uses
Change-Id: I6c4a1296350ecaf9a661dba22670fbb2ad23bd77
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-08 12:41:06 +01:00
Edward Welbourne
c9c598d4d7 Mark places where we missed conversion to unicode character types
We should use char32_t for the toUcs4() methods of QString and
QStringView and use char16_t for QString::utf16(), thereby matching
QStringView. These naturally imply knock-on changes in various places.
Unfortunately, we didn't make those changes in Qt 6, so they'll have
to wait for Qt 7.

Change-Id: I18451d4b31b76658092e19d3fcbc8bc0fe5ce307
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-08 12:40:53 +01:00
Andreas Buhr
618dd6b5a7 QProperty docs: update macro name
Use Q_OBJECT_BINDABLE_PROPERTY instead of non-existing ones.
Follow-up to 50e1976437.

Task-number: QTBUG-85520
Pick-to: 6.0
Change-Id: I138f0775d9804029f2ecd6bd3594ab47b247392e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-01-08 10:01:23 +01:00
Nico Vertriest
1b636b72e5 Doc: Fix \sa statement link error
Change-Id: I19f131a7bcbbed5ec39a7ad79a9d7a46d1320529
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-01-07 18:36:33 +01:00
Frederik Gladhorn
a62fa9b7cc Revert "Fix invalid text layout data when a full layout run is interrupted"
This reverts commit 09ee4282e5.
The commit made the layouting time go from linear to quadratic, which is
problematic when rendering big documents impractical.

I wrote an alternative fix for QTBUG-20354 which will come as separate
change since it approaches the problem in a different way.

Fixes: QTBUG-89599
Task-number: QTBUG-20354
Pick-to: 5.15
Pick-to: 6.0
Change-Id: Ie450332f06ee40e60c8e4c6c7d10834bff1acf74
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-01-07 14:48:34 +00:00
Joerg Bornemann
ad2da2d27a Remove the qmake project files
Remove the qmake project files for most of Qt.

Leave the qmake project files for examples, because we still test those
in the CI to ensure qmake does not regress.

Also leave the qmake project files for utils and other minor parts that
lack CMake project files.

Task-number: QTBUG-88742
Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-07 15:32:28 +01:00
Friedemann Kleint
fca3ea040c QTestlib: Fix custom toString() implementations for QList comparison
d25589e052 mistakenly changed the code
to use toString() from the QTest namespace. Call toString()
unqualified and move the compareSequence() helper out of the
internal namespace.

Fixes: QTBUG-89737
Pick-to: 6.0
Change-Id: I8452a0aead7771ad13a5b95438b54e202ccce76b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-01-07 15:13:44 +01:00