Commit Graph

45129 Commits

Author SHA1 Message Date
Christian Ehrlicher
1f27dc6871 QSqlField: add move ctor & move operator
Add the move ctor and move operator for QSqlField

Task-number: QTBUG-109938
Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 19:56:07 +00:00
Christian Ehrlicher
204f1764ca QSqlRecord: use QSharedData for private class
Use QSharedData for the private class instead a home-brew version.

Change-Id: Id3625bb0eb8f81c9caa672e2453dab3d44b15ea9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-26 19:56:07 +00:00
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
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
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
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
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
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
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
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
Tor Arne Vestbø
034e9b087e Darwin: Add debug logging of locale/language key parameters
Helps debug future issues in this area.

Task-number: QTBUG-104930
Pick-to: 6.5
Change-Id: Ia3f54edfa390190bb1cf3809f0cf72b105993a6a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-04-24 14:24:51 +02:00
Tor Arne Vestbø
a92c202b49 macOS: Localize title of edit menu's NSMenuItem via AppKit
In 939b7bfe66 we synced up the NSMenuItem's
title to that of the corresponding NSMenu, as AppKit was observed to use
the NSMenuItem title for its heuristics of when to add dictation and
emoji entries to the menu.

But AppKit's heuristics are based on the localized name of the edit menu,
so we need to follow suit and look up AppKit's own localizations. This
is of course fragile, as we're relying on this localization continuing
to live in the InputManager table, but if that changes we'll just fall
back to using the title from the NSMenu, as we did before.

In addition, AppKit's heuristics also look for menu items in the menu
that match selectors such as copy:, paste:, etc, so even if our lookup
of the localized title fails, the additional heuristics would in most
cases still succeed in detecting the edit menu.

Task-number: QTBUG-53085
Task-number: QTBUG-79565
Pick-to: 6.5
Change-Id: I5e12973b86ab35f10a8f7434bcae8a4cf134ecfd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-24 14:20:04 +02:00
Amir Masoud Abdol
c11cfc2d8d Use QCss:: namespace when accessing Value on Integrity
There seems to be a Value already defined in Integrity, and we `#undef`
it here: `text/qcssparser_p.h:39` to avoid symbol confusion. However,
this is not robust during the unity build where we might not necessary
end up with the preferred ordered of things.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ide37ab2035f0aa482a1d53d8e1511e0ab0109b3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-23 15:29:43 +02:00
Ahmad Samir
56aa065ab5 QLocaleData: de-duplicate some code
Not using structured bindings because those functions will be changed to
return QSimpleParsedNumber directly.

Change-Id: Ic52b6754da14b86d8ddc5f399262f227e05527ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-22 20:04:31 +02:00
Ahmad Samir
a7555c3306 QStandardPaths/Unix: fix writableLocation() when test mode is enabled
In commit 482a75fef9 the code was changed to return early, but that
missed appending the organization and app names while test mode is
enabled.

Issue spotted by Edward.

Pick-to: 6.5
Change-Id: Ifd220f8990874a173413dcf71d105c04b605c800
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-22 20:04:31 +02:00
Ahmad Samir
b9786f21b8 QDateTime: replace a bool parameter with an enum
Change-Id: Ie72b1d482c67c83cb0e2e0bfd1e00f1be2fa4899
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-04-22 20:04:31 +02:00
Ahmad Samir
b490bd0265 QDate: fix QDebug operator<<() for dates with year > 9999
ISODate only supports years in the range 0-9999; instead of printing an
empty string, use date.toString(Qt::TextDate) instead.

This is mostly useful for debugging DateTime unittests.

Change-Id: Id09951ce0a15452e28cb41a3b918c5ef05caab09
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-04-22 20:04:30 +02:00
Ahmad Samir
fa9244700e QDate: use more constexpr vars instead of plain numbers
Change-Id: I95580c199f868d632324f7f1fcbd56fa4dc85958
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-04-22 20:04:30 +02:00
Kimmo Leppälä
9c0e0e39f0 Add Qt icon library for examples
Icon library for file and text operations.
This is private library to be used with Qt examples.
Instructions on usage found in README file.

Task-number: QTBUG-110428
Pick-to: 6.5
Change-Id: I762503c74aecc3a8efbf25877628cb8e85efe414
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-22 18:14:38 +03:00
Axel Spoerl
b1802a164b Handle parent being a child's focus procy in QWidget::setFocusProxy
When a parent became a new child's focus proxy in an existing focus
chain, the child was appended at the end of the chain.
That leads to broken tab order, e.g. with a QComboBox which became
editable after a focus chain has been set.

This patch captures the case and insertes the new child after its
parent in the focus chain.

A corresponding test function is added in tst_QWidget.

Fixes: QTBUG-111978
Pick-to: 6.5
Change-Id: I3a426c0560fa830b7b7ffead54f26dd0adef499f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-22 14:57:46 +02:00
Inho Lee
544464c3d1 QPA:EGLFS - ignore scissor and stencil when drawing the cursor
In QEglFSCursor::draw, There are two missing pipeline states
SCISSOR and STENCIL.

Fixes: QTBUG-110080
Pick-to: 6.5 6.2
Change-Id: Ifb2495de2685b7a2f80f8d39ab57d5985fe0eec1
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-21 23:37:24 +00:00
Lorn Potter
589c6d066f wasm: add setting type to Blob
Blobs can be any mime type, add function that sets up mime type

This allows Safari to play videos that are Blobs

Pick-to: 6.5
Change-Id: Ide63851934058935d94f42721b246d832e3bcb85
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-04-21 06:18:32 +10:00
Ahmad Samir
79b36f3bc2 QSet: fix a qdoc warning about method signature
Pick-to: 6.5
Change-Id: I34d73e588e95603579a05bd13fc55d1eab5004f8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-04-20 20:39:23 +02:00
Volker Hilsheimer
87535e4e43 QTimer: optimize single shot timers that cross thread
Amend 4d90c4e74a by clarifying why
moving the QSingleShotObject to the receiver's thread is a good
idea. Move that logic into a separate function and use that also
for the string-based connection.

Optimize the implementation by delaying the timer creation until
after we have moved the QSingleShotTimer object to the target
thread, using a queued metacall if needed to create the timer.
This avoids the creation of the timer in the wrong thread and
then the recreation of the timer in the new thread when QObject
handles QEvent::ThreadChange.

To avoid that the timer is created when it has already expired in
real time, use a deadline timer and fire timeout immediately when
it has expired by the time we get the metacall.

Since the timerId might now not be initialized in the constructor,
initialize it to -1.

Augment the crossThreadSingleShotToFunctor test function by
deliberately not starting the thread until the deadline expired.

[ChangeLog][Core][QTimer] Single-shot timers with a string-based
connection are now started in the receiver's thread, not in the
thread that creates the timer.

Task-number: QTBUG-112162
Change-Id: I3fc94c34c21d9f644da41a2e4c2da479980b8580
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 20:23:37 +02:00
Axel Spoerl
d4b40fa96b QTabBar: draw text within moving tab
When a tab was moved by dragging, the tab's rectangle was drawn empty,
without the tab text. When a tab was moved by animated snap back to
its original position, the tab text was already drawn on the original
position, while the rectangle was still moving due to animation.

Adds the enum value QStyleOptionTab::TabPosition::Moving
When this option is set, QCommonStyle draws the tab text at the
current position instead of the original home position of the tab.

The QMacStyle switches over the TabPosition enum. As a moving tab
is laid out like the last tab in the given orientation, the enum value
Moving is treated like End.


Fixes: QTBUG-112277
Change-Id: I42a2d9c269dadfe9819c12dbc69e3ae995a45b09
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-20 16:02:42 +02:00
Timothée Keller
3d0fb2cea9 Windeployqt: Add a check for LLVM-MinGW runtimes
The compilerRuntimeLibs now pays attention to if the user is running
MinGW, or LLVM-MinGW, before deploying the corresponding runtimes from
the Qt binary folder, or from the path if it cannot find any in the Qt
binaries.

[ChangeLog][QtTools][Windeployqt] Windeployqt now supports LLVM-MingGW
runtimes.

Pick-to: 6.5
Change-Id: I9c464cdb933795e491992f5d1adb18bcc7d69f02
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
2023-04-20 15:59:14 +02:00
Eirik Aavitsland
daa77824b3 Refix printing of dpr>1 images on Windows
This modifies 9e453dacc3 to make sure
that QPainter uses the adjusted DPR when doing the tile copying.

Fixes: QTBUG-99990
Pick-to: 6.5 6.2
Change-Id: Id9c7b5576d5036e20bb399f3c8b82d4a467dc70f
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2023-04-20 15:54:28 +02:00
Edward Welbourne
cb54fa634a Expand range of allowed UTC offsets to 16 hours
It turns out that Alaska and The Philippines had historical offsets
exceeding 15 hours, prior to day-transitions to bring their dates in
sync with their respective sides of the international date line.

Change-Id: I48fdf3aa6d8c0bacb368d08316733a10ee11a281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 15:17:26 +02:00
Edward Welbourne
455abef6c6 Improve QTimeZone's documentation about territories
Clarify that a zone whose territory() is AnyTerritory may simply not
have a known association, or cover several territories.

Added more \sa links to territory(), where relevant.
Fix some surviving uses of country for territory.
Split some long lines.

