The correct variable to check is WIN32, not WINDOWS.
Amends 85e25d93b3
Pick-to: 6.2
Change-Id: I4570eb5a124bcaa0bd38135dd7c7f48345c40c9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
In QPanGesture this is called delta().
OTOH we have QWheelEvent::pixelDeltas().
Delta is a vector, and there's only one (with two components).
Native gestures hold incremental values: e.g. the pinch gesture event
provides an incremental amount of either zooming or rotation (so most
events have QNativeGestureEvent::value() very close to 0).
It's the same with the pan gesture's delta().
Add better docs for swipe and pan gestures.
Change-Id: Ia147c7c9a22e084c3700b1620dec46427d792bd1
Reviewed-by: Povilas Kanapickas <povilas@radix.lt>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It came up during 6.2 API review that we prefer all floating-point API
to be double-precision on 64-bit platforms, despite the awkwardness of
representing a displacement vector with something called a "point".
The docs for QPointF explicitly state "A QPointF object can also be used
as a vector: Addition and subtraction are defined..."
Amends 31f90e99b8
Change-Id: I01029661f2586640cbf846f49df164c176d17f7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
For a style sheet that defines a rule for the menu icon, but not for the
item itself, we ignored the icon rule.
Implement a separate rendering path for menu items with an icon.
That rule takes precedence over a rule for menu item check indicators,
as almost all styles reuse the icon for that.
Factor the icon positioning and rendering code out into a private member
function that we can reuse. Reduce amount of local variables to make
the list of arguments for that member reasonable, the bit checks are
cheap enough.
Fixes: QTBUG-73966
Pick-to: 6.2
Change-Id: I64b6f5181e35527d0a163d9633a7414b50319829
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The base style should still draw the item and the selection highlighting.
Fixes: QTBUG-83619
Pick-to: 6.2 6.1
Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When saving to a QIODevice, QImage and QImageWriter will automatically
deduct the file format from the filename if it determines that the
device is a QFile. That did not work for a QSaveFile device. Fix by
using the common ancestor, QFileDevice, in the implementation.
Fixes: QTBUG-89022
Pick-to: 6.2
Change-Id: Ie01d80df4f29ca0d4ff30bf7e1b77605293c070e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This prevents us from first reserve()ing Prealloc elements, and then
possibly reserve()ing a larger number, which leaves the first bucket
list's memory unused.
Consequently, deprecate reserve().
Change-Id: Ifc0a5a021097f4589557e7b5e45d9d0892797ade
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Was missed in the int -> qsizetype port for Qt 6.0.
Pick-to: 6.2 6.1
Change-Id: I1ae8190601f2e1a1bc02a736c12230a9c71acb18
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The former is QT_DEPRECATED_SINCE(6, 4).
Change-Id: I9e60639651b0832f1e3d3282d15dd0ab0b22d819
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
...by providing std-compatible insert() functions via a local subclass
of QSet, reducing the #ifdef'ery somewhat.
Change-Id: Ib532a866b47b82e8e3b9f199e8d1e01a87ed016d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
All callers use the shared-ptr version these days.
Change-Id: I77e9fc9ccb8a57bfebcad7883e9eaff3780748f0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
For internal modules we should keep the name of the file in file system
consistent with previous Qt versions.
Pick-to: 6.2
Fixes: QTBUG-95077
Change-Id: I02e4fced0fc3172e60f07bc7d1515e23744db567
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
They're now in QWidget itself. Remove them from the API, but not the
ABI.
The QToolBar case is straight-forward. QMenu is a bit more complicated:
Since QT_CONFIG(shortcut) builds changed the signature of an existing
function instead of adding/removing an overload, we have to deal with
two cases: In a QT_CONFIG(shortcut) build, these overloads that take a
trailing QKeySequence parameter have been deprecated and therefore
cannot be removed. In a !QT_CONFIG(shortcut) build, the same functions
are 1:1 copies of QWidget functions and can be removed (from the API).
[ChangeLog][QtWidgets][QMenu/QToolBar] The addAction() functions have
been moved down into QWidget.
Change-Id: I49997b3440c137a1d4e3858d1d27d34a191e1eed
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Since any QWidget can have actions since at least Qt 5.0, it makes no
sense to keep the addActions(text) etc. convenience functions that
have traditionally existed in QMenu and QToolBar only in these two
classes, where, to add insult to injury, they were just copies of each
other, increasing library size for no real reason.
So, add them to QWidget, too. This will allow us to de-duplicate the
code between QMenu and QToolBar, too, which will be done in a
follow-up patch, subject to BC constraints.
[ChangeLog][QtWidgets][QWidget] Added the same addAction(text)
overloads that previously existed only on QMenu and QToolBar, with the
following two differences: First, the QKeySequence object, if any, is
now available on all overloads, not just the ones taking a slot, but
has changed position to allow, secondly, passing an optional
Qt::ConnectionType parameter which will be passed to the
QObject::connect() call. In addition, the function template overloads
are now properly constrained so that they exist if and only if the
corresponding QObject::connect() call does, too.
Change-Id: Ifc3c2789600cf603192de8224fecbf9c88d91970
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use unique_ptr to indicate ownership. Use std::stack to enforce
stack-ness (QStack doesn't). Requires the addition of a clear()
function, for which we spin a SmallStack wrapper. It also helps to not
have to repeat the value_type...
Because we use unique_ptr, `state` and `states` are now exclusive
(before, `state` was always `states.back()`). Correspondingly, rename
`states` → `savedStates`.
As a drive-by, this fixes an off-by-one error in a qWarning() (checked
`> 1`, but reported one saved state too many).
Change-Id: I8faade59300401be802ddc52c64ce31b8f23dc52
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QLineEdit was the only widget in Qt that flips the widget's layout
direction if a key press changes the document's layout direction.
This resulted in inconsistent behavior: setting text to RTL content
programmatically didn't set the widget's layout direction to RTL, but
the first key press (even if just a cursor key or a latin1 character)
did. Clearing the text with keyboard shortcuts changed the layout
direction, doing the same using the clear button or context menu actions
didn't.
In addition, the automatic changing overrode whatever the UI developer
set, or what Qt detected as the global layout direction based on the
active translation.
Remove the automatic flipping.
[ChangeLog][QtWidgets][QLineEdit] QLineEdit used to change the layout
direction on each key press, based on the text content. This feature
resulted in an inconsistent and erratic user experience, and has been
removed.
Fixes: QTBUG-95011
Pick-to: 6.2
Change-Id: Ib653350d35e25ce431cca1abe9b45bdf33d035fe
Reviewed-by: Fan RuiJie <fanruijie@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The \sa was neglected
Amends d33040548f
Pick-to: 6.2
Change-Id: Ib298ac3390819f9ea4092a1f2bf470ea82c9e4fe
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Outside tests, all in-tree callers of QObject::findChildren() pass no
name to match, and in my experience that is also true for the vast
majority of out-of-tree users.
Avoid the temporary QString creation in the caller and the repeated
QString::isNull() checks in the implementation by overloading
findChildren() without a name argument and checking for name.isNull()
only once, forking off into separate helper functions.
Adjust in-tree callers that used an explicit `QString()` argument in
order to pass options, which goes to show that `name` should never
have been the first argument of findChilden() in the first place, even
though I appreciate the symmetry with findChild() (the use-cases of
which, however, are radically different).
Change a `findChildren().size() == 0` call found while scanning for
findChildren() calls to `!findChild()` as a drive-by.
Modernize loops in the various qt_qFindChild{,ren}_helper() overloads
to match how the new code looks.
[ChangeLog][QtCore][QObject] Added findChildren() overload taking no
name (thus optimizing this common case).
Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
For mobile platforms. Makes it quite a bit easier to follow on the
updates when I'm not tethered to my PC with ADB.
Change-Id: Icba03470e6082b6e47e31c9ead6df074407d3172
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
We have space for so many elements, so reserve()ing anything less
makes no sense.
Pick-to: 6.2 6.1 5.15
Change-Id: I84d692b10a6a491c37661f84aa3fdd9af43d71e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
qt_config_linker_supports() repeated the conditions of all use_*_linker
features, because the features are not evaluated yet when this function
is called, and the function needs to know what linker is used to build Qt.
Move the required tests and features before any
qt_config_linker_supports() call and evaluate the use_*_linker features
early.
Change-Id: I306f032356682a0e82e4d7c4234e5bbc820ab143
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Since platform definition directory is used as an interface include
path of the Qt::Platform target, it makes sense to define it for this
target only. Also the definition of cached values that contain
path to platform definition looks redundand.
The definition of QT_PLATFORM_DEFINITION_DIR from command line
doesn't make any sense since build procedure doesn't take it into
account when installing mkspecs and the use if the user-provided
QT_PLATFORM_DEFINITION_DIR value as a Qt::Platform include directory
causes inconsistency in the prefixed builds. INSTALL_MKSPECSDIR
and QT_QMAKE_TARGET_MKSPEC should be used instead.
Change-Id: I3636c57b835cb84511a358a0910cc482c5fbd81e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Instead of just sizeof(T), we, of course, also need to take the
support structure into account, to wit: the bucket list and, in the
node, the next pointer and the stored hash value.
Pick-to: 6.2 6.1 5.15
Change-Id: I8227a95c49e316aacf3d4efd8f6170ea3bea1cf0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
SSL_get_peer_certificate was deprecated in OpenSSL v3 and can be 'compiled-out'
using OPENSSL_API_COMPAT. Use SSL_get1_peer_certificate instead.
Pick-to: 6.2
Task-number: QTBUG-94596
Change-Id: Iedb2e06e673e981cab79d4bf0147ac6f5f90089a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QT6_ADD_RESOURCE_DECLARATIVE_EXTENSIONS is never defined now. All qml
files are expected to be added via dedicated functions provided by the
qtdeclarative repo rather than being given to qt_add_resources()
directly.
Pick-to: 6.2
Change-Id: I44feca84a2e3d4ef8ecc0140f88625ff192bfdfd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
QSettings encodes QVariants as @Type(data) strings. If that data contains
a null-byte, we write the string as UTF-8 encoded CFData. When reading it
back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant.
The problem arises then the user writes raw QByteArrays with a @ prefix.
We can detect this situation by checking the result of stringToVariant,
and if it's just a simple conversion of the string into a QVariant, we
know that stringToVariant hit its fallback path due to not finding any
embedded variants.
If that's the case, we return the raw bytes as a QByteArray.
Pick-to: 6.2 6.1 5.15 5.12
Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Cleanup: This patch does not change functionality.
In several places, sorting inside of the QTreeModel is disabled
and afterwards restored. There is a RAII class for this, which is
used in some places, but not in others. This patch introduces
more consistent usage of this RAII object.
Change-Id: I9802998ad31d0f9d4417824f72ff0abbb0c38a17
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
... instead of raw pointers or QSharedPointer.
Raw pointers are, of course, a no-no in modern code. In particular,
when the result is then held in shared_ptr or QSharedPointer,
make_shared or QSharedPointer::create() should be used to reduce
number of memory allocations.
Since this is private API, we're free to use std::shared_ptr, which
does only half the atomic operations on copies, compared to
QSharedPointer, so is more efficient.
For either make_shared or QSharedPointer::create(), we need to work
around the private ctor, which we do by inheriting a member-function
local class from QColorTrcLut and make_shared'ing that. As a
member-function-local class, it has access to the otherwise private
parts of QColorTrcLut, including its default constructor. As a public
subclass, shared_ptr has no problem performing the derived-to-base
pointer adjustment in the return statement. This way, we can use
make_shared even though our target's class' ctor is private.
Change-Id: Icb11249b54cd5e544e692f6a0bf1f9dda1710454
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Instead of special casing sRGB.
Pick-to: 6.2 6.1
Change-Id: I7ad20c4b9600210333d5e44c3a2d20ce7d39dd92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Repositories have been changed to be free of this warning. We're now
changing the default of QT_WARN_PLUGIN_PUBLIC_KEYWORDS to ON.
Set this variable to OFF to disable the warnings.
Pick-to: 6.2
Change-Id: Ie37a4df1032f5b1e9152d970e8a14c574ed70241
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use QByteArray::fromRawData() and QList::fromReadOnlyData() to return
the QList<QByteArray> without allocating memory.
Change-Id: Iefa3250ea2acc79df92400d2d225e450566477e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The ${QT_SOURCE_TREE}/src/network include paths of several tests are
apparently not needed anymore. Remove those.
tst_qfilesystementry and tst_qfreelist are the only tests that actually
need to reference files in qtbase's source tree. Simply use the paths
relative to the project file.
Task-number: QTBUG-88090
Change-Id: Ic6f341e001338c1b07dce6e58316245bc9560c5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
...where applicable to use a known CMake-provided variable in favor of
our own cooked up one.
This affects four plugins that are not supposed to be built out of tree,
meaning QtBase_SOURCE_DIR is available (and identical to
QT_SOURCE_TREE).
Task-number: QTBUG-88090
Change-Id: I27f012e6c5fd99c3239a1dd65c0811c819dbcfe9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use the BASE argument of qt_internal_add_resource to avoid the
specification of resource aliases.
Use QtBase_SOURCE_DIR in favor of QT_SOURCE_TREE to use a known
CMake-provided variable in favor of our own cooked up one.
Pick-to: 6.2
Task-number: QTBUG-88090
Change-Id: I0d8b30a1564495db475ae58596b52b373b2b173e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Originally, the template specialization QtPrivate::IsSequentialContainer
was done in Q_DECLARE_METATYPE_TEMPLATE_1ARG. This was conceptually
wrong and prevented re-using Q_DECLARE_METATYPE_TEMPLATE_1ARG.
This patch moves the specialization to
Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE, which makes it symmetrical to
Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE and allows re-using
Q_DECLARE_METATYPE_TEMPLATE_1ARG with non-container templated types.
Change-Id: I3b952ed36e4c140bce3511aebc1e5599c4822e34
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
For generic interop with other parts of Qt, we need to be able to
extract the type-erased internal storage of QFuture<T>. In particular,
QtWebChannel needs this to transparently support QFuture<T> as a method
return type.
Task-number: QTBUG-92903
Change-Id: I763f054656b8810d58720262d364baf42c47eb37
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
SFINAE out the new-style connect() overloads for const char*
functions.
Before, we detected the problem in the body of connect(), by failing
the static_assert for signal/slot argument compatibility, but that's
too late. We don't want to select that overload at all, because we
want that decltype(QObject::connect(QAction*, &QAction::triggered,
QObject*, SLOT(something())) SFINAEs instead of returning
QMetaObject::Connect, because then all the classes that provide
convenience new-style connect syntax by wrapping the
QObject::connect() call can just use that decltype() to accept
anything that will succeed in the wrapped connect() call instead of
manually trying (and failing) to provide proper overloads themselves.
[ChangeLog][QtCore][Potentially Source-Incompatible Changes]
QObject::connect(sender, pointer-to-member, [receiver, ], SLOT(~~~))
is now SFINAEd out instead of triggering a static_assert(). That means
it is now possible to use Expression SFINAE
(decltype(QObject::connect(<sender>, <signal>,
std::declval<Args>()...) to properly wrap new-style QObject::connect()
calls with a single wrapper function, greatly simplifying the
implementation, incl. passing Qt::ConnectionType arguments. For more
information on how to use this in your own code, see the sources of
QWidget::addAction().
Change-Id: I4052a49eacd63a432a9648a667adc435744a633d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
...lest some code tries to set it to no possible effect.
Change-Id: I7aed05200c1abeda1d2f9d88ceb99a5ce6132dbf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Enable the check, that has been disabled because of instability, which
makes the test-case useless. The reason for instability probably was
that it doesn't always start maxThreadCount number of threads: it could
be less if the workers reuse the thread pool's already created threads
(if possible) instead of creating new one each time. But we can at least
make sure, that we're not starting more threads than expected.
Task-number: QTBUG-94463
Pick-to: 5.15 6.1 6.2
Change-Id: I8e498c377d86c49758bde0114fe6f7e0432fe993
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
QTableView stored the current row/column selection start in an own
variable instead using currentSelectionStartIndex. This leads to an
inconsistent behavior when the selection is done with a click on the
header and then in a cell (and the other way round)
Fixes: QTBUG-92561
Change-Id: I4c8bda3a938de451b6eff2819141e86a6870fbef
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends 556fbbea6e, which breaks
translucency of frameless tool windows. Possibly a bug in macOS, a
window being made miniaturizable should not have side effects on
background or translucency.
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-95042
Task-number: QTBUG-65637
Change-Id: I651196e3cf8a9c59b250e5f1b4064cc4ded02372
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Using the QTextFormat::FullWidthSelection property to select a line
would previously not take into account right-to-left text layouts.
With this patch, the whole line should now be drawn correctly for both
left-to-right, and right-to-left layouts.
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-91125
Change-Id: Ide7b340cd7b4060e7c00e55e0011a86ffdfb5eb4
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>