qt_ptr_swap is our swap compile-time optimizer. It's faster because it
hardcodes noexcept(true) and std::swap() must calculate it.
Amends 9ba5c7ff6a.
Pick-to: 6.7
Change-Id: I1b5a326276bd30638ac9b6dcf597abb5e53ada00
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Both QByteArrayView and std::string_view are Literal Types, so the
conversion between them should be constexpr.
Amends 96d67da420.
Found in API-review.
Pick-to: 6.7
Change-Id: Ic513ce32aa2a743ca890dc05a683a62c0f3a7d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This is supposed to be a no-op change: I simply split the three phases
of the siphash algorithm into separate functions. This will be needed
for hashing of QLatin1StringView equal to QString's.
Drive-by slight modernization of the code too and made the 32-bit code
be compiled (but not used) on 64-bit, so we don't accidentally let it
bit-rot.
Change-Id: I664b9f014ffc48cbb49bfffd17b03d10c8bd55b2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Clang's `-Wimplicit-fallthrough` warnings are a little stricter than
gcc's interpretation:
switch (i) {
case 0:
foo();
case 4:
break;
}
While gcc accepts the implicit fallthrough, if the following statement
is a trivial `break`, clang will warn about it.
Pick-to: 6.7
Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The old code used unintialized construction followed by (move)
assignment to construct a QJniObject that requires a LocalFrame
object. That is two constructors and therefore one more than we need
(and need to destroy in inline code again).
Everything can be solved with another level of indirection.™
Since the LocalFrame needs to remain alive for the duration of
argument evaluation, the usual comma operator trick won't work. But we
can add a private helper ctor that takes the LocalFrame as an
additional argument to inject the object with the correct lifetime
into the ctor delegation chain.
Put the new argument in the front, to avoid clashes with the primary
contructor's trailing universal references, which might be a better
match than the new overload had we added the argument at the end. The
hope is that the compiler will avoid the ensuing register shuffling by
inlining the outer two constructor calls.
This brings the number of QJniObjects constructed down to one, as it
should be. We might also be able to remove the Uninitialized ctor
again.
Found in API-review.
Amends 62cb5589b3.
Pick-to: 6.7
Change-Id: I326187e54fd0705a1bbedb2d51d94a46b108a3c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Revert Windows global palette changes and set the QPalette for
QWindows11Style in QWindows11Style::polish
Fixes: QTBUG-120571
Pick-to: 6.7
Change-Id: Iad4eb699c2dbfed38a917e6c9bc378c4262dc66e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The method traversed QDockAreaLayoutInfo::item_list, to identify
dock widgets tabbed with the QDockWidget argument in a tab bar
It relied on bool QDockAreLayoutInfo::tabbed, which is set to true, when
a QMainWindowTabBar is to be added to a QDockAreaLayoutInfo. This flag
isn't cleared, when the second last dock widget is removed from the
tab bar. It can't be replaced by QMainWindowLayout::isDockWidgetTabbed,
because the flag also represents intermediate states, where e.g. a dock
widget is hovered over, prepares to become a floating tab and then rolls
back, because hovering doesn't result in a drop. In that case, tabbed
must become true, which the dock widget isn't actually tabbed.
Furthermore, the way to traverse item_list didn't find dock widgets
in a floating tab. In that case, tabifiedDockWidgets() wrongly returned
an empty list.
To fix both issues, refactor QMainWindow::tabifiedDockWidgets() to read
the list of dock widgets directly from the QMainWindowTabBar.
Add tests in tst_QDockWidget::floatingTabs() and
updateTabBarOnVisibilityChanged()
Fixes: QTBUG-122001
Pick-to: 6.7 6.6 6.5
Change-Id: Ia9eb3711be642101261f34ee447521cc6accc20c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Previously, querying Qt::ImEnabled only returned the value of
isEnabling(), which is incorrect for edit widgets with read-only
properties set, as Qt::ImEnabled indicates whether text can be *input*
through the input method, which results in the IM being able to insert
text into read-only edit widgets.
The fixed version uses both isEnabling() and isReadOnly() values to
determine whether input methods need to be enabled. For some platforms
(like iOS and Android) that rely on IM to select text, a check for
ImReadOnly has been added to their QPA plugins to enable handles on
read-only input boxes.
At the same time, the imEnabledNotImplemented function in the test file
tst_qwidget was modified, since ImEnabling should give a _false_ value
when a lineedit is read-only.
Task-number: QTBUG-105009
Task-number: QTBUG-110838
Task-number: QTBUG-119182
Pick-to: 6.7 6.6 6.5
Change-Id: Ia2abcdb3200826d567f90447d4f8b71d0ef1fbf0
Reviewed-by: Yansheng Zhu <670429759@qq.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
androiddeployqt rules that support depfiles cause creation of rules that
interfere each other and cause the test build flakiness in CI.
This disables depfile support for ABI-specific external project until the
rootcase is found.
Task-number: QTBUG-122838
Pick-to: 6.5 6.6 6.7
Change-Id: I12e85f43494331c943c9b516d9494593facf9180
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This class offers a forward-only const_iterator, that matches the system
low-level functions' logic (e.g. readdir()/dirstream logic). This
iterator is a std::input_iterator_tag.
QDirIterator uses Java-style iterators that have a couple of issues:
- They don't fit the logic of the underlying native system functions
(readdir()/__dirstream and co.), there is no way to know if there is a
next entry except by advancing the iterator (calling readdir()) first
- As a consequence of the above, two QFileInfo objects, current and next,
had to be used to fit that paradigm; and the code always
iterated/stat'ed an extra entry past the one we want, e.g. when
filtering
The next step is porting QAbstractFileEngineIterator and its subclasses
to be like QFileSystemIterator, i.e. replace hasNext()/next() with a `bool
advance()` virtual method. This is easier to reason about than the
Java-style iterators, and is more in-line with the new class.
Discussed-on: https://lists.qt-project.org/pipermail/development/2023-December/044745.html
Change-Id: I8e696cefdca18d8c78f803efdb83a73dd43eb720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
To make it easier to follow the history in git.
Change-Id: I094056c1ec130aeef77aa2d20289ab766bc25083
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That QString and QByteArray::clear() shed all capacity() is a
historical artifact we will fix at some point. Don't add more code
that assumes a clear()ed string isNull().
Amends 8af346c1f6.
Amends 1d9137e13f.
Task-number: QTBUG-31283
Task-number: QTBUG-60745
Pick-to: 6.7
Change-Id: Ib0d929325088d3e8e119fee3eafa964a783dc8e9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Rename the toType() overloads taking an out-parameter to appendToType(),
because that gives a better understanding of the usecase.
Found in 6.7 API review
Amends 8af346c1f6 and
1d9137e13f.
Pick-to: 6.7
Change-Id: Ic1a462e9507123a59e6086bfb48b8b61ab79abb8
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There may not be a checkbox when the helper is initialized, and
we want to support the case of a checkbox being added at a later
stage.
Regression from e5c40ec5c1.
Pick-to: 6.7
Change-Id: I397c3b3a101b249aab17804bd90085cfd4ab7dbb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
In 2022¹, we gave ourselves the rule to allow #pragma once only in
non-installed headers (examples, tools, snippets, ...), because the
same installed header may reside in different places in the filesystem
and #pragma once would treat these as separate headers, causing
multiple-definition errors.
Recently, the question came up: "What constitutes a public header?"
Non-_p.h headers in e.g. src/plugins/ muddy the waters here a
bit. Since #pragma once is forbidden in installed headers, I had the
idea to use it to indicate non-installed headers. This patch enables
use of #pragma once as a static assertion to that effect, should we so
choose.
¹ https://lists.qt-project.org/pipermail/development/2022-October/043121.html
Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-122813
Change-Id: I3b5beef72e154cf5bf1ccd4b6f02df9680609e43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It's not really clear why this feature shouldn't work in release
builds of Qt. This aligns the behavior with UNIX.
Change-Id: I6a2f50640ab0b2e109e4c3ef7317954a3e8c79a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Starting with Windows 10 1607 there's a modern API to set a thread's
name on Windows (replacing the RaiseException hack).
Change-Id: I45b7abef7b082b9f239b2ac948bb79cce44cdb5e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This symbol is required to be public in case of dynamic linking.
Mark it with Q_CORE_EXPORT.
Task-number: QTBUG-121839
Change-Id: Ie4b89532e39eb21f6efceefcceb922cd6d37983a
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
When hiding a widget that has focus we try to focus the next widget in
the focus chain by running focusNextPrevChild. The abstract item view
overrides this to step the items but does not account for this hide case
which makes focusing not only not work, but also by hiding the widget
the selection in the item view gets changed.
Pick-to: 6.7 6.6 6.5
Change-Id: I29d40a1fb86ced60ec742b2753a87383846a89b3
Reviewed-by: Viktor Arvidsson <viktor.arvidss@gmail.com>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Language and some other improvisations
Fixes: QTBUG-120028
Pick-to: 6.7
Change-Id: Id5a5544abf244de5cff83f0d795732595934bd36
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This adds a new QAccessibleAttributes interface
that implements support for reporting (object)
attributes (as compared to offset-specific text
attributes, which are handled by the
QAccessibleTextInterface).
The concept of object attributes/properties can
be found in all of ARIA, AT-SPI2 on Linux,
IAccessible2 and UIA on Windows and NSAccessibility
on macOS, and while some of the properties/attributes
on these platforms can be mapped to from information
retrieved via existing QAccessible* interfaces, a lot
of relevant information cannot be made available this
way.
The new interface is meant to bridge this gap.
Each attribute is handled as a key-value pair.
Other than for the handling of text attributes
(where a single string is used for all attributes,
s. QAccessibleTextInterface::attributes), the
object attributes handled by the new interface
use the newly introduced QAccessible::Attribute enum class
for keys. This helps to clearly define the semantics
of each attribute and simplifies mapping to the different
platform representations in the platform a11y bridges.
Initially, two attribute types, Custom
and Level are added, s. the documentation added
with this commit for more details.
Mapping of these two attributes to their platform
equivalent for AT-SPI2 on Linux and UIA on Windows
will be added in following commits.
The Core Accessibility API Mappings specification [1]
can be very useful when considering new attributes
to add and how to bridge them to the specific
platform APIs.
Conceptually, the possibility to expose object-specific
attributes might seem a good fit for the existing
QAccessibleInterface, but adding new virtual methods
to non-leaf classes would be an ABI-incompatible
change [2], so adding a new interface/class is
necessary.
There is also a related discussion for Gtk 4 in [3],
which - other than Gtk 3 - currently also lacks
API to support many AT-SPI object attributes relevant
for assistive technology like screen readers.
The implementation here is also inspired by the
dicussion there.
A sample implementation for LibreOffice can be
found at [4].
[1] https://www.w3.org/TR/core-aam-1.2/
[2] https://community.kde.org/Policies/Binary_Compatibility_Examples#Add_new_virtuals_to_a_non-leaf_class
[3] https://gitlab.gnome.org/GNOME/gtk/-/issues/6196
[4] https://gerrit.libreoffice.org/c/core/+/159309
[ChangeLog][QtGui][QAccessibleAttributesInterface] Added new
QAccessibleAttributesInterface that can be used to expose
object attributes/properties to assistive technology.
Task-number: QTBUG-119057
Change-Id: I9d51c818e82673d1e755a3c909d3e8f5bb064a35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When SQLGetDiagRec() does not return an record, the list of
DiagRecords might be empty. This will create an assertion when trying
to access QList::front() or similar. Therefore we need to check if the
list is empty before accessing it.
This amends 4ec5c0efc7
Fixes: QTBUG-122073
Pick-to: 6.7 6.6
Change-Id: I6f421d82f9b6fdf84672d755cbbe8d2adec13266
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
[ChangeLog][QtCore][QString/QByteArray] Added slice() methods that work
like sliced(), but modify the string/byte-array they are called on.
Task-number: QTBUG-99218
Change-Id: I3075562983ef123d9aa022a2304c7e774cf2ea42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These states have direct equivalents in AT-SPI, so map them
accordingly.
Fixes: QTBUG-119080
Pick-to: 6.7 6.6
Change-Id: I5a78a75d135a853b3773c34aa2a45c0791cefebc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
It will be re-used in a subsequent patch.
Pick-to: 6.7 6.6 6.5
Change-Id: Ia58020a39440d5e583450f7adecf561f7267c403
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The functions are now on QImage, not on QtWIn.
Change-Id: Ida777c7fc087bf673c5305beffb498ada115ed73
Pick-to: 6.7 6.6 6.5 6.2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Replace fence with pause in opcode form,
as GCC doesn't support fence operand.
Amends a7f227f56c.
Remove the builtin pause checking,
as in GCC13 this will always pass,
while the opcode pause works
regardless of the pause extension.
Task-number: QTBUG-103014
Pick-to: 6.7
Change-Id: I26e3c3b9f7d234be24abe1570aaf4c8cb3a272b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Follow up to commit 00d9a9a9b5 - as
commented in the QTZ constructor, one of the reasons for the prior "is
available" check was to avoid creating TZ cache entries for it; so
have the TZ backend also (like ICU) overtly check for availability
before trying to find data for the given ID. This duplicates work done
later in the constructor, which can perhaps be optimised out later,
but is no worse than where we were before the commit mentioned above.
Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-121807
Change-Id: Ie0571df2de2bf0a3f4ee767184e58b378e8cb05a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Do it both for d3d11 and 12. Also add a bail out when presenting
to the latter (it is already there for d3d11).
Pick-to: 6.7 6.6
Task-number: QTBUG-109708
Change-Id: I6f8039bcf27fa20e4bebcdf01ac3feaa14249b4d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
As spotted in the code review, remove_cv here is useless. Since T is
passed by value, template type deduction will strip cv-ref for us.
(Also: in general we don't support users specifying template type
parameters except where authorized, but here they can't, as this is an
operator.)
Amends 3823e310e3
Change-Id: I5b5db38a4dcf4f1179d748cf0bb1b62a9896f5a6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
All file under doc/snippet should be
license as Documentation snippets
and according to QUIP-18 [1]
this is LicenseRef-Qt-Commercial OR BSD-3-Clause
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I76eedfb6b15c4091f726a5652e3530001d7cdaf7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We are already have proper compare operator
Change-Id: Ie0c587f0f5c784197f52c992b40ee0fdc366aeb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move qtconfManualPath pointer to the unnamed namespace, so it's never
exported. Add the static setQtconfManualPath method that sets the
pointer at runtime.
Fixes: QTBUG-122739
Pick-to: 6.5 6.6 6.7
Change-Id: Icfc631f9680ad5f484920b0fdf3e408b7657c108
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Temporarily bring back the QtActivityDelegate.insertNativeView() and
QtActivityDelegate.setNativeViewGeometry() (replacement for
setSurfaceGeometry()) as they are still in use by the ActivityView
module of QtAndroidAutomotive.
They have been removed by 0a92d881bb.
Pick-to: 6.7
Change-Id: Ia00407d827ca9217c9f49df55b4cf7001ac9871a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The number of windows in a windowing system is clearly small, even
smaller the number of windows that should be affected by a single
touch event, so QSet is overkill. Use the recently-added
QMinimalVarLengthFlatSet instead, backed by a QVLA<16>. Even though
insertion and lookup are now logarithmic instead of constant-time, the
saved memory allocations will make up for it.
Change-Id: Ie33ecf4a155e58db597c67ed9c78549255c48b99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The handle is not owned by the Shell, we have to clear it up ourselves.
The documentation is not clear about how long the handle needs to be
kept alive, so store the icon when we create it as a member of the
private, and clean it up when it need to be recreated, or when the
QSystemTrayIcon instance gets destroyed.
Fixes: QTBUG-96348
Fixes: QTBUG-62945
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I6f93f29a415cde2cfe4e1b296295783c15b4da4b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Currently with have two base classes for COM-objects that implement
basic IUnknown functionality and the idea is to remove duplication and
keep just one. Since QComObject supports more features than
QWindowsComBase, such as multiple inheritance and intermediate interface
querying, we should switch to the former one.
Change-Id: Ief6567496de9f547b936de91d634c6998ba59a75
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Do not allow replacing a state again if it is already being replaced.
Cleaned up from the patch provided in QTBUG-121126.
Fixes: QTBUG-121126
Pick-to: 6.6 6.7
Change-Id: Icca932b0e5cccd2f39ac18f29d8f7707887d147f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When adjusting handling for the special traling HEADERS with PRIORITY
case the actual no-headers case handling was lost.
This patch adds it back.
Now it deals with it being empty due to overflow or just empty headers.
With a real server this should never happen though, since they either
send the required headers or don't send a HEADER frame at all. So, in
theory it will not have caused a problem for users.
Pick-to: 6.7 6.6
Change-Id: Iacbb1183f26cb1f2e7e30ace6456488c4671972d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
One more method for STL compatibility.
This one is particularly subtle as it's required by the
`reservable-container` concept:
https://eel.is/c++draft/ranges#range.utility.conv.general-3
Without this concept, ranges::to won't reserve() before copying the
elements (out of a sized range which isn't a common_range).
Implementation notes: there were already a couple of constants denoting
the maximum QByteArray and QString size. Centralize that implementation
in QTypedArrayData, so that QList can use it too.
The maximum allocation size (private constant) needs a even more central
place so that even QVLA can use it. Lacking anything better, I've put it
in qcontainerfwd.h.
Since our containers aren't allocator-aware, I can make max_size() a
static member, and replace the existing constants throughout the rest of
qtbase. (I can't kill them yet as they're used by other submodules.)
[ChangeLog][QtCore][QList] Added max_size().
[ChangeLog][QtCore][QString] Added max_size().
[ChangeLog][QtCore][QByteArray] Added max_size().
[ChangeLog][QtCore][QVarLengthArray] Added max_size().
Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The specification doesn't provide an explicit grammar, so I turned the
prose into ABNF for easier reference.
The goal is both to aid review of the validateSingleType() function
and to eventually use this to write a parser that doesn't use, or at
least limits, recursion.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I21f81aa83cde356ab48105ea98f066024e0b7b5e
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "does not contain two slashes in sequence" condition reads a bit
unmotivated. It's easier written as "each part is not empty", so do
that.
Pick-to: 6.7 6.6 6.5
Change-Id: Ibb204429521910582bd8ee03ff54f72d7e15ce84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
We want to get rid of the QWindowPrivate::compositing member, as it is
no longer needed for the Android backingstore, which it was first added
for in a4f50269f8.
We can use textureChildSeen instead to check if we're compositing.
Pick-to: 6.7
Change-Id: If85b21f92c8253bf89543a7e81e03730023f8095
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>