Pick-to: 6.5 6.2
Change-Id: I9196f785afed9bc185a459608c5d9361127401cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-20 15:17:26 +02:00
Edward Welbourne
970841235b Split multi-file Files entries in qt_attribution.json as lists
This is now the official format for Files, when there's more than one,
rather than using space-joined lists.

Pick-to: 6.5
Change-Id: I4a6247fff0ece8ece2944178af38894fd5a2e1e2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-04-20 14:17:26 +01:00
Edward Welbourne
ce8839e056 Deploy Comment fields in qt_attribution.json files
Replace the old abuse of other fields as comments, to be overwritten
by a later setting to a proper value, with actual Comment fields, now
that we have them.

Added a new comment to the valgrind files to say where they come from
in the upstream.

Pick-to: 6.5
Change-Id: I2edcfa2949fa9e59f3f67d3e578d8e5009854cf6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-04-20 14:17:26 +01:00
Edward Welbourne
1bf1aec790 Update the list of CLDR-based files
The corelib/text/qt_attribution.json didn't mention the
time/q*calendar_data_p.h files which are also generated from CLDR.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I768555d4623204245006897c45af58635761bfa1
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-04-20 14:17:26 +01:00
Mårten Nordheim
7a92304040 FontDatabase[win/freetype] implement population of aliases
We rely on this function discovering extra fonts if we cannot find any
or only find poor matches for our font request. Whether that be because
we had only partially populated the fonts of a given family or because
the user specified a font using a localized name.

It's a copy-paste of the implementation in qwindowsfontdatabase

Fixes: QTBUG-111854
Pick-to: 6.5
Change-Id: I0dd97b68d84417a26ce82a46f39804b36602ed67
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-04-20 13:17:25 +00:00
Liang Qi
fed79b873e QWidgetTextControl: emit cursorPositionChanged() when select all
Fixes: QTBUG-91643
Pick-to: 6.5
Change-Id: I31745a3106321da0be4074a33768da8b84a8ae3f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-20 15:17:25 +02:00
Axel Spoerl
034a071bda QGtk3Theme: Improve fixed font delivery
The gtk_fixed widget was used as a reference to obtain a fixed font
and HeaderViewFont.

This is a mistake, because the gtk_fixed widget is a container for
other widgets with fixed geometries and no layouting.

This patch makes the default style being used for a fixed font and, as
a drive-by, the combo box as a reference for a header view font.
A monospace based css provider as explicitly added to the style
context, in case a fixed font is requested. The provider is removed
afterwards.

Task-number: QTBUG-112896
Pick-to: 6.5
Change-Id: I6bfb2ee9e7befdd2102bdcc6e53ced954a024034
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-20 14:01:22 +02:00
Laszlo Agocs
84f9293ea2 wasm: QOpenGLWidget: ensure depth write is enabled when calling paintGL
Task-number: QTBUG-111304
Pick-to: 6.5 6.4
Change-Id: Ibe9f886b12c89fad7431b77b55c259b15d83559b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-20 14:01:22 +02:00
Amir Masoud Abdol
972d602ee6 Exclude Android Vulkan sources from Unity Build
If not excluded, `VK_USE_PLATFORM_ANDROID_KHR` might end up being
undefined due to the order of includes.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ib7bbf42af319568bc39db0b9e5c796d25db3c364
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-20 11:34:41 +02:00
Andrey Butirsky
d76e1d9cbd qxkbcommon: Amend comment for Qt::Key upper-case transformation
This should make it clear enough that the issue here is a quirk of
Qt::Key and not something otherwise special about case-change affecting
whether a character is in Latin-1 (for all that this is the root cause
of the quirk in Qt::Key).

Pick-to: 6.5
Change-Id: I80fa6b78a0d0c431401a3fea18edf6149de08b92
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-20 09:34:37 +00:00
Mario Roessel
298c950912 QXkbCommon: set Qt::KeypadModifier when keypad button is pressed
Pick-to: 6.5
Task-number: QTBUG-111503
Done-With: Liang Qi <liang.qi@qt.io>
Change-Id: Ic7ca48ea8709d38aa83c95a9b5a7d39ff82f08c7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-04-20 06:14:58 +00:00
Friedemann Kleint
936fe007ee Fix setting combo data with QSortFilterProxyModel
qtbase/c27d2a57a441f9a1ce760e71635bd4c96882249d caused the code
to go through QStandardItemPrivate::setItemData() which does
not handle the special treatment of Qt::EditRole completely.

In the constructor of QStandardItemData; map Qt::EditRole to
Qt::DisplayRole to fix this as is done in setData().

Adapt the existing tst_QStandardItemModel::getSetItemData() to check
whether both roles are received in the dataChanged() signal.

Pick-to: 6.5
Fixes: QTBUG-112326
Change-Id: I133d058bacc3388c612c5b4fb18b54f5ef5cb56f
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-19 20:26:24 +02:00
Amir Masoud Abdol
22b0ed0757 Resolve duplicate symbols
Turn some of the static variables into private static data members to
avoid symbol duplication during the unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I9e3ee18f6e85a0f806de77f753d89a45ceaff7ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-19 20:09:41 +02:00
Amir Masoud Abdol
c2fd824160 Exclude files from unity build to resolve Android's build
There are several duplicate symbols defined across android source files.
For now, excluding the conflicting files allows us to continue working
on bringing unity build to CI. I added some explanation and TODO's on
what I think can be done for resolving the conflict.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic0b31c4ae845c69570ea5dd86316e5a795c166c4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-19 20:09:41 +02:00
Liang Qi
70f064f270 QWidgetTextControl: ignore invalid input method event
to avoid update the text document.

Fixes: QTBUG-112953
Pick-to: 6.5 6.2 5.15
Change-Id: Ib72de57133314e4eb38a15758b8318d901196d75
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-04-19 19:01:54 +02:00
Edward Welbourne
c30e52e199 Notes on the Solar Hijri calendar
A little reading leads me to learn that there are several variants, so
document which this one is; also note the accurate form of the
yearLength constant, and fix a mis-indented comment-end.

Change-Id: Ia1987dda9f4caee4e52c0cfd894976908c8f4b1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-19 16:40:36 +01:00
David Faure
b06ae63e8f QComboBox: don't call index(-1, 0) on the underlying model
This is invalid and might assert in the model (e.g. in
QConcatenateTablesProxyModel)

Pick-to: 6.5 6.2
Change-Id: I6602d8b9eca83ef6cae760944a999d55244bb181
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-19 14:11:35 +00:00
Eskil Abrahamsen Blomfeldt
25530c7020 win: Fix default fallback font for some languages
In Qt 5, the system font would resolve to MS Shell Dlg 2, which
was always an alias for Tahoma. Since it was not a real font,
but a so-called "logical font", it was manually added to the font
database whenever we detected that the system font was not
automatically enumerated.

In Qt 6 we modernized the selection of system font. This causes
real fonts, such as Segoe UI, to be selected as the default and
the manual adding of "MS Shell Dlg 2" to the font database never
happens.

However, "MS Shell Dlg 2" was still preferred as the primary
fallback font, but we now always failed to resolve it because
it wasn't in the font database. For many writing systems not
supported by the main system font, such as e.g. Thai, people
still expect to get Tahoma as the default, but we now return
an arbitrary font from the alphabetically ordered list instead.

To work around this, we avoid returning the non-existing logical
font, since this is no longer useful, and just return Tahoma
directly.

[ChangeLog][QtGui][Text] Fixed an issue querying a default font
for certain languages not supported by the primary system font.

Pick-to: 6.2 6.5
Change-Id: Iacc7a7e7742114efcd82620d0ed099dc4e897fc6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-19 15:11:35 +01:00
Ulf Hermann
a3f2857ebc QContainerInfo: Detect presence of reserve()
This is handy if you want to reserve if possible or just fill the
container right away if not.

Task-number: QTBUG-112227
Change-Id: I3d085c1ce2448150bc044c3513572e02161244f4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-19 14:07:05 +02:00
Samuel Thibault
9a35bd02dc Revert "fix AT_SPI_BUS_ADDRESS actually working"
This reverts commit be09628e15.
because db346e711c avoids the issue
entirely by calling this code after connecting the event.

Task-number: QTBUG-43674
Pick-to: 6.5
Change-Id: I72f5b161208aa3691e194f4ba7782d288602bbf3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-19 10:55:02 +00:00
Vladimir Belyavsky
bf0f1fa7d1 Revert "Apply system background color for top level window"
This reverts commit 2991c66b75.

Reason for revert: it caused a regression with translucent Qt Quick windows. We need to find alternative way how to fix QTBUG-106583
taking into account QQuickWindow's own color property.

Fixes: QTBUG-112473
Fixes: QTBUG-112537
Fixes: QTBUG-111969
Fixes: QTBUG-112524
Pick-to: 6.5
Change-Id: I34258f4c8b045b63c8462e325b09fff927684223
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-19 12:55:02 +02:00
Rami Potinkara
3d98f3d6ed Android: add missing private classes to Qt6Android.jar
Old Android Extras related classes were missing. Now added.

