Commit Graph

61131 Commits

Author SHA1 Message Date
Edward Welbourne
f291575d95 Relocate two helpers from QLocalTime to an anonymous namespace
When I broke them out from functions in the QLocalTime namespace I
didn't notice that's where I was putting them; they don't belong
there.

Change-Id: If4c9d996b3e46b3b46a29a97d0bcc2cac72c91ab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 21:11:01 +02:00
Joerg Bornemann
aad3b1f063 CMake: Fully rebuild dirty configure-time executables
Problem: "ninja clean" does not fully clean the build directories of
configure-time executables (e.g. syncqt). This can lead to problems when
building with compiler and linker launchers: on configure time, the
launchers are not used (compare CMake issue #20762). After a "ninja
clean", the executable might be removed but the object files are still
there. This leads to a situation where the object files have been
created without the compiler launcher but are linked with the linker
launcher. We encountered a situation however, where the linker launcher
requires the usage of the compiler launcher.

The configure-time executable has a ${target}_build custom command that
runs "cmake --build" and creates a timestamp file to track when to build
the target. To circumvent the problem of stale object files we add the
"--clean-first" argument to that target to fully rebuild configure-time
executables if the timestamp file is out of date.

The performance this imposes is negligible, because
1. Those configure-time executables are seldom out of date.
2. They are supposed to be "tiny executables with system dependencies
only" anyway.

Pick-to: 6.5
Change-Id: I701f9089f5ad941ffdf235aeccc3119b68c4e3e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-26 20:09:38 +02:00
Alexey Edelev
be4de03b37 Add message if syncqt is crashed without any output
If syncqt process crashed due to the incompatibility with the standard
library CMake doesn't produce any useful output. This adds the message
that will give short explanation and possible solutions to fix this
behavior.

Pick-to: 6.5
Task-number: QTBUG-112747
Change-Id: Ib51aec19e3fcacf07515a3d20d72f89753bcdc33
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 20:00:33 +02:00
Ivan Solovev
5ddb5d1fee Rework imagescaling example to avoid potential crashes
Creating a continuation with QtFuture::Launch::Async policy does not
work well with the example, because it still needs to update the UI
once the async continuation is finished. If the user decides to
close the application while the async continuation is executed,
the next continuation will be accessing data from the destroyed
Images object.

Fix it by using QtConcurrent::run() to do the "heavy" work in a
separate thread, and use a QFutureWatcher to handle the results of
the async execution. Update the example documentation accordingly.

After this patch the example still shows the usage of continuations
and onCanceled()/onFailed() handlers. However, it now does not
illustrate the usage of different launch policies and continuation
contexts. It might not be a big issue, because the QFuture
documentation describes these topics rather extensively.

Fixes: QTBUG-103514
Pick-to: 6.5
Change-Id: I8142535064ff7a4e8007a5c0a8fe7709d6d942ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-04-26 19:27:30 +02:00
Leena Miettinen
3abfd4aa7c Doc: Use qt_add_executable() not add_executable() in snippets
Changes code snippets that are visible in the docs.

Task-number: QTBUG-113116
Pick-to: 6.5
Change-Id: If743234bfe6947acf02307bf1144daad4fba5d73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 17:25:50 +02:00
Kai Köhne
e51274d8c3 Fix license info for import shell scripts
Use SPDX-License-Identifier also for shell scripts. Also change
license to LicenseRef-Qt-Commercial OR GPL-3.0-only, which makes
arguably more sense than LGPL.

Pick-to: 6.5
Change-Id: I3a46468f264747916aacbf206f5ccba28b6c6593
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-26 16:36:18 +02:00
Kai Köhne
576c29df83 Clarify license of SHA-1 algorithm
SPDX/reuse does not feature any generic 'public domain' license
identifier. So far we claimed CC0, which is however not entirely correct.
Now that we have LICENSES directory, let's correctly claim this as
a specific license.

Also, remove the LGPL in-code claim. The adaptations for Qt code is
minor so it doesn't make much sense to claim a different license.

Pick-to: 6.5
Change-Id: I4e943a45baae192b54c38184e8eb85fc6d4035e5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-26 16:36:18 +02:00
Bartlomiej Moskal
c27d5eca6a Android-example: add missing properties in AndroidManifest.xml
After changing android target SDK version to 31, some missing values has
to be defined in AndroidManifest.xml.

AndroidManifest.xml template was updated in qtbase in:
56dee3de5e commit. In case when example
uses its own AndroidManifest.xml file, it need to be updated separately.

* android:exported="true": because the manifest sets an intent-filter,
and it then has to explicitly to avoid the warning [1].
* android:allowBackup="true": this has to be explicitly set, we set it
to the default value here [2].
* android:fullBackupOnly="false": SDK 23+ use this to deteremine to
user auto backup or not, we set it to the default value here [3].

[1] https://developer.android.com/guide/topics/manifest/activity-
element#exported
[2] https://developer.android.com/guide/topics/manifest/application-
element#allowbackup
[3] https://developer.android.com/guide/topics/manifest/application-
element#fullBackupOnly

Fixes: QTBUG-112816
Pick-to: 6.5 6.2 5.15
Change-Id: Ia48007a84009901be508d6cc087790d574227ad7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-04-26 13:47:43 +00:00
Laszlo Agocs
d587d3fecd rhi: Improve deferred delete docs
Change-Id: I533e44d73ad1aebf72ef2e28c90c51f5effb8977
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-26 15:47:43 +02:00
Dmitry Shachnev
dca0304c26 Fix capitalization error in auto-generated qdbusmacros.h include
https://bugs.launchpad.net/bugs/2016703

Pick-to: 6.5 6.2 5.15
Change-Id: I521c7b66d6c1c27ea790f0564b175cccb0027802
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-26 13:47:43 +00:00
Volker Hilsheimer
ca15f650a1 QTabBar: don't scroll when laying out the tabs
QTabBar lays out the tabs when the bar's size or content changes,
often lazily. This should not change the scroll offset of the tabbar,
which is controlled by the user, or at most when a tab needs to be made
visible (e.g. when it becomes the current tab).

Move the logic of updating the scoll offset into the makeVisible
function, so that the scroll is only adjusted to either leave no gap
between the last tab and the right edge of the widget of there is still
a scroll; or to reset it to 0 if there is enough space for the entire
tab bar. Since layoutTabs does show and hide the scroll buttons, we
cannot skip this when the buttons are invisible. However, the
normalizedScrollRect helper now needs to return the entire widget rect
if there are no visible scroll buttons.

Add a test case that simulates the previously broken behavior where
the scroll got unnecessarily reset to 0 when resizing.

Fixes: QTBUG-113140
Pick-to: 6.5
Change-Id: Ic19fbb82821ea09cc5e7646dcbce3aa7607909c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-04-26 12:50:49 +02:00
Ivan Solovev
0198a74b72 QBluetoothPermission: introduce fine-grained permissions
This commit introduces fine-grained Bluetooth permissions control to
the QBluetoothPermission class.
For now the fine-tuning of the permissions is only supported on
Android. On Apple enabling any of the permissions is equivalent to
requesting full Bluetooth control.

Task-number: QTBUG-109964
Change-Id: Ie7ac6577cf6a21419b73b33f8cf7e87bc3f8cf43
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-26 12:46:06 +02:00
Antti Määttä
346dcc696b Create unique names for QSize and QRect types for lttng
Task-number: QTBUG-113161
Pick-to: 6.5
Change-Id: Icc47af16b73dd9ad4e203c3bd55833587435be5c
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 13:46:06 +03:00
Antti Määttä
bb8aada627 Fix crash at exit when tracing
The crash is caused by the cleanup sending trace messages when the
plugin has already been destroyed. Add shutdown callback to the plugin
to indicate this has happened. We can't use signals since that also
generetes trace event.

Pick-to: 6.5
Change-Id: I2e490fc51c2aaa97c240c1496a528a6ff6077bd0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 10:46:06 +00:00
Antti Määttä
257b3161c5 tracegen: Add common prologue
Add common prologue and add error message when tracing is used in a
module that doesn't have Q_TRACEPOINT enabled, but tracing is enabled.

Pick-to: 6.5
Change-Id: I64ca074942f6e89b4f5b5e3b6048b2b713c06df8
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-26 13:46:06 +03:00
Axel Spoerl
55a51e1909 Implement QXmlStreamReader::hasStandaloneDeclaration()
This patch implements a public getter for the hasStandalone attribute.
It returns true, if standalone has been explicitly declared in an XML
header and false otherwise.

As this is no longer necessary it removes accessing QXmlStreamPrivate
from QDomParser.

[ChangeLog][QtCore][QXmlStreamReader] added hasStandaloneDeclaration()

Change-Id: Iaaa0a728a6f7186e40637186077f7b49c112f7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
2023-04-26 12:46:06 +02:00
Marc Mutz
b85a9d0ee1 Move QZipReader/Writer from QtGui to QtCore
These classes depend only on Core, not Gui.

This allows dropping the dependency of tst_qxmlstream and tst_qzip on
QtGui, and prevents a tst_qxmlstream FTBFS when building with
QT_NO_TEXTODFWRITER.

Symbols move from QtGui to QtCore, but the classes are private API, so
not under BC constraints.

The classes are not used outside qtbase, so no other in-tree users
need porting.

Task-number: QTBUG-3897
Change-Id: Ifa148f43ec139d7f9ac1f3893e2fcf4640e3c60c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-26 12:01:05 +02:00
Thiago Macieira
cd800da526 QString::insert: replace duplicated code with a recursion
Just call itself after copying the buffer, thus avoiding instantiating
insert_helper() for QVarLengthArray.

The other two cases of QtPrivate::q_points_into_range + QVLA in
qstring.cpp are not worth changing.

Change-Id: I9671dee8ceb64aa9b9cafffd1742fa7bb4cbebd8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 07:55:47 +00:00
Thiago Macieira
b9394b48c1 tst_QCoreApplication: ensure that theMainThread has expected states
The expected states are:
- nothing sets theMainThread before main()
- theMainThread is reset when the last QObject (the QCoreApplication in
  the test) is destroyed

The GUI version of this test appears to leak a lot of QObjects. By the
time this function runs, theMainThread's QThreadData still has a
refcount of 66 on Linux/XCB. The Windows non-GUI version also
failed. Neither situation was investigated to see why objects are
getting leaked.

Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17507d9e6ef08743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-26 04:55:47 -03:00
Yuhang Zhao
ebd27ff654 windeployqt: improve debug detection
MSVC binaries can also be stripped and according to my
experiments they still work normally. So we should not
limit this check to MinGW only.

Change-Id: I026d75a38b94f309ad695cf8f700ed3ac160dd87
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-04-26 02:21:08 +00:00
Thiago Macieira
6e99922234 tst_QProcess: don't link non-Qt helpers to QtCore
Change-Id: Icfe44ecf285a480fafe4fffd174d481f5e548c7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-25 18:53:30 -07:00
Thiago Macieira
956b249528 QProcess/Unix: don't overwrite openChannels() error message
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d0fa4701b0076
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-25 21:53:30 -04:00
Thiago Macieira
67431e4168 QMutex/Unix: remove the pthread_mutex_t-based content
For our purposes, the sem_t code is better, so we've preferred it since
commit c7ab816af1 (5.7). Olivier wrote in
that commit's message, "It makes tst_QMutex::contendedQMutex with no
msleep 8 times faster".

That's true because QMutex didn't lock the underlying pthread_mutex_t in
QMutex::lock(), as we used the inlined atomic code for the uncontended
case.

It is probably possible to merge the qmutex_mac.cpp and qmutex_unix.cpp
code now (both are based on semaphores), but I won't do that for two
reasons:
 1) At best, the PThread functions are going to be thin-wrappers around
    the code we already have, like FreeBSD's are around usem (see [1])
 2) Darwin has a private API that resembles futexes so we may want to
    go that way eventually (see [2])

