Helps keep the code fit into line length limitations.
Change-Id: I2e861c6f0a991cc36991572c4386040b8e11ca40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Because we can, and it prevents all the machinery from being exported
by the Q_CORE_EXPORT on QRunnable.
Change-Id: I80e0690956bff612f2048eefb2b64bc198835f1f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
There's only one user of this function-like macro and already broke
unity-build, so make it a lambda instead and scope it close.
Remove the previous work-around (#undef at end of TU).
Pick-to: 6.5
Change-Id: I0bd7cd41b89a6f32144d2040ff2b4a18d0045d21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
After 9efaf8bae9 commit there is no
possibility to create release package for cmake based builds.
Added a new cmake variable (QT_ANDROID_DEPLOY_RELEASE) to allow turning
on release build manually.
Task-number: QTBUG-112921
Task-number: QTBUG-108132
Task-number: COIN-882
Pick-to: 6.5
Change-Id: Idf015b4ad3f8cba792aab75a01e1c81225cad4f0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
... optimizing the storage of empty function objects.
I thought we had applied this a long time ago, but it turns out that
QPrivateSlotObject (c61d9873e5) is only
for QObjectPrivate::connect()...
This adds the same optimization for regular QObject::connect(). This
is BC, since we don't touch the base class (QSlotObjectBase), and the
QCallableObject subclasses are all-inline or explicitly Q_DECL_HIDDEN.
Amends c61d9873e5.
Change-Id: I63fd1b6f882b58f9f98eae67c636c3615248ad79
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Useful for operating on QPainterPaths with algorithms designed for
quadratic, and not cubic, curves.
Change-Id: I1af2d6e4f2b66ce675cde863f67d65fbf9db7d39
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Correctly return only the fileName portion from
AndroidContentFileEngineIterator::currentFileName(); which
QDirIteratorPrivate::matchesFilters() expects when looking for matches
of the file pattern provided to the QDirIterator.
Fixes: QTBUG-112738
Pick-to: 6.5 6.2 5.15
Change-Id: I98dba2df014b27f33cd7e54fab3ad2de8c7c1750
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
When searching for an icon, we either use the system theme or the theme
set as a fallback through QPlatformTheme, it's only one or the other.
It can easily happen that the fallback theme we pick as a parent theme
will not fit into the application style (color-wise). For example using
KDE apps on GNOME, where we use "Adwaita" icon theme, we would always
fallback to "Breeze", however, using dark theming, we want to fallback
to "Breeze-dark" and this can be easily set through QPlatformTheme
integration, but it's not going to be used when the system icon theme
is valid and in such case the fallback theme will be ignored.
This change makes the system fallback theme used as the default fallback
by putting it to the list of parent themes.
Pick-to: 6.5 6.2 5.15
Change-Id: I966cd8ddd0e5576e3593d349fe7ee7139136bfdf
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Don't refer to qt_add_big_resources as the preferred way of adding big
resources. The qt_add_resources command has support for big resources
these days.
Move the link to add_big_resources to the "see also" part of the page.
Pick-to: 6.5
Change-Id: I030ef079db8ac41417049e58e98eb7aa6fd809e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The QWeakPointer conversion SMFs cannot actually be used for QObject
payloads, as, for unknown reasons (some comment about vtable this
author doesn't understand), conversion goes through QSharedPointer,
the creation of which throws the checkQObjectShared() warning and
yields a nullptr.
We need to continue to use the QWeakPointer(T*, bool) constructor the
QPointer(T*) ctor also uses.
It's high time we dissociated QPointer from QWeakPointer...
Amends 5f28d367d9.
Fixes: QTBUG-112464
Change-Id: I2f93843af3daf02323d77a4259eaa3745d8de3a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The constructor's documentation already had the note saying that we
could apply this optimization, but it wasn't there and looks like it
never was. This only applies to the default constructor, which sets t1
to zero, which is the epoch. This could be a problem for an OS whose
monotonic clock starts with negative values, but I don't know such an OS
exists and this hasn't been a problem so far.
This commit doesn't change the behavior of the old-style, non-
std::chrono getters, because we always transform any negative remaining
time to 0. It is only possible to observe it by asking the remaining
time or the deadline using the std::chrono API.
Change-Id: I6f518d59e63249ddbf43fffd175a3fc2911e91fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We have quite a few Qt API that assumes this, so making this change
helps transitioning them to QDeadlineTimer.
[ChangeLog][Important Behavior Changes] QDeadlineTimer will now
interpret negative millisecond remaining times as "forever", instead of
only the value -1. This brings the API closer in line with other API
like QMutex. This change does not apply to the nanosecond counts in the
API, nor to the API based on std::chrono.
Change-Id: I6f518d59e63249ddbf43fffd175a3e5bead564ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In case the time is of less than 1 ns, we want to make sure it remains
non-zero.
Change-Id: I3e3bfef633af4130a03afffd175d9c4903271f80
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
qabstractanimation_p.h is pulled in from qmltc generated code, that
users may decide to build with `QT_NO_KEYWORDS`
Change-Id: I6ce1e82b3c68f6b7e1e349b40945a6f398d8baf5
Pick-to: 6.5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As part of ed2b110b6a the implicit caching
of some of the system locale queries was removed, resulting in a
three orders of magnitude performance regression on converting
dates to strings via QLocale::system() on macOS and iOS.
We now cache the most critical of these, the zero digit, in the Darwin
backend, and clear the cache in response to the system locale changing,
restoring the performance two orders of a magnitude closer to that of Qt 5.
We're still one order of magnitude off, which seems to stem from the
auto release pool in QSystemLocale::query().
Fixes: QTBUG-104785
Pick-to: 6.5 6.2
Change-Id: I26f96147d430f08a721c55a1048d586a4af3a76c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Having the size potentially be larger than the capacity can't
be considered anything other than a bug.
Pick-to: 6.5
Change-Id: Id059c0f2c7320f992d897011d7aa944c5cb86058
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This moves the padding that exists on 64-bit architectures from between
the two fields to the end of the the structure. In turns, this allows
certain ABIs to reuse the tail padding space of the base class to store
some information. It can only be used if the functor has alignment of 4
or less, but the interesting case is when it's an empty but final
functor.
The pahole report goes from:
struct CallableObject : QSlotObjectBase {
/* class QSlotObjectBase <ancestor>; */ /* 0 16 */
struct FinalFunctor func; /* 16 0 */
/* XXX last struct has 1 byte of padding */
/* size: 24, cachelines: 1, members: 2 */
/* padding: 8 */
/* paddings: 1, sum paddings: 1 */
} __attribute__((__aligned__(8)));
to (pahole gets very confused by this trick):
struct CallableObject : QSlotObjectBase {
/* class QSlotObjectBase <ancestor>; */ /* 0 16 */
/* XXX last struct has 4 bytes of padding */
/* XXX 65532 bytes hole, try to pack */
struct FinalFunctor func; /* 12 0 */
/* size: 16, cachelines: 1, members: 2 */
/* padding: 4 */
/* paddings: 2, sum paddings: 5 */
/* BRAIN FART ALERT! 16 bytes != 0 (member bytes) + 0 (member bits) + 65532 (byte holes) + 0 (bit holes), diff = -524160 bits */
} __attribute__((__aligned__(8)));
Change-Id: I3e3bfef633af4130a03afffd175d3be98511bae5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
After the recent changes we only have a single implementation of
QSlotObjectBase, which can handle free functions, member functions,
functors, and lambdas. Rename it to callable, and explicitly hide
the static implementation function so that it doesn't become a symbol
of static libraries using Qt.
Also rename makeSlotObject to makeCallableObject, and polish coding
style and comments in the qobjectdefs_impl header a bit.
Change-Id: Id19107cedfe9c624f807cd8089beb80e9eb99f50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSet's iterator doesn't have operator--, but the
Q_DECLARE_SEQUENTIAL_ITERATOR macro declared and implemented functions
hasPrevious/previous/peekPrevious/findPrevious for the QSetIterator
anyway, depending on that operator. The resulting code couldn't compile.
Use SFINAE to remove the various "previous" functions from Java-style
iterators if operator--() is not present.
This removes the hasPrevious() API as well, even though it could compile
(as we only check whether the iterator points at constBegin). But since
nothing useful can be done with that information, it's best to remove
that member function as well.
[ChangeLog][Potentially source-incompatible changes] QSetIterator no
longer has a hasPrevious() member function. The underlying iterator
doesn't implement operator--(), so couldn't be moved backwards anyway.
Fixes: QTBUG-113379
Change-Id: I47b0ba384d8fcd127123d8fa509cd89e10ea8c99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The reason this worked before is unclear. It could be suspected
that we have made a dpi awareness change or Microsoft changed
the behavior of the OpenThemeData function.
Regardless, we expect the result to match the primary display which
OpenThemeData doesn't do (anymore). Instead it returns a value based on
the hwnd screen (which btw didn't always match the widget) and the cache
system would then re-use that theme also for hwnds on other screens.
The most obvious solution is to use OpenThemeDataForDpi to make sure
we get a theme result matching the primary sceen. Then our correction
of the result by with multiplying
QWindowsStylePrivate::nativeMetricScaleFactor(widget)
works again.
This fix does not only fix QMenu sizes. It fixes the size for all
widgets that use this theme function, which could return near
random results before.
We load this library dynamically since MinGW 11.2.0 won't link with it.
[ChangeLog][QWidgets][QMenu] Fixed menu sizes on Windows systems
with more screens.
Fixes: QTBUG-112911
Pick-to: 6.5
Change-Id: I8fdfde2ef5b2aa407cbc74c85afe2c0b74026cff
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
If the event dispatcher is interrupted we propagate the interrupt to
lower event loop levels, in case they too need to be interrupted. And
we defer the actual interrupt of the NSApplication to the next time we
process Qt events, to avoid AppKit dropping queued events on the floor.
This logic relies on QCocoaEventDispatcher::processEvents() setting the
interrupt flag to false, which signals that we should not continue to
tear down any further event loops.
Unfortunately, native run loops such as running application modal
sessions, are not driven by QCocoaEventDispatcher::processEvents(),
so we never reset the interrupt, and end up ending the session
immediately.
To work around this we need to explicitly clear the interrupt flag
before starting native modal sessions. This also fixes the issue
seen in QTBUG-111524 with showing native alerts from nested event
loops.
Fixes: QTBUG-112697
Task-number: QTBUG-111524
Pick-to: 6.5 6.5.1
Change-Id: I6aaec97011fd18c4a513c1dde3173b1cc4d50112
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If someone has, for unknown reasons, re-parented the scroll bar of a
scroll area to outside the scroll area, we should not blindly add the
parent widget of the scroll bar as an a11y child of the scroll area.
We don't need to explicitly add the scroll bar itself as a child either,
as that will be handled by whoever is the new parent widget, as a normal
scroll bar would.
Fixes: QTBUG-93768
Pick-to: 6.5 6.2
Change-Id: Ib26f31674602e2221311e864ad31bbf141cad8f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Similar to the font-features-settings in CSS, this is a low-level
API that allows you to pass the information to the shaper in order
to enable or disable specific font features by name.
[ChangeLog][QtGui][Text] Added an API to QFont which makes it
possible to enable and disable specific typographic features
in OpenType fonts.
Change-Id: Ib48c678f3b97a5a562b08ae34dc895800c8885c0
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
...optimizing the storage of empty function objects.
Change-Id: I6db7384e1ebb87249d5b93922a6c92f0767cc401
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This is a generalization of QPrivateSlotObject's FunctionStorage.
Changes from the old API:
- uses a more neutral API (s/func/object/)
- preserves cv-qualifiers and value categories
- preserves constexpr'ness
- adds a disambiguation tag (e.g. for use in a compressed_pair).
The main feature is that it transparently uses the empty base-class
optimization to stow away empty classes without allocating separate
bytes for them.
To be used for the public QSlotObject and QGenericRunnable, at least,
so finally pulled the trigger and made it a separate component.
Change-Id: I9a13bbdd1dcf64aaf5fc7b2d40a60050d61800b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While parsing the markdown document, each addition of text and
formats was triggering a relayout of the so far existing document,
leading to quadratic behavior and very bad performance for any
non-trivial markdown document.
Guard the changes while parsing with a begin/endEditBlock to
avoid these intermediate updates.
The performance impact can for example be observed with the
markdown editor in Qt Creator (11+).
Pick-to: 6.5
Change-Id: I5f89441ea41bc3c6281b616f0c5528b49b48e432
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The exception for MSVC was probably added due to similar logic in
qlogging.h, but in this case, qAbort never returns also with MSVC.
Change-Id: Ica2155c34d4b32b20af5b1fcb5af35bb3ff6f668
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Header field names are always considered to be case-insensitive.
Pick-to: 6.5 6.5.1 6.2 5.15
Fixes: QTBUG-113392
Change-Id: Ifb4def4bb7f2ac070416cdc76581a769f1e52b43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Polymorphic class QMimeXMLProvider is copyable. Potential slicing.
[-Wclazy-copyable-polymorphic].
Change-Id: I1eff1389140ce9426db32a37df89935a7b3db3a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Drive-by change: use range-for with a QHash::asKeyValueRange().
Change-Id: I173d28d759bef8f23330338127eeff3018af4a55
Reviewed-by: David Faure <david.faure@kdab.com>
According to the Freedesktop spec[1], a mimetype that has glob-deleteall
overwrites other glob-pattern definitions for a mimetype if it is in a
higher precedence dir, the default order is (from high to low)
~/.local/share/mime, /usr/local/share/mime, /usr/share/mime. Or if the
XDG_DATA_DIRS env var is set, then it takes precedence. The
QMime*ProviderS in m_providers are constructed/stored in that same
order, high to low).
For QMimeXMLProvider, we can just clear the glob patterns associated
with those mimetypes from the lists/maps. For the QMimeBinaryProvider
however, we can't change the binary (mmap'ed) cache file, instead check
mimetype names against the exclusion list before modifying a
QMimeGlobMatchResult.
[1] https://specifications.freedesktop.org/shared-mime-info-spec/latest/ar01s02.html
This test uses XDG_DATA_DIRS so only viable when USE_XDG_DATA_DIRS is
defined.
Fixes: QTBUG-101755
Pick-to: 6.5
Change-Id: Icadbdf1027155296377c5a6ab3be8e41b6668325
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
[ChangeLog][QtCore][QDebug] Added pretty formatting of C++ <chrono>
durations.
[ChangeLog][QtTest] Added pretty formatting of C++ <chrono> durations
for QCOMPARE expressions.
Change-Id: I3b169860d8bd41e9be6bfffd1757cc087ba957fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The frame size is resize border size + padded border size [1], so our
current calculation is not correct, and thus the title bar size is
also wrong.
[1] We also use this calculation in the Windows QPA, and it's also
widely used by many open-source repositories, including Microsoft's
own products.
Change-Id: I5a4c1f91a31a22cade6227131659a6de73bb6808
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This amends commit 115f828ae4
"QTestEventLoop: stop when the test fails" from Qt 6.3 to not attempt to
stop the QTestEventLoop instance if the failure happened outside the
main thread. This is to prevent the QTEL from being created outside the
main thread and thus cause warnings about QObject in addition to and
logged before the real test failure.
[ChangeLog][QtTest][QTestEventLoop] The QTestEventLoop no longer
attempts to exit its event loop if the failure was detected outside the
main thread.
QWARN : tst_QMutex::tryLock_non_recursive() QObject: Cannot create children for a parent that is in a different thread.
(Parent is QCoreApplication(0x7fffffffe710), parent's thread is QThread(0x802e29000), current thread is QThread(0x7fffffffd5a8)
FAIL! : tst_QMutex::tryLock_non_recursive() 'timer.elapsed() >= waitTime - systemTimersResolution' returned FALSE. ()
Change-Id: Ieab617d69f3b4b54ab30fffd175b139322a1f02c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since we don't have different environment variables for the plugin paths,
users have to set QT_PLUGIN_PATH to where plugins for both Qt 5 and 6
(and future versions) are located. This causes Qt to print warnings that
those couldn't be loaded because the major version mismatches. So don't
print them any more.
QT_DEBUG_PLUGINS and the category logging filter can still be used to
enable them.
Fixes: QTBUG-107459
Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd175318ca1f8017bd
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
This commit implements the manufacturer, model, and serialNumber
properties of QScreen for the Windows operating system. These were not
available previously because the Display Devices API allows piecemeal
access to the EDID fields, and the GDI API only returns the i-th device
name, e.g. "\\.\DISPLAY1".
Accessing the EDID of a given screen is possible by, given a
WindowsScreenData instance storing the device path, pivoting from
SetupDiOpenDeviceInterfaceW and then extracting the corresponding blob
from the Registry through a key handle retrieved with
SetupDiOpenDevRegKey. This blob can be parsed just like in Linux with
the QEdidParser class. The resulting metadata is applied to
the WindowsScreenData instance.
Additionally, this commit implements support for clone groups by making
getPathInfo return a list of the matching DISPLAYCONFIG_PATH_INFO
instances, and then concatenating the monitorFriendlyDeviceName
and the EDID manufacturer, model and serialNumber properties.
This commit makes the Windows and Direct2D QPA plugins dependent on
setupapi, and extends the QEdidParser class availability condition to
include these platforms.
Pick-to: 6.5
Change-Id: I56886b035a3d15e6f90aad5d797aeda21f99ff74
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
How did this ever work? Q_GLOBAL_STATIC has been a structure for a long
time, but somehow this doesn't work with my latest changes.
qprinterinfo.cpp:73:49: error: operands to ‘?:’ have different types ‘QtGlobalStatic::GlobalImpl<{anonymous}::Q_QGS_shared_null>’
{aka ‘const QtGlobalStatic::Impl<QtGlobalStatic::Holder<{anonymous}::Q_QGS_shared_null, {anonymous}::Q_QGS_shared_null> >’} and ‘QPrinterInfoPrivate*’
Pick-to: 6.5
Change-Id: I6f518d59e63249ddbf43fffd175a264225f0480f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Add helper that allows us to determine the argument list and return type
of a functor. This triggers a compile time error if the functor has
operator()() overloads (we only support zero-argument call operators, but
there might be const/noexcept variations). Use that helper to declare a
ZeroArgFunctor type which also declares a ReturnType and Arguments alias.
Add a Callable alias that now combines FunctionPointer and ZeroArgFunctor
into a single type that we can then use to merge the specializations of
QMetaObject::invokeMethod.
[ChangeLog][Potentially source-incompatible changes] Using a functor
with several operator() overloads in QMetaObject::invokeMethod now causes
a compile time error. Qt would previously ignore const and noexcept
overloads and always call the mutable version on a copy of the functor.
Change-Id: I3eb62c1128014b729575540deab615469290daeb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the missing functionality to the Schannel backend to
make QSslCertificate::importPkcs12() work on Windows.
[ChangeLog][QtNetwork][QSslCertificate] Add support for
PKCS12 import with Schannel backend.
Change-Id: Ibb501724d0dc78b0507ac8becf4776fbba0a0623
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>