Fixes: QTBUG-111823
Pick-to: 6.5 6.2
Change-Id: Ib45daf687fc24a1c528f62da8ffe52422bea0b6b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-19 09:50:30 +03:00
David Faure
fed4c3ecba QComboBox: don't call data(invalid index) on the underlying model
QComboBoxPrivate::itemIcon() wasn't checking for an invalid index,
unlike QComboBoxPrivate::itemText().
QComboBoxPrivate::setCurrentIndex calls updateLineEditGeometry,
which calls QComboBox::itemIcon, even for an invalid combobox.

Pick-to: 6.5 6.2
Change-Id: I5e6105ae56836cd237a91a405d331f1424f49b37
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 22:32:32 +00:00
Marc Mutz
dae858b710 QtGui: establish removed_api.cpp for upcoming QT_GUI_REMOVED_SINCE
Change-Id: I9715c11fc6431e7046193a1d68807155ad7bea05
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-19 00:32:23 +02:00
Thiago Macieira
1e566d19dc QTimerInfoList: remove code that attempted to repair time on clock jumps
We only use monotonic clocks now (std::chrono::steady_clock). This
probably didn't work very well anyway.

Change-Id: Ieec322d73c1e40ad95c8fffd17465f06b5b2816f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-18 19:23:46 -03:00
Thiago Macieira
cf1b8740b9 QDeadlineTimer: stop using the t2 member and mark for removal in Qt 7
Change-Id: Ieec322d73c1e40ad95c8fffd17465c06aca0c14a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-04-18 19:23:46 -03:00
Thiago Macieira
39be743e5c QDeadlineTimer: remove internal TimeReference class
This removes all uses of QDeadlineTimer::t2 member in the .cpp (so it
gets marked [[maybe_unused]]) and greatly simplifies the code.

Change-Id: Ieec322d73c1e40ad95c8fffd17465bd50c1113ea
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 19:23:45 -03:00
Thiago Macieira
7ba76731ef QDeadlineTimer: use if constexpr instead of function specializations
You can't partially specialize a template function, so these
specializations for steady_clock only worked if the Duration parameter
was nanoseconds. This could have been solved with function overloads
instead, but I find the if constexpr code simpler to read.

Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd17468bd73fc2fe24
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-18 19:23:44 -03:00
Thiago Macieira
b498e1ae3a QDeadlineTimer: use std::chrono::steady_clock everywhere
This matches the work that was done for QElapsedTimer. The
QDeadlineTimer::t2 member is now always 0.

This also removes the last distinction of timer types. Originally I had
intended to use CLOCK_MONOTONIC_COARSE on Linux[1], but that created
more problems than was worth, so I abandoned the idea in 2016.

[1] https://codereview.qt-project.org/c/qt/qtbase/+/159933

Change-Id: Ieec322d73c1e40ad95c8fffd17468b313798ef79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-04-18 19:23:44 -03:00
Thiago Macieira
c9f4c0d45e QElapsedTimer: rewrite using std::chrono::steady_clock everywhere
This commit deletes the direct, low-level functionality that
QElapsedTimer has carried since it was introduced. Everything now uses
only std::chrono::steady_clock and std::chrono::nanoseconds.

QDeadlineTimer temporarily still uses qt_gettime(), which is moved to
qcore_unix.cpp.

Task-number: QTBUG-110059
Change-Id: Ieec322d73c1e40ad95c8fffd174641a469b1eee5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-18 19:23:42 -03:00
Thiago Macieira
13f0ee021e QWaitCondition/Unix: sort and organize includes
Change-Id: Idd5e1bb52be047d7b4fffffd174ea54b8e954387
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-18 19:23:42 -03:00
Thiago Macieira
eac30fcb82 QWaitCondition/Unix: use QDeadlineTimer's <chrono> support
We don't need to hand-roll our own conversions when QDeadlineTimer can
convert to the time points of any std::chrono clock. In particular, if
the clock we ask for is the clock its internal representation is already
storing, then it's more efficient too.

Change-Id: Ieec322d73c1e40ad95c8fffd174689a171cb6f18
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 15:23:41 -07:00
Thiago Macieira
2a997942db QWaitCondition/Android: remove support for relative time waits
This actually saves two clock_gettime(CLOCK_MONOTONIC) system calls
(albeit to the vDSO): one inside QDeadlineTimer::remainingTimeNSecs() to
calculate the remaining time from the deadline, then one other inside
pthread_cond_timedwait_relative_np() to calculate the deadline from the
timeout, so it can place the FUTEX_WAIT_BITSET system call.

In fact, I can't find __pthread_cond_timedwait_relative() in the Bionic
source any more. The last reference was removed in 2015, when Bionic
started using FUTEX_WAIT_BITSET. So this commit is just removing dead
code in current Android.

Pick-to: 6.5
Change-Id: Ieec322d73c1e40ad95c8fffd174689c4fcff40ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-18 19:23:40 -03:00
Thiago Macieira
ccd3f2369a QWaitCondition/Unix: Modernize the call to pthread_condattr_setclock
This avoids creating and destroying the pthread_condattr_t on systems
without a monotonic clock (INTEGRITY) or for which we can't ask that
pthread_cond_t use it (Darwin).

Change-Id: Ieec322d73c1e40ad95c8fffd1746878316ab8708
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-04-18 19:23:40 -03:00
Thiago Macieira
840af18b8d QElapsedTimer/Darwin: merge with the Unix implementation
Old versions of the Apple operating systems did not implement the POSIX
realtime monotonic clock, so we used the Mach absolute timer. The LLVM
libc++ implementation[1] unconditionally uses CLOCK_MONOTONIC_RAW on
these OSes:
 * macOS >= 10.12
 * iPhoneOS >= 10.0
 * tvOS >= 10.0
 * watchOS >= 3.0

Qt 6 doesn't support the latter two and the former two are much older
than what we require, so we can use this functionality too.

[1] https://github.com/llvm/llvm-project/blob/main/libcxx/src/chrono.cpp

Change-Id: Ieec322d73c1e40ad95c8fffd174641c723b81be2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-04-18 19:23:39 -03:00
Andreas Eliasson
4c34894075 Doc: Fix typo
It should read ISO-8859-1, not IS0-5589-1.

Fixes: QTBUG-112735
Pick-to: 6.5 6.2 5.15
Change-Id: I8247264d39f2af5b2f9699564cdd576df65cd9b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-04-18 13:39:26 +00:00
Laszlo Agocs
e539e9a7af rhi: Replace the temporary GPU time query API with a saner one
Modeled after Metal's cb.GPUStart/EndTime. Implemented with timestamp
queries for other APIs.

Implemented for Metal, D3D11, Vulkan for now. No more callback, just
a getter on the command buffer which returns the latest known value,
referring to some previous frame. This makes it a lot more usable
than the original solution that is not really used anywhere at
the moment.

Now works for offscreen "frames" as well, this was not implemented
before.

Opt in with a new QRhi::create() flag because we cannot tell in
advance if the getter will be called or not, and this way we can
skip recording the timestamps by default. The cost is probably
minimal, though. Qt Quick will set this automatically when running
with QSG_RHI_PROFILE=1.

Change-Id: I903779984a4e0bbf1d03806d04bf61571ce23d72
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-18 15:35:28 +02:00
Laszlo Agocs
62a4ca773a rhi: Make it safe to always call deleteLater on a resource
...even when the QRhi is already gone. This should not happen in
well-written applications and libraries, but we handle this
gracefully in the regular dtor and destroy() for resources that
register themselves to their creator QRhi, so by registering
everything we can offer this to all QRhiResource subclasses.

We still want to differentiate between native resource owning
QRhiResources and others (that do not create native graphics
objects), so do this via a flag passed to registerResource().
This way the behavior with QT_RHI_LEAK_CHECK=1 does not change.

Pick-to: 6.5
Fixes: QTBUG-112914
Change-Id: I9bafc81ef7a4ae76f356fc5f6248628d1f8791e0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-18 14:42:45 +02:00
Morten Sørvig
e3c9dce0b6 Use QHighDpiScaling when determining scale factor
The makes sure that the scale factor used by the style
is identical to the scale factor used by Qt Gui, by for
instance taking scale factor rounding into account.

Task-id: QTBUG-109715
Change-Id: Ia0354a7ce0f51eb9fd5f2591ee6c4057291943f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-18 12:42:45 +00:00
Mikolaj Boc
020f03c47e FileDialog: Use well-known DeleteOnClose instead of custom lambda
The custom dialog-deleting lambda in QFileDialog::saveFileContent
is redundant

Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 13:39:20 +02:00
Vladimir Belyavsky
f6908c4f71 QNetworkInformation[Win]: Improve WinRT exceptions handling
- handle only winrt::hresult_error exceptions, as this is the only
reported cases, so we don't need ellipsis there
- print relevant warnings

Pick-to: 6.5
Change-Id: Ibf18a7eab7862e2c20f5729545387ddc7ca42952
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-18 11:39:20 +00:00
Volker Hilsheimer
ca978e2c12 QStyleSheet: rotate QSizeGrip image around center
Depending on the corner that the size grip lives in, the style sheet
style rotates the painter before rendering the drawable. However, that
needs to be done around the center of the size grip, not around the
origin, as otherwise the image rotates out of the rect.

Use a static array to map the corner to the rotation value, and
translate/rotate/translate back only if there is a rotation.