[1] https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/sem_new.c
[2] https://codereview.qt-project.org/335849

Change-Id: Idd5e1bb52be047d7b4fffffd175369b13ba47bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-25 18:53:30 -07:00
Mårten Nordheim
825a37da66 tst_QSslCertificate: Make it easier to check which backend is used
Instead of having one member signaling !openssl
let's just add booleans for openssl, schannel and securetransport.
The latter two of which are not currently used but may be in the future.

As a drive-by, make a compile-time check into a runtime one.

Change-Id: Id2f51f5396383a3f5836ac708996bfce8ae35c91
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-25 23:39:24 +02:00
Morten Sørvig
15dab565d0 wasm: rework local font support
Populate a subset of the font families at startup if the local fonts
access API is supported, and the access permission has been given.

Since this code runs at app startup there is no opportunity to request
font access. That should be done in response to user action, for
example by having a "load local fonts" button in the application.

Pick-to: 6.5
Change-Id: Ib6826deeec06ee3def0e793dd1462977710462be
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
2023-04-25 21:38:08 +00:00
Hatem ElKharashy
c10c66e552 Support float_type arrays when using lttng
lttng ctf_array does not support float types which
causes compilation error when a float type is passed
to the function. A solution is to pass the array
elements one by one to TP_FIELDS.

Fixes: QTBUG-112761
Pick-to: 6.5
Change-Id: I30e7049d9eda1141298145897df372213145c1b4
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-04-25 20:57:43 +00:00
Timothée Keller
21e4116874 Windows QPA: Fix restore geometry after dragging from maximised
Start tracking the window geometry before a mouse drag, so that we can
revert back to that geometry when we restore from maximised. Previously,
when dragging from maximised to maximised, the restore geometry would
end up being the final drag place before snapping to maximised, instead
of where the window was before the first maximised.

Fixes: QTBUG-112814
Pick-to: 6.5 6.2
Change-Id: Ic2ddf29d6c4abdc9e8b0c5161b17aa6ee9474ea3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-25 22:57:43 +02:00
Amir Masoud Abdol
eec5a016d3 Remove an unnecessary None definition
We should be able to just pass `0L` and avoid defining a None macro.

Pick-to: 6.5
Change-Id: I513d726120454523627a1e66515a5a533c0238b1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-25 22:57:42 +02:00
Mikolaj Boc
07a736db6a Remove FileReader callbacks before assigning new ones
This fixes the assert raised on overwriting event handlers

Fixes: QTBUG-113041
Change-Id: Ie2afe09f4111ea542297b82a51382f1eb04ec960
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
2023-04-25 22:57:42 +02:00
Thiago Macieira
0198611fd4 Revert "Exclude files from unity build"
This reverts commit e0cec08480.