Pick-to: 6.5
Fixes: QTBUG-112252
Change-Id: I59f69385bd6699ecc8db46390c5f7cc933574ce8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-18 13:23:48 +02:00
Fabian Kosmale
cb30e45b9a Avoid capturing same property twice
Avoid capturing the same property multiple times in a binding by
storing them in the BindingEvaluationState. We store them in a
QVarLengthArray array, as the number of properties involved in a binding
is expected to be rather low, so a linear scan is fine.

Avoiding double capture is a good idea in general, as we would otherwise
needlessly reevaluate bindings multiple times, and also needlessly
allocate memory for further observers, instead of using a binding's
inline observer array.

Even more importantantly, our notification code makes assumptions that
notify will visit bindings only exactly once. Not upholding that
invariant leads to memory corruption and subsequent crashes, as
observers allocated by the binding would get freed, even though we would
still access them later.

Fixes: QTBUG-112822
Pick-to: 6.5 6.2
Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 13:23:48 +02:00
Laszlo Agocs
2b908ba8f4 QOpenGLWidget: correct the lifetime of the wrapper texture objects
If the QOpenGLFramebufferObject (which owns the OpenGL texture object)
is destroyed, the wrapper QRhiTexture must be destroyed too.

This surfaced with WebAssembly for some reason, likely due to an event
(most likely resize) sending pattern that is different from other
platforms. Sending more resizes likely triggers another recreateFbos()
call which, until now, did not correctly dropped the wrapper
QRhiTextures so those continued to refer to the now-destroyed texture
IDs.

Pick-to: 6.5 6.4
Task-number: QTBUG-111304
Change-Id: Ieed9a11c5c28da0fee497107ebe88da9eb5f45a8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-04-18 13:23:48 +02:00
Jan Moeller
ffdfafc4b4 Ignore removed/changed screens if no QIOSIntegration instance exists
QIOSTracker registers itself as handlers for system notifications about
changes of the screen environment. If no QIOSIntegration instance
exists, newly detected screens are not added to the list of known
screens (see screenConnected()). This, in turn, will result in a crash
if a screen is disconnected and removed in screenDisconnected() as it
is not known to qtPlatformScreenFor() and the function returns a
nullptr.

Consider the QIOSIntegration also whenever a screen is "changed". This
is more of a safety measure do avoid crashes for unknown screens.

This situation occurs if an iOS device is used to mirror the display
via AirPlay and no actual QGuiApplication exists, e.g. Qt is only
embedded in a Framework.

Pick-to: 6.5 6.2
Fixes: QTBUG-106701
Change-Id: Id778fc5afa7c284b0536ee02b1ba2c10321cc5b1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
2023-04-18 09:22:46 +02:00
Volker Hilsheimer
c4449c040c Add helper template for metacall event creation
Setting up the args and types arrays is cumbersome and error prone, and
we do it at least twice in qtbase. Provide a central implementation as a
variadic template function, and make it exception-safe with a unique_ptr
(the destructor of QMetaCallEvent will destroy the cloned arguments).

Change-Id: I5ff400467928446264eaedddb394691e9e23d22e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-18 00:11:13 +02:00
Christian Ehrlicher
db7dc35897 SQL: replace qPrintable() / toLocal8Bit() with unicode versions
Replace qPrintable() and toLocal8Bit() with qUtf16Printable()

Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-18 00:11:05 +02:00
Friedemann Kleint
69d4ecd6ef Remove unused documentation code snippets
Modules:
- Core
- Gui
- Widgets
- Open(Widgets)
- PrintSupport
- Sql
- Network
- Concurrent
- Testlib

Pick-to: 6.5
Change-Id: I63e58c01bec4bd162486020f0085227fdaa83b18
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-17 21:02:32 +02:00
Timothée Keller
94279afff8 Windeployqt: change MinGW dll's import location
The MinGW runtimes were imported through the PATH, which creates
mismatches with the expected libraries that are installed directly
through Qt. Check if those can be used instead, and issue a warning
(and default to PATH) if not.

Fixes: QTBUG-112448
Pick-to: 6.5
Change-Id: I061baabb6d6188bd0817b68c39a5d9f04ff391b5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-17 16:24:59 +02:00
Kai Köhne
a03fdd65ee Doc: Fix dead link in QCA::translate()
There's no 2nd translate() method. Instead, link to the section about
I18N in the summary.

Pick-to: 6.5
Change-Id: I7c3177cee91eeb550eb24b6f272a175b5c0e5487
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-04-17 16:23:24 +02:00
Laszlo Agocs
5f3c3044a5 rhi: d3d12: Implement debug markers
As usual this is only doing anything when launched with
QSG_RHI_PROFILE=1. Otherwise the debugMark* functions are
no-ops.

Uses the old PIX API (pix.h) since that is what is available in the
Windows SDK. This works well with RenderDoc. The strings show up
in PIX captures as well although that will warn that the pix.h stuff
is deprecated. Unfortunately using the PIX3 API involves headers and
libraries not part of the Windows SDK so we do not want to open that
can of worms now.

Problem is, pix.h may not be present in some SDKs as shown in the CI.
So use __has_include and lose the whole feature if the header is not
present at build time.