Reason for revert: this can't possibly be the correct solution. It
set properties in headers (not .cpp sources) and headers can't cause
a build issue because they aren't built. Moreover, the problems
were seen in another module, so the properties set in those files
shouldn't even be visible to CMake.

Change-Id: I8473bb819e768bd203f89034d18132186da0371c
Pick-to: 6.5
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-25 17:49:34 +00:00
Mikolaj Boc
d09855ae7b Copy memory to buffer when saving files on wasm with threading on
wasm heap uses a shared array buffer, which cannot be fed to
FileSystemWritableFileStream.write due to security limitations.
Heap memory has to be copied to a temporary buffer for the operation to
succeed.
This is only done if __EMSCRIPTEN_SHARED_MEMORY__ is on to optimize the
non-threading path.

Fixes: QTBUG-112881
Pick-to: 6.5
Change-Id: I0d117a8703caf4c17abc67b30df5248a53406d5f
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-25 19:24:33 +02:00
Laszlo Agocs
5ebb9a8bf3 Tune textures example to work with wasm and update docs
Old examples inherited from Qt 4 tend to set some state, such as
enabling the depth test or culling, in initializeGL(). Newer examples
tend not to do this; they rather set the necessary state in paintGL().

This mattered little (or not at all) in the past, but with WebAssembly
and WebGL there are limitations in the GL context management in the
wasm platform plugin. Under certain conditions, esp. when
QOffscreenSurface is involved, it looks like the same native context
gets reused, which means there is a chance of unexpected changes to
the current state between calls to initializeGL() and paintGL(). (and
also between paintGL() calls) See QWasmOpenGLContext for details.

Update the textures example the same way we did for the cube one.

Add a note to the QOpenGLWidget docs about this problem.

Task-number: QTBUG-111304
Pick-to: 6.5 6.4
Change-Id: I29d2b2cdeb07bcecc5dc915d79c12b4323ca9ab3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
2023-04-25 18:10:44 +02:00
Laszlo Agocs
11209cfde6 gl: Check for image validity in readback
Returning a null QImage is preferable over passing a null bits()
to glReadPixels. (matters when QImage's malloc() gives null, thus
'd' is null -> isNull() == true)