Change-Id: I8606d151f75a492071bf0c8d98b16026ff94d45c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-17 16:06:17 +02:00
Ahmad Samir
044a29bc66 corelib/global/*.h: use static_assert instead of Q_STATIC_ASSERT_X
qtconfigmacros:
Otherwise we'd need to include <QtCore/qassert.h> before using
QT_REQUIRE_CONFIG. It cannot be added here as qassert.h itself uses
QT_CONFIG, i.e. qassert.h needs to include this header. And
Q_STATIC_ASSERT_X is only kept around to keep old code working.

_Static_assert is deprecated in C23:
https://en.cppreference.com/w/c/language/_Static_assert

Change-Id: Ie60a02274cc5be8bd1c6dc3819ccfbc2e7864a21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-16 22:17:51 +02:00
Giuseppe D'Angelo
3b81d04bc6 QMetaType: more doc tidies for the flags
Change-Id: I354b2dc901ecb1b2baa717c74e265e9201d8e63e
Pick-to: 6.5 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-16 12:00:24 +02:00
Giuseppe D'Angelo
ecfa13bdac QMetaType::IsGadget: doc tidies
Although undocumented (which is weird, as other docs refer to it),
fix the spelling and the formatting.

Change-Id: Ief8b04e3b9272386c663c463c3659e8b837260f5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-04-16 12:00:17 +02:00
Ahmad Samir
c1e1d133c4 mimetypes/: port to qsizetype
Fixes compiler warnings about narrowing conversions.

Found by compiling with clang and -Wshorten-64-to-32.

Drive-by changes:
- use range-for instead of an iterator based loop
- use strlen("*.") instead of magic number 2

Pick-to: 6.5
Task-number: QTBUG-102461
Change-Id: I0bf2299049c0411ed496468238ca30b69946ffc2
Reviewed-by: David Faure <david.faure@kdab.com>
2023-04-15 17:21:10 +02:00
Christian Ehrlicher
8ca2d6ba09 CommonStyle/QSpinBox: fix rendering up/down symbols in high-dpi mode
The previous patch for QTBUG-112019 could lead to an uneven length which
in results in an incorrect center. Fix it by making sure that the length
(and width) of the two rectangles are even so we always get a proper
center without fiddling around with float values. Also honor
PM_ButtonShiftHorizontal/Vertical now (was forgotten in the last patch).

Pick-to: 6.5
Fixes: QTBUG-112019
Fixes: QTBUG-112861
Change-Id: Ifc19b863c761ae545208b996ba60d1f33bceb2b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 13:56:27 +02:00
Frederik Gladhorn
db346e711c Fix accessibility on XCB when running as root
Accessibility actually works when running applications as root, but we
would never properly connect, since the enabledChanged signal would be
emitted from the constructor in this case. So after connecting the
signal, check the value by hand to make sure not to miss the
notification.

Only applications running as root would be affected, because all other
applications would go through the asynchronous pattern of getting the
bus address from dbus instead.

[ChangeLog][QtGui][Accessibility] On XCB applications running as root are
now accessible.

Pick-to: 6.5
Fixes: QTBUG-43674
Change-Id: I82cdc35f00693a8366dfcdab2f2c3c6dc5f5b783
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-15 05:48:27 +02:00
Vladimir Belyavsky
5564b166a3 QNetworkInformation[Win]: Catch potential WinRT exceptions
Some Windows SDKs seem to throw an exception from winrt::check_hresult()
We need to handle this accordingly. Catch the exception and print relevant warning.

Fixes: QTBUG-110408
Pick-to: 6.5
Change-Id: I1434ec425f0d0e597308b53f25f4f15049640060
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-14 21:26:29 +03:00
Christian Ehrlicher
d71dc36f47 QSQLDatabase: avoid some code duplication
Avoid some code duplication and enhance the documentation about
thread-safeness of QSQLDatabase::cloneDatabase()

Fixes: QTBUG-60505
Change-Id: I6ca6b9f47d818d49ca51395da14051e40317cef6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-14 19:25:55 +02:00
Amir Masoud Abdol
6de26ae531 Exclude thread/qwaitcondition_unix.cpp from the Unity Build
Temporary exclude `qwaitcondition_unix.cpp` from the unity build, until
either of the mentioned change sets get merged.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Iaacd090647ba007e0ab714dc674e67552f85c350
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:06 +02:00
Amir Masoud Abdol
38d56e2b72 Add [[maybe_unused]] attribute to an unused variable
Otherwise, it could break the unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b3ac51b8a9e8bb93a3b1a4d6717fa45099e91b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-14 18:34:05 +02:00
Edward Welbourne
76075aa3a9 QDate: enable {start,end}OfDay() to make second-adjustments
Previously it only got the answer correct to the minute. That's good
enough for most transitions, but those involving local solar mean time
(LMT) may have second deviations. So check the second before or after,
that'll usually be the other side of the transition; if it isn't, do a
further binary chop on seconds to hit the correct value.

Most zones' canonical locations are only specified to the size of a
city, so second precision is all anyone cares about; a few hundred
metres difference in location would change that. The one exception is
Europe/Amsterdam, which had its own Royal Observatory and time
standard, hence had an offset known to greater precision; but the IANA
DB duly approximates that, too, so we won't have data with millisecond
precision even in that case, so don't try to refine beyond second.

Change-Id: I20fb355f8113c32387ed8a84fbf5a41004273978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-04-14 13:23:50 +00:00
Edward Welbourne
d30d566f8d Minor tidies in the TZ time-zone backend
Taking the size() of a list before append()ing to it saves the need to
subtract 1. Add some missing assertions.

We can now use sliced(), rather than mid(), to trim a string or byte
array. We can do such trimming on a view, rather than allocating for
the trimmed part.

Change-Id: I8eff46ea6545a66c765c2d79aa1162c3044ca1cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2023-04-14 15:19:01 +02:00
Ilya Fedin
c3f00ce3e3 Revert "Gtk3Theme: set XCURSOR_SIZE and XCURSOR_THEME for wayland sessions"
This reverts commit c0b0c7bebb.

QPlatformTheme::MouseCursorTheme and MouseCursorSize was added in
qtbase a823366f77 and qtwayland client
supports it in 1c25db5e3f23d48e330170f41b94fbd532932b02.

Pick-to: 6.5
Change-Id: Icef2f50d495ac802e3a591d92c222523972b2066
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-04-14 10:36:42 +00:00
Tor Arne Vestbø
9618427ee5 Revert "macOS: add default Edit menu items, if not added by AppKit"
This reverts commit d42cfeb84f.

Trying to help AppKit by adding the dictation and emoji edit menu items
ourselves resulted in sometimes adding the entries twice, when we failed
to detect the existing entries, or AppKit failed to detect our entries
as a reason to not add its own.

In addition, even if the entries we added were detected by AppKit and
AppKit was smart enough to not add its own, our entries were relying
on the developer to provide translation, instead of building on the
translations that AppKit already provides. And the keyboard shortcut
we set for our entries were not following system and user preferences
for which keyboard combination should trigger the entries.

Fixes: QTBUG-104709
Task-number: QTBUG-79565
Pick-to: 6.5
Change-Id: I3fabc41f85df917dbb669253ad441bccea8a5e35
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-13 20:54:46 +02:00
Amir Masoud Abdol
4b00aaae9c Add the missing include guard
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I6a46784fa65aecd48a7f59021c4942ed52321742
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-13 20:16:08 +02:00
Amir Masoud Abdol
9031142e63 Replace a duplicate symbol
Removed the two identical functions and directly call the `static_cast`
in their place. This is to resolve a build issue when doing unity build.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I174b601e06c4acdea45cc66495c09aafba6f48f6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-13 20:16:08 +02:00
Alexey Edelev
4fb7eebc70 Rid of 'special case' markers
It's unlikely we will ever use pro2cmake at this project stage,
so it doesn't make any sense to keep the 'special case' markers
in the CMake scripts. Remove them and replace with TODO where
needed.

Change-Id: I84290c20679dabbfdec3c5937ce0428fecb3e5a7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-13 18:30:58 +02:00
Tor Arne Vestbø
06499383ca Use LANGUAGE OBJCXX rather than COMPILE_FLAGS "-x objective-c++"
We sometimes use Objective-C++ code in files with a .cpp extension,
to avoid the churn of adding a foo_mac.mm file. Instead of manually
telling the compiler to build these files in Objective-C++ mode, we
use CMake's intended mechanism, which means genex constructs such as
$<$<COMPILE_LANGUAGE:OBJCXX> will work for these files as well.

Pick-to: 6.5 6.2
Change-Id: If295c3f34f6bee9f4d9f877f519c9c7770665fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-13 14:36:26 +02:00
Axel Spoerl
d953bc76bb QAbstractButton::setChecked() - don't update accessibility if stale
A QPointer is used as a guard for calling setChecked on a stale object.
The guard is not checked on accessibility updates.

This patch wraps the accessibility update in a guard check.

Fixes: QTBUG-112759
Pick-to: 6.5
Change-Id: Ida47c181b7968911c1805dc244b86347e7afe81b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-13 10:03:52 +02:00
JiDe Zhang
143d00cc2c rhi: gl: Fix GL_INVALID_OPERATION error at glPolygonMode
Fixes: QTBUG-112756
Pick-to: 6.5 6.4 6.2
Change-Id: Id03bf805d70754818a98606b81a08a70d06853ba
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-13 09:25:36 +08:00
Christian Ehrlicher
d7607a463d QSqlError: Make QSqlErrorPrivate implicitly shared
Make QSqlError implicitly shared and adjust the ctors / assignment
operators to be consistent with other implicitly shared Qt classes.

Fixes: QTBUG-91912
Change-Id: Ie73292817fd4e7b274a3033a74d62e712a01c2b0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-12 21:00:11 +02:00
Allan Sandfeld Jensen
be37561497 Default NVidia EGL to GLES2
Found some documentation saying NVidia provided desktop GL for
development purposes only, and recommmended against using it. Not sure
if that applied to all NVidia drivers, or only that one embedded
platform, but since we have multiple bugs about EGL not working on
NVidia, default to using GLES2 like it suggested.

Change-Id: If8ac8dd61c4ceb88162360f1eaa2a096acefa9c6
Pick-to: 6.5 6.2
Fixes: QTBUG-105921
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-12 18:46:33 +02:00
Volker Hilsheimer
bbd6cbd71c windows: Re-apply mask when DPI changes, to account for new scale factor
When the DPI of a window changes due to being moved to another screen,
or the current screen reconfiguring, the mask we've set earlier is no
longer correct, as the mask was set based on the original screen's
scale factor and in relation to the former platform geometry of the
window, which now has changed.

Like the geometry of a QWindow, the mask is expressed by the user in
the QtGui coordinate system, so it's the platform's job to transform
this into the platform coordinate system and update it when needed.

Add a manual test that users a QWidget and a Q(Raster)Window side by
side.

There's still an issue with the screen change being triggered to
early, via QWindow::setGeometry, instead of when the window has
actually moved to the new screen, resulting in the paint event
flushing to a window and backingstore that is in the wrong state,
but this requires further research to fix.

Task-number: QTBUG-97642
Pick-to: 6.5 6.2
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I7ab2d267fbaf6ac32b507d05a418eb025b354a0b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-12 15:41:23 +00:00
Oliver Wolff
6d9a8c30e9 windeployqt: Add option to skip plugin types during deployment
Pick-to: 6.5
Fixes: QTBUG-112317
Change-Id: Idb294105ee2006a36067d3967af1b7b55b375bd7
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-12 14:54:06 +02:00
Oliver Wolff
f8a3489bf0 windeployqt: Remove special handling of virtual keyboard plugin
virtualkeyboard is a qt module and thus covered by the "no-<module"
switch. The special handling is no longer needed with the more dynamic
approach of handling Qt modules.

Pick-to: 6.5
Change-Id: Ice6e30261e60b484669748411e019764bbdeaa55
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-12 14:54:01 +02:00
Tor Arne Vestbø
75995d8e58 macOS: Synthesize cursor updates on QCocoaWindow::setWindowCursor
The original issue for doing this was that invalidateCursorRectsForView
would not result in an updateCursor callback in certain scenarios on
macOS 11 and below.

In macOS 13, improvements to how tracking areas work now result in
also missing cursorUpdate calls when the mouse is pressed, which
makes sense for tracking areas in general (you don't want a drag
over a text field to reset the cursor to the I-bream), but not for
our specific case of setting a cursor synchronously.

To ensure the cursor is updated immediately, even if the mouse is
pressed, we synthesize a updateCursor event, just like we did for
the invalidateCursorRectsForView workaround.

It's up to clients of QWindow to manage their setCursor calls to
not happen during a drag operation, which we already manage in
Qt Widgets.

Pick-to: 6.5 6.2
Change-Id: I67d6e0f8e270b40da9879828455f4de943da7839
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-12 14:20:28 +02:00
Laszlo Agocs
9e0ebc36d6 rhi: Remove unused init flag
Change-Id: I289452f39fd161da0e0d7bf329e0922df6bbde8a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-12 11:23:37 +00:00
Laszlo Agocs
9807af617d rhi: Move generic setup code out of create()
Change-Id: I5222dd5479fe5c23b20bd08a2908a85be4d25e45
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-12 09:14:37 +02:00
Tor Arne Vestbø
a0675562ea Remove outdated comment about macOS cusorUpdate
Pick-to: 6.5
Change-Id: Ic270e9800b56e4fa1027245bebc4cd08a58abb3f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-12 02:28:05 +02:00
Laszlo Agocs
95198e7ad5 rhi: d3d11: Check ConstantBufferOffsetting in feature data
This is an additional attempt to have more "smoke testing" in
place for systems where there is no real 11_1 level driver
present. (we already test for Shader Model 5.0 above, now
also check this 11.1 feature indicating that
VSSetConstantBuffers1 is actually implemented)

This probing is important in particular for Qt Quick, where
there is an automatic retry with the software (WARP) adapter
when the initial QRhi::create() returns false.

This may or may not help the virtual machine case in the
associated issue, but is a valid check regardless since
we absolutely require constant buffer offsetting.

Task-number: QTBUG-78648
Pick-to: 6.5 6.4 6.2
Change-Id: I4d3c7b5c6c1f2b04b16c84b42c92651a3e671617
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-04-12 02:02:09 +02:00
Marc Mutz
2f95cd8f8b Long live QPromise::emplaceResult/At()!
And implement the rvalue overload of addResult() using it.

[ChangeLog][QtCore][QPromise] Added emplaceResult() and
emplaceResultAt() member functions.

Fixes: QTBUG-112270
Change-Id: Id369542215a60c0818f1afa8d564498be84732e8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-04-12 01:57:15 +02:00
Laszlo Agocs
82112db29d rhi: Remove readback result type alias
Change-Id: I1b14d3230ab4011506892c64ea03d5431d82a90d
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-12 01:11:12 +02:00
Laszlo Agocs
33b7a3b846 rhi: gl: Reset scissor before blit
glBlitFramebuffer is affected by the scissor test.

Fixes: QTBUG-103792
Pick-to: 6.5 6.4 6.2
Change-Id: I2eccc9f3e469af8b2fdff22e9fb7c2311c25b867
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-04-12 01:11:12 +02:00
Christian Ehrlicher
ed031ed18c SQL/MySQL: properly initialize variable
Properly initialize outBinds - even it should be initialized by
mysql/mariadb client lib we should correctly initialize it with 0 to
avoid valgrind warnings about accessing uninitialized data.

Pick-to: 6.5 6.2 5.15
Change-Id: I85b99a7e639dad9f8d24f554cd96c5997a5838ae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-11 23:40:33 +02:00
Volker Hilsheimer
6b67c3e738 macOS Accessibility: flag all synthetic elements as unignored
This saves us a few more roundtrips.

For rows and columns we could check if their accessibilityFrame
instersects with the table and so ignore rows and columns that
are outside of the view, but I'm observing weird corruptions in
the list returned by NSAccessibilityUnignoredChildren when
ignoring any objects.

Task-number: QTBUG-34337
Pick-to: 6.5
Change-Id: Ia2d13fff463ff26abb39acfceafcfa0761171203
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-11 23:33:52 +02:00
Volker Hilsheimer
52c2b82082 macOS Accessibility: Delay creation of table cell interfaces
Since macOS requires us to return an array with elements as the children
of a table's row. And it might ask for the children of many rows. This
is very costly, and results in a lot of QAccessibleInterface instances
being created unnecessary.

Instead, use unassociated QMacAccessibleElements as place holders for
cells, and place them in the column array of the QMacAccessibleElement
that represents the respective row. Those placeholder elements have the
synthesizedRole set to AXCell, and have the same axid as the table, for
as long as there is no corresponding QAccessibleTableCell created. Until
that point, they are in practice "managedByParent" just as the row and
column elements.

Since the place holder object knows about its column, row, and table, it
can respond to many inquiries directly without needing to create the
interface.

Once the QAccessibleInterface for the cell is required for an already
existing place holder, then we need to promote the place holder to an
independent element. We reset the synthesizedRole to nil, and change the
axid to the ID of the cell interface.

However, the cell interface might have been created and assocated with
an element before the placeholders were created when navigating through
the children of a row. So when we create an element for a table cell,
then we need to make sure that the table elements' corresponding row
is also populated, with the new element in the right place.

Pick-to: 6.5
Fixes: QTBUG-34337
Change-Id: Iff78e3b8335df8cf294fffb6579605bfeb8409ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-11 23:33:52 +02:00
Volker Hilsheimer
69a8d1293a macOS Accessibility: don't create an unnecessary interface
We only need to compare elements to determine whether this element has
focus.

Task-number: QTBUG-34337
Pick-to: 6.5
Change-Id: Ic1388ac00381735acfbf1e5877a658f4bd534dfb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-11 23:33:52 +02:00
Volker Hilsheimer
03b7e97907 macOS Accessibility: add an elementWithInterface helper
Instead of explicitly creating an ID from an interface and then asking
for the element for the ID, ask for the element for the interface
directly.

In that helper we can also make sure that the created element is
correctly configured if the interface for which it was created was for a
table cell.

Task-number: QTBUG-34337
Pick-to: 6.5
Change-Id: Id0f9247b0b50195301b293dcabb8925c3fc2d2cf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-11 23:33:51 +02:00
Volker Hilsheimer
042d753495 macOS Accessibility: optimize table interface implementation
Store row and column in the QMacAccessibilityElement when creating it so
that we can avoid linearly looking for ourselves in the parent's data.

Row elements have their m_rowIndex set, Column elements the
m_columnIndex, and elements representing a cell have both set. Cells
are not managed by the table.

Task-number: QTBUG-34337
Pick-to: 6.5
Change-Id: I319fad1f1fda0cfa4c0b95e9e16c25c87df04351
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-11 23:33:51 +02:00
Volker Hilsheimer
11ae55e918 macOS Accessibility: code hygiene
Make getting a QAccessibleInterface from a QMacAccessibilityElement a
member function that also tests for the validity of the interface, and
replace the respective code duplication.

Remove unused member functions accessibilityMin/MaxValue.

Task-number: QTBUG-34337
Pick-to: 6.5
Change-Id: Ie15cf0b71285e63cc485d87ced050dc541967c98
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-11 23:33:51 +02:00
Volker Hilsheimer
e8a711ef3b Docs: update links to renamed example
Amends 5c2245cd66.

Pick-to: 6.5
Change-Id: I3956c0f5114bb5107c41a16c46d25c4aa82f3c53
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
2023-04-11 19:25:42 +02:00
Volker Hilsheimer
d7aa6109b1 Docs: fix links to D-Bus examples
"Example" was removed from the titles.

Pick-to: 6.5
Change-Id: Ie322180fbda328cd6e3e03c7c15f6255809b619c
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2023-04-11 19:25:42 +02:00
Volker Hilsheimer
3c83b3c010 QImage: when saving fails, print the writer's error string
In debug builds, don't fail silently in QImage::save, but emit the error
string of the QImageWriter to the warning stream so that developers have
a chance to know what's going on.

Task-number: QTBUG-103257
Task-number: QTBUG-41043
Pick-to: 6.5
Change-Id: I29718b1445d0c99a3b35d57b58ec915a503cd5f0
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-04-11 19:03:52 +02:00
Ilya Fedin
6f37399cd6 Fix build without egl_x11
Amends 49d2944045

Pick-to: 6.5
Change-Id: I5ff94135245cdb617aa5eea5a0e2782f810b36dc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-04-11 21:03:52 +04:00
Morten Sørvig
01cdda3502 Update QWindow DPR on screen DPI change
The window device pixel ratio may change when the DPI
changes. Call the DPR update function, which will poll
for the current value and update the cached value and
send DevicePixelRatioChanged events if needed.

Change-Id: I5d5ac5d24a693d06eb9b1f005a91677e703f8a58
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-11 17:13:14 +01:00
Morten Sørvig
3965d808c0 QWindow: Cache the devicePixelRatio value
Make each QWindow instance cache the current DPR value.
This will make calling QWindow::devicePixelRatio() less
costly, since it now does not have to compute the DPR
value on each call.

The cache is invalidated when the DevicePixelRatioChange
event is sent. The common logic for handling this is
implemented in QWindowPrivate::updateDevicePixelRatio().

Change-Id: I97231a230347358d8e565d2fd62e8a398adaedfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-04-11 17:13:14 +01:00
Colin Snover
fc9853dcbf QMainWindow: fix potential crash when restoring tab bar state
Don't activate the mainwindow layout while it is being restored.
Otherwise we might end up in recursive calls to setGeometry.

Pick-to: 6.5
Fixes: QTBUG-111538
Change-Id: I4b6cba9e0abfbae479f71a65b1c4526d92dac081
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-11 18:13:14 +02:00
Colin Snover
5b8ffc6d2a QMainWindow: fix potential assert when restoring dock widget state
Don't append separator widgets at the end if their slot in the list is
still free.

Pick-to: 6.5
Task-number: QTBUG-111538
Change-Id: Id9ada2c083345cfd69633e506cceedc9ae6f2ae4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-11 18:13:14 +02:00
Bernhard Rosenkränzer
8f8be55c15 CMake: Fix linkage with lld 16.0
lld 16.0 is more picky about symbol versioning than previous versions
(and other linkers such as ld.bfd, gold or mold).
It now errors out if a symbol is versioned but not defined
(see 8796677de8900dc154aef45f8620c3f987a40291).

Outside of detecting support for symbol versioning (fixed by 462832),
this causes linking Qt6 libraries other than Qt6Core to fail because
their linker scripts try to add versioning to qt_version_tag, which is
defined in Qt6Core rather than the library being linked.

The obvious (and working) fix is to version qt_version_tag only where it is
defined (Qt6Core), but this is not what the original intent seems to be.

Task-number: QTBUG-111514
Change-Id: I963d417befb0f6b2260c57f059eeda1fe79200c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-11 15:19:22 +02:00
Axel Spoerl
74a4f9cb05 Cache null icons and remove them upon system icon theme change
Since Qt 6, qIconCache does not store null icons. In case an icon name
lookup is unsuccessful, the (expensive) lookup is repeated each time.

This patch reverts 9e7c567050, which
removes a null icon from the cache once it has been found in the cache.
In fact, that could no longer happen due to
4dc7102c84, which prevented null icons
from being cached at all. Therefore, it is also reverted by this patch.

The cache will be cleared when
- the system icon theme name changes or
- QGuiApplicationPrivate::processThemeChanged is called (e.g. due to
a change of the system's color scheme)

Fixes: QTBUG-112257
Pick-to: 6.5
Change-Id: I80cd21fa39dc31c4bae60a8e66e78d9da20e9b4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-11 15:19:22 +02:00
Volker Hilsheimer
70f9158e0f Docs: don't link to removed example
Pick-to: 6.5
Change-Id: I5fcec02cd18971150eec4f119d902c695bf2ebb9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
2023-04-11 14:37:36 +02:00
Amir Masoud Abdol
db9fa4a617 Exclude sources from the Unity Build
There are patches for addressing the issues raised by these two source
files; however, it would be beneficial to exclude them temporary while
we are testing, and debugging the unity build on CI.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ie8631cf1df086b22967a8cc41874a3ef856c3ef8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-11 13:41:55 +02:00
Volker Hilsheimer
7199498fb9 QPushButton: use QMenu::popup instead of exec to show menu
QMenu::exec opens a blocking loop, which is problematic for webassembly.
Replace with QMenu::popup, and reset the down-state of the button when
the menu is about to hide. QMenu emits aboutToHide immediately before
existing the event loop in the hideEvent override, so the timing is the
same.

Change-Id: Iccb418d10fcb25f6ad1f73f9cdce6ea6581bd73b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-04-11 12:58:58 +02:00
Volker Hilsheimer
cf5d9e9eb5 QWidget: add overload to set tab order as a list of widgets
The "two widgets at a time" API to set the tab order is awkward and
easily misused (as the documentation explicitly explains). Add an inline
overload that takes an initializer_list, and call the existing function
for each consecutive pair of widgets in the list.

Add documentation with snippet, and a test.

Change-Id: I8e6f14a242866e3ee7cfb8ecade4697d6bdfb4d4
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-04-11 12:58:58 +02:00
Mikolaj Boc
ce5fb1e709 Get http reply text on error in wasm's network reply
A failed response also carries response text. Read it and assign it
to the response.

Fixes: QTBUG-112474
Change-Id: I5565e3809e2c9c95bf8e0744b3ab15a62b07106c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-04-11 08:47:20 +02:00
Volker Hilsheimer
f04974751d QFileSystemModel: don't emit invalid indexes
A subclass of QFileSystemModel might override columnCount to return a
value smalller than QFileSystemModelPrivate::NumColumns.

In that case, constructing the bottomRight index for the dataChange
signal would fail if we create it for column NumColumns - 1, and result
in undefined behavior where the topLeft and bottomRight indices do not
have the same parent.

So ask for the columnCount of the parent index explicitly to construct
the bottomRight index.

The assert can be triggered via the "filesystemexplorer" example in
qtdeclarative, which overrides columnCount to always return 1.

As a drive-by name the variables correctly, bottom and top where mixed
up.

Pick-to: 6.5
Fixes: QTBUG-110632
Change-Id: I8a635ec733348d1eda2037c156ac0f7b09a2183d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-04-11 08:46:58 +02:00
Volker Hilsheimer
41a349f004 Refactor QFileSystemModel: use named values for columns
Hardcoded 0, 1, 2, 3 make it hard to follow the logic of this code.
Replace those values with values in the already existing unnamed enum,
and use everywhere.

Pick-to: 6.5 6.2
Task-number: QTBUG-110632
Change-Id: I325ab9edb5f3f996e87c83be1ec7226d5453f2cc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2023-04-11 08:46:54 +02:00
Ahmad Samir
7191b8fe38 Fix some narrowing conversion warnings
ioctl call for FIONREAD takes an int arg, it won't work correctly
otherwise. Cast the return of the read() call to int, because it won't
read more than buffSize (which is an int).

Change-Id: I130202a732684257bbb0e79c9358b60a61010c46
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:24:04 +02:00
Ahmad Samir
db797d19a3 QTemporaryFile: fix narrowing conversion warnings
- Don't use unsigned to avoid negative values (if an unsigned variable
  is assigned a negative value it'll wrap around and become a huge
  positive value, which is usually not what's required)

Change-Id: I5d41280b9ca14c15727f9f2447ed50573b187931
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-04-08 13:23:37 +02:00
Ahmad Samir
595112ea50 QStorageInfo: mention bind mounts and btrfs subvolumes in API docs
Sepcifically in the subvolume() method's docs.

Change-Id: Ib14492f8366bf00a6a4ab399ff8ad20009be5886
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: hjk <hjk@qt.io>
2023-04-08 13:21:39 +02:00
Christian Ehrlicher
ca7e3bcf91 SQL/IBASE: Always escape the table names when creating the SQL statement
Sync the IBASE driver behavior for primaryIndex() and record() with the
rest by assuming that the given table name has the correct casing.
Change the tests for these two function to pass an unescaped table name.

Change-Id: I6d96359f97e1acc6970b9a22fdf0e968a616b7bc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-07 15:48:57 +01:00
Christian Ehrlicher
3983babd71 QSqlQuery: add boundValueName()/boundValueNames()
[ChangeLog][SQL][SqlQuery] Added two new functions
boundValueName()/boundValueNames() to return the names of the bound
values.

Fixes: QTBUG-97847
Change-Id: I8df5f15e8df13141a34d38b0a2e13b37f4e7829c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-07 14:25:28 +02:00
Alexandru Croitor
5e378e7374 syncqt: Add more information to verbose output
Makes it easier to troubleshoot issues.

Pick-to: 6.5
Change-Id: If50fafde8748bb0fde58f54ed55fe1ddf9bcf088
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-04-06 19:26:02 +02:00
Alexey Edelev
55f89c76d9 Guard qopenglcontext_p.h with QT_NO_OPENGL
Fixes the macos build with the disabled opengl feature.
Include inttypes.h that used to be implicitly included by
qopenglcontext_p.h. It's needed for 'PRId64' macro.

Amends: ef27cc126c

Pick-to: 6.5
Fixes: QTBUG-112656
Change-Id: I970329c4aacc70790f50e1ff3a57ab2aa6f6bff7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-06 19:26:02 +02:00
Timothée Keller
a516a368c2 Windeployqt: change qtModule return value to prevent invalid modules
When the change from quint64 to bitsets was originally made, the return
value of the qtModule function was not adapted. Where returning 0 was
fine for the quint64 values which started at 1, returning 0 now adds
the first module instead of adding nothing to the used/required modules

Fixes: QTBUG-111984
Pick-to: 6.5
Change-Id: Id1e2b3237a36335ec5071180b4c73f99d5eb5c8d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-06 17:51:36 +02:00
Kaj Grönholm
a2dccbafcf Clear invalid QApplication styleOverride
When QStyleFactory::create() is unable to find/create an override style
set with QT_STYLE_OVERRIDE or "-style", clear the styleOverride. Reason
for this is that Qt Quick Controls otherwise tries to use this invalid
style.

Task-number: QTBUG-100563
Pick-to: 6.5
Change-Id: I48fa6c211ce27d902e2eaf90c34cb5694ad7ecfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-06 16:28:23 +03:00
Timothée Keller
8009561029 Windeployqt: Prevent '.' and '..' from being added to lconvert
If windeployqt is not able to retrieve any translation information
from the catalog, the translationNameFilters will be empty. This allows
the '.' and '..' folders to be passed to lconvert which in turn causes
an error for the whole deployment. Added a check for the filters being
empty, and a warning in case we have to preemptively return from the
translation deployment.

Fixes: QTBUG-112204
Pick-to: 6.5
Change-Id: I0d114186e630cc3696250006fa093c4c596eb40d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-06 12:18:34 +02:00
Timothée Keller
a81fa2047b Windeployqt: Simplify infix detection for --libinfix builds
Removed fetching the infix through the QtCore Module, since
it is already provided by qtpaths -query

Pick-to: 6.5
Change-Id: I844305fc66b21af094724dd3f516078447ee1dd2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-04-06 11:18:12 +01:00
Friedemann Kleint
aa6339594e Fix qdoc warning about missing QMultiMap code snippet
Bring back missing code snippet src_corelib_tools_qmultimap.cpp#19,
fixing:

qtbase/src/corelib/tools/qmultimap.qdoc:1007 Command '\snippet (//!
[19])' failed at end of file
'qtbase/src/corelib/doc/snippets/code/src_corelib_tools_qmultimap.cpp'

As a drive-by, use a more modern form, avoiding repeated invocation
of end().

Amends 3236b64db8.

Task-number: QTBUG-105109
Pick-to: 6.5 6.2
Change-Id: I09635eedd773ed16517773a9bf282b0386beba26
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-06 10:43:22 +02:00
Christian Ehrlicher
be8b3efae6 SQL/QSqlRelationalTableModel escape the auto-generated alias
The alias created by QSqlRelationTableModel to avoid duplicated field
names was not escaped which lead to an inconsistency in the returned
alias name from the database (e.g. postgres lowers all unescaped column
names).
Also adjust the test for QSqlRelationTableModel to use escaped table
names for it's tests and fix it for QIBASE.

Change-Id: I01426320c0c1a70cb9bf8e6dfa2f8b07dbb1c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-06 05:41:16 +01:00
Christian Ehrlicher
39fab09aad SQL/MySQL: add option MYSQL_OPT_TLS_VERSION & MYSQL_OPT_SSL_MODE
Add the two options MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE to
properly support encrypted connections to MySQL 8.0 servers.
MYSQL_OPT_SSL_MODE will not work when compiled against the MariaDB
C-Connector since it's not supported by the MariaDB client.

[ChangeLog][QtSql][MySQL] Added the two new connect options
MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE.

Fixes: QTBUG-84797
Change-Id: Iec7d682fc00072ce5b2a824c4ea00fca4575a93e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-06 04:41:15 +00:00
Volker Hilsheimer
27867de8ca Permissions: respect context object's thread and life time
When a context object is provided, then callers expect that the functor
or slot is executed in the thread of the context object. And if the
context object has been destroyed by the time the permission response
is received, the functor shouldn't be called at all.

To implement this, we either have to plumb the call back through a
signal/slot connection and benefit from QObject's infrastructure. This
is not practical here, as we don't have an "engine QObject" that would
emit a signal.

Instead, we can create a QMetaCallEvent explicitly, following what we do
in e.g. QHostInfo, and using a temporary QObject that handles the event
to then call the functor.

Add test coverage.

Pick-to: 6.5
Change-Id: Id878e45b304857304165ab4a7c6aae76fbee46ce
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-06 00:21:50 +02:00
Alexey Edelev
ef27cc126c Guard qopenglcontext_p.h with the QT_NO_OPENGL check
QtGui/private/qopenglcontext_p.h needs to be guarded to avoid
compilation errors when building Qt with openGL disabled.

Fixes: QTBUG-112656
Pick-to: 6.5
Change-Id: I21d120ed2bdb22e7aa2338e396a9a426adb80dbe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-05 21:30:29 +02:00
Volker Hilsheimer
9476283edb Docs: document QTextFormat::Property::ListStart
Fix qdoc warning by documenting the new value.

Change-Id: I8c289cf103ccf008b6592a9e6e940d02e5cab7b3
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
2023-04-05 19:05:04 +02:00
Rami Potinkara
792a5b15c9 Android: fix cutout area rendering on Android 9 and above
Fix rendering to cutout areas so that they are filled both
in portrait and landscape modes.

Fixes: QTBUG-96877
Pick-to: 6.5 6.2
Change-Id: I8a29557236ed1b7084afc902dc1fb42d9535ef32
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
2023-04-05 15:59:22 +00:00
Joni Poikelin
588eab99d2 Fix some extra semicolon warnings
Fixes: QTBUG-112648
Pick-to: 6.5
Change-Id: I71446459c7fd6018ecb4deb60a7b9b412c0972ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-05 18:59:22 +03:00
Assam Boudjelthia
a43f349f9c Android: allow using string based versions in compileSdkVersion
Some platform sdk packages have names that contains non-integer
characters such as android-33-ext5 or android-UpsideDownCake
which fail building with androiddeployqt because build.gradle
expects an integer only. This allows using string based versions
and also fallbacks to setting an integer only value if it finds
that the build.gradle of the project is still explicitly
converting to integer (this to avoid breaking existing projects).

Fixes: QTBUG-112465
Pick-to: 6.5 6.2 5.15
Change-Id: If8cfc0fb84f0880a43644dc0a4188671736d3e21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Assam Boudjelthia
4521dfe75a Android: fix manual deployment with ANDROID_DEPLOYMENT_DEPENDENCIES
Fix the qtforandroid (i.e. libplugins_platforms_qtforandroid) check
and avoid calling llvm-readobj on non-library files and only add them
to the dependency list.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5
Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Assam Boudjelthia
b92854aed3 Android: don't break when finding opengl plugin
avoid breaking when looking for the android plugin when the dependencies
include opengl lib, since that was valid only in the early days where
the Android plugin was separated into two raster and opengl. Now, that
assumption is wrong and might affect the way the manual dependency
works.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5 5.15
Change-Id: I025a5c8b2b064bb43a356a4ad5cb4a1ada41b09b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-05 12:38:15 +01:00
Ivan Solovev
028c367f75 Deprecate QtFuture::makeReadyFuture()
[ChangeLog][Deprecation Notice][QtCore] The QtFuture::makeReadyFuture()
method and all its specializations are deprecated since Qt 6.10.
The reason for the deprecation is that the method has a
makeReadyFuture(const QList<T> &) overload, which behaves differently
from all other overloads (including other non-const ref QList
overloads).
Use QtFuture::makeReadyVoidFuture() when you need a ready void QFuture,
or QtFuture::makeReadyValueFuture() when you need to propagate the
input type to the returned QFuture, or QtFuture::makeReadyRangeFuture()
when you need to create a multi-value future based on an input
container.

Fixes: QTBUG-109677
Change-Id: I55125269989df0a02840d5ddd5763ef5f1070df5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:15 +02:00
Ivan Solovev
9b4b32ec98 Long live QtFuture::makeReadyVoidFuture() and QtFuture::makeReadyValueFuture()
[ChangeLog][QtCore][QFuture] Added QtFuture::makeReadyVoidFuture()
and QtFuture::makeReadyValueFuture().

Basically, these methods behave like QtFuture::makeReadyFuture(), but
QtFuture::makeReadyValueFuture() does not have a "const QList<T> &"
specialization returning QFuture<T> instead of QFuture<QList<T>>,
which allows it to always behave consistently.

This patch also introduces usage of the new methods around qtbase.

Task-number: QTBUG-109677
Change-Id: I89df8b26d82c192baad69efb5df517a8b182995f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:15 +02:00
Ivan Solovev
7f38f9f394 Long live QtFuture::makeReadyRangeFuture()
[ChangeLog][QtCore][QFuture] Introduce
QtFuture::makeReadyRangeFuture(). This method takes a container
which has input iterators and returns a multi-value
QFuture<ValueType>, where ValueType is the underlying type of
the input container.

This commit also replaces the usage of buggy
QtFuture::makeReadyFuture(const QList<T> &) overload with the new
method.

Task-number: QTBUG-109677
Change-Id: I019e62eac74c643d88a65b3cc0085bc7c33bc712
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-04-05 13:38:14 +02:00
Ivan Solovev
10242a8250 QPermission: return the combined result of a permission group on Android
QPermission might resolve to multiple underlying permissions on Android.
The existing code was only using the first permission from the list
in checkPermission(), and also checked only for the first result
returned by requestPermissions().
This can lead to a situation when only one of the requested permissions
is granted, but the API reports that all required permissions are
granted.

This patch fixes it by checking the combined status of all permissions.
If at least one of the permissions is denied, the whole list of
permissions in considered denied.

Fixes: QTBUG-112527
Pick-to: 6.5
Change-Id: I243b73bb5a842197cd0ef70937b8eac344ff9596
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-04-05 12:34:15 +02:00
Thiago Macieira
2f226336a2 QPluginLoader: don't instantiante multiple, identical instances
This can happen if the same project has two or more Q_IMPORT_PLUGIN
macros in their source. And that can happen when converting from qmake-
based builds to CMake, as qmake didn't generate a source file with the
macro but CMake does.

[ChangeLog][QtCore][QPluginLoader] staticInstances() will not call
duplicated registrations of the same instantiation function, which can
only happen as a result of duplicated Q_IMPORT_PLUGIN for the same
plugin name.

Fixes: QTBUG-102745
Pick-to: 6.2 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd174fb9dd62d8583d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-05 00:29:16 -07:00
Christian Ehrlicher
a74059f2bd SQL/PSQL: remove non utf-8 support
PostgreSQL supports the utf-8 encoding ('UNICODE') since at least
version 7.3 which is the oldest version we support. Therefore remove the
non utf-8 codepath completely.

Change-Id: I64b1a4e7b0b85141fe13f5f57e6f35f9eb7d542e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-05 05:37:39 +01:00
Assam Boudjelthia
65d79fb5f3 Android:CMake: use correct key for manual deployment dependencies
androiddeployqt expects a key deployment-dependencies for dependencies
provided by QT_ANDROID_DEPLOYMENT_DEPENDENCIES.

Pick-to: 6.2 6.5
Task-number: QTBUG-94232
Change-Id: I3fc32e0677db3ee69e24b3aeca74bedd9c7ced58
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-05 00:04:28 +01:00
Carl Schwan
ac973cb74f Implement setBadgeNumber for xcb backend
This use the unity launcher specification which is defined here
https://wiki.ubuntu.com/Unity/LauncherAPI

This spec is used by Plasma and Unity. On other Linux desktop platform
where the unity DBus interface is not detected this is no-op.

Change-Id: I81a9b95fe4886ad597bb4e775641926b161c49a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2023-04-04 23:53:37 +02:00