Fixes: QTBUG-113127
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Ieca4d91eefdea47da5251dabe77cc31b48eb0e28
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-04-25 18:10:44 +02:00
Leena Miettinen
ab4125685a Doc: Fix issues in CMake command docs
- qt_finalize_target missed a reference to qt_add_plugin()
- qt_generate_deploy_app_script is also supported on Linux
- Use simplers examples for QT_DEPLOY_SUPPORT and
  qt_standard_project_setup()

Task-number: QTBUG-113116
Pick-to: 6.5
Change-Id: If6bfd01b9615a73ab1bafddee350e49f6902a6c0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-25 18:10:44 +02:00
Timothée Keller
e86fcae221 Windows QPA: Handle DPI induced geometry change for frameless windows
Make a manual call to the geometry change handling function after a
WM_DPICHANGED event if the window is frameless, since WM_SIZE and
WM_MOVE will not be called.

Fixes: QTBUG-109429
Pick-to: 6.5
Change-Id: I79b9f386fe120ee3d06d6490d3f31a7a5d7121b0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-25 15:53:34 +01:00
Marc Mutz
efd9e3a02b tst_qxmlstream: remove dependency on QtXml
QtXml is only DOM and SAX, not QXmlStreamReader/Writer (those are in
QtCore).

Pick-to: 6.5 6.2
Change-Id: I8454d7db90303d347d5b4be94c9f21401d1e273f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2023-04-25 16:53:34 +02:00
Topi Reinio
4fc3f0c159 Doc: Exclude licensing header when including a .qdocinc
The \include command includes the source in its entirety when the
second parameter is omitted. This pulled in also the license header
which was visible in the generated documentation.

Add snippet tags and use them to extract only the content we need.

Pick-to: 6.5
Fixes: QTBUG-113138
Change-Id: Ie3fe2fede1e81d08201ec4353352ef069aebc388
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-04-25 15:03:03 +02:00
Marc Mutz
e1818d9e9c QXmlStreamAttributes: port value()/hasAttribute() to QAnyStringView
[ChangeLog][QtCore][QXmlStreamAttributes] Ported value() and
hasAttribute() to QAnyStringView.

Change-Id: I771b9cede1d581d3f1142246e7a25c36bcc850d6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-25 15:03:03 +02:00
David Schulz
c818acda97 Improve style drawing under DPR scaling further
Rounding distances up can result in coordinates outside of
the clip rect. So stick to always round distances down when we multiply
a scaling.

Fixes: QTBUG-109640
Pick-to: 6.5
Change-Id: I784b7c90da9b6e7f5a925d4275eb67497616001d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-25 09:00:24 +00:00
Ahmad Samir
0d26db5737 QEvent: fix a narrowing conversion warning
By using an iterator-based for loop.

Change-Id: I9ae12f16bc2a5c2d74c8557a0324438102fec5b1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-25 06:15:47 +02:00
Ahmad Samir
4538bbf4a6 Misc.: Fix some narrowing integral conversion warnings
Drive-by change: use QByteArrayView instead of allocating a QByteArray.

Change-Id: Iaf7acbbdb4efbb101b73b30061ce38dd1fa99ca3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-25 06:15:36 +02:00
Ahmad Samir
d8a688adf0 QEventDispatcherGlib: fix some narrowing conversion warnings
"notifier->socket()" returns qint64, but sockfd should be int, because
pollfd.fd is a gint (aka int).

Change-Id: If6618aa5e652d4284b989352d61a28b605106d09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-25 06:15:31 +02:00
Ahmad Samir
39c191d003 QCommandLineParser: fix some narrowing conversion warnings
Drive-by change: use auto for iterator types.

Change-Id: I463f24890ee58a97e585a0596aed55543285b0a0
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-25 06:15:26 +02:00
Paul Wicking
ab636a95c3 Doc: Show correct headerfile for StringLiterals
The automatically generated `#include` statement for the
`Qt::Literals::StringLiterals` namespace contains the wrong header file
name. Use QDoc's `\headerfile` command to ensure QDoc generates the
correct `#include` statement.

Pick-to: 6.5
Fixes: QTBUG-112884
Change-Id: I825402dc9d8d451fecc120697486d4bf81e468d3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-25 04:26:43 +02:00
Axel Spoerl
72d6768ec1 Add missing nullptr check in QWidget::setFocusProxy
b1802a164b added handling for a parent to
become focus proxy of a child. The respective 'else if' branch didn't
check whether setFocusProxy() was called with a nullptr argument.

This patch adds the missing nullptr check.
It also adds functionality to tst_QWidget::tabOrderComboBox() to test
the removal of a focus proxy, as well as the complete removal of an
element from the focus chain.

Change-Id: I4cb865b9ac4497fc5e2595910738fb77694f5837
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-25 04:26:10 +02:00
Tor Arne Vestbø
ac0953c34d macOS: Handle failure to create display link or invalid display link
In some rare situations the display link may fail to create, or will
be created in an uninitialized state:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1201401#c123

When the latter happens the display link thread will crash in
CVCGDisplayLink::getDisplayTimes(). Based on the Mozilla bug
report, and subsequent patch, we can detect this situation via
CVDisplayLinkGetCurrentCGDisplay(), so we follow the same
approach, and then bail out:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1201401#c158

Once we bail out we fall back to the timer based approach
to delivering the update request. The next requestUpdate()
will try to use the display link again, which will likely
work this time around, as the display has had time to fully
initialize.

Pick-to: 6.5
Change-Id: Ib80fd792516d1e4e7f863a82755cbf00d1eb6c34
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-24 23:21:29 +02:00
Axel Spoerl
11f14c3b0d QDomDocument: no longer drop a provided 'standalone' attribute if 'no'
- Definition of 'standalone' attribute:
An XML declaration containing the attribute 'standalone' with its
value set to 'yes', tells the parser to ignore markup declarations
in the DTD and to use them only for validation.
The declaration attribute is optional and defaults to 'no'.

- Behavior Qt5
In qt5, DOM documents contained the standalone attribute,
regardless of whether or not it was explicitly specified.

- Behavior Qt6
In Qt6, the standalone attribute was only contained in a DOM document,
if its value was 'yes'. If it was explicitly declared with the value
being 'no', it was dropped in the DOM document.

- Expected behavior
If the source specified it overtly, then the generated XML should
contain the attribute, even when it takes its default value.

- Code base
QXmlStreamReader provides a public bool getter isStandaloneDocument().
This says whether the document is standalone or not.
The information whether the attribute was actually specified gets lost.
In consequence, the attribute was always dropped on non-standalone
documents.

- Fix
This patch makes hasStandalone a member of QXmlStreamReaderPrivate, to
record whether the attribute has been explicitly specified.

QDomParser is modified to retain the standalone attribute, if
QXmlStreamReaderPrivate::hasStandalone is true.

- Test
The patch adds a test function in tst_QDom.

Fixes: QTBUG-111200
Pick-to: 6.5 6.2
Change-Id: I06a0f230a2d69597dd6453f8fd3b036943d08735
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-24 21:49:29 +02:00
Edward Welbourne
3fd7086878 Silence MSVC warning on constructing QList from initializer_list
MSVC complains because we call Data::allocate(args.size()) and, of
course, initializer_list::size() returns unsigned std::size_type,
while the relevant Data::allocate() overload takes a signed qsizetype.

The constructor from iterators potentially has the same problem, if
the iterator type's difference_type is unsigned, so make the
type-conversion overt there, too.

Pick-to: 6.2 6.5
Change-Id: I521eca26a48aed570855b13242bf2df8bfa38f96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-24 19:49:29 +00:00
Amir Masoud Abdol
e0cec08480 Exclude files from unity build
If not excluded, some of the macros in X11.h and Xlib.h conflicts with
symbols defined in `UrlFormattingOption` and `Type` in `qurl.h` and
`qjsonvalue.h`.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b056f0bcd6643394401bca464f751b3489202d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-24 19:19:59 +02:00
Wladimir Leuschner
787038bb1d Change to darkmode is prevented at runtine in Vistastyle
Task-number: QTBUG-112965
Task-number: QTBUG-113036
Pick-to: 6.5
Change-Id: I0049e68bbd8e83025f9f576dcd712d03206859d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-04-24 12:25:22 +00:00