Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'
Change-Id: Ic18d0c8bcf64159b4c8fae8c9499839954a98884
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'
Change-Id: Ida9af2971924377efe2f49f435d79e109de2bdf4
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Use the new signal/slot syntax in the snippets where possible. Also
change some 0 to nullptr.
Change-Id: Ie3da2721d3cec33704f73f4d39c06a767717b095
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is
\nullptr' and 'are \nullptr'
Change-Id: I5ff46185b570bdfc7d20d18a47fd9174771ad8e5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
If available, use a C++17 std::pmr::unordered_set with a monotonic
buffer resource and a 256-byte stack buffer to avoid the per-element
allocations of QSet.
Results on my machine:
RESULT : tst_QStringList::removeDuplicates():"empty":
- 0.00014 msecs per iteration (total: 74, iterations: 524288)
+ 0.000031 msecs per iteration (total: 66, iterations: 2097152)
RESULT : tst_QStringList::removeDuplicates():"short-dup-0.00":
- 0.00043 msecs per iteration (total: 57, iterations: 131072)
+ 0.00013 msecs per iteration (total: 69, iterations: 524288)
RESULT : tst_QStringList::removeDuplicates():"short-dup-0.50":
- 0.00049 msecs per iteration (total: 65, iterations: 131072)
+ 0.00032 msecs per iteration (total: 85, iterations: 262144)
RESULT : tst_QStringList::removeDuplicates():"short-dup-0.66":
- 0.00057 msecs per iteration (total: 75, iterations: 131072)
+ 0.00039 msecs per iteration (total: 52, iterations: 131072)
RESULT : tst_QStringList::removeDuplicates():"short-dup-0.75":
- 0.00064 msecs per iteration (total: 85, iterations: 131072)
+ 0.00048 msecs per iteration (total: 63, iterations: 131072)
RESULT : tst_QStringList::removeDuplicates():"long-dup-0.00":
- 0.083 msecs per iteration (total: 85, iterations: 1024)
+ 0.039 msecs per iteration (total: 80, iterations: 2048)
RESULT : tst_QStringList::removeDuplicates():"long-dup-0.50":
- 0.11 msecs per iteration (total: 58, iterations: 512)
+ 0.078 msecs per iteration (total: 80, iterations: 1024)
RESULT : tst_QStringList::removeDuplicates():"long-dup-0.66":
- 0.13 msecs per iteration (total: 70, iterations: 512)
+ 0.10 msecs per iteration (total: 53, iterations: 512)
RESULT : tst_QStringList::removeDuplicates():"long-dup-0.75":
- 0.16 msecs per iteration (total: 86, iterations: 512)
+ 0.13 msecs per iteration (total: 69, iterations: 512)
When interpreting the data, take into account that each iteration
contains _also_ a deep copy of the QStringList d/t the detach from
'input'.
The pattern is used elsewhere in Qt, so I've put the class that
implements the seen set into a private header file and used in some
other places I found.
Change-Id: I1f71a82008a16d5a3818f91f290ade21d837805e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
I showed QGestureManager to a colleage and I just couldn't avert my
eyes...
Also remove a pointless container::clear() call (the data member's
dtor will do that implicitly).
Change-Id: Id2b3f471d62e5ea416e875f28ecee73f8614a469
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Provide a simple palette for dark mode, implementing
dark mode support level 2.
Task-number: QTBUG-72028
Change-Id: I6f71870b251ccb7da30c01abb22c224e600f2b27
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Implement dark mode support level 1: change the
window borders to dark and back, tracking the
activation of dark mode.
Task-number: QTBUG-72028
Change-Id: I6e8b31e7ee574f4d90438405f361cd940faee7fd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Read the dark mode setting and make it accessible
via native interface.
Add a command line option to set the support level.
Task-number: QTBUG-72028
Change-Id: I1e9fe296a6b1bda81512d003183038b866b67545
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Use a standard prefix for Window class names containing
version, build and namespace which should reduce conflicts.
Task-number: QTBUG-81347
Change-Id: Ia7c20af71d364e362781f791a4e51b77d605c918
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The previous versions of these functions that returned by-pointer are
held over from Qt 1 times. They are inconsistent with the rest of the
Qt API.
[ChangeLog][QtGui][QCursor] QCursor::bitmap() and QCursor::mask()
can now return by-value instead of by-pointer.
Task-number: QTBUG-48701
Change-Id: I3ca4f0c28d5c831727a60309facfb49c74673bb7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The previous versions of these functions that returned by-pointer are
held over from Qt 1 times. They are inconsistent with the rest of the
Qt API.
[ChangeLog][QtWidgets][QLabel] QLabel::pixmap() and QLabel::picture()
can now return by-value instead of by-pointer.
Task-number: QTBUG-48701
Change-Id: I23ce319a7b1f757e1f4dec697551bb472e92fabf
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Create Qt:: versionless targets for libraries and tools. So
Qt::Core will link to Qt5::Core.
Add additional feature properties to targets, with the same name
they have in Qt6: QT_ENABLED_PUBLIC_FEATURES,
QT_DISABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES,
QT_DISABLED_PRIVATE_FEATURES, to be forward-compatible with Qt6.
Prefix properties with INTERFACE_ for interface libraries.
Create functions with no major version in their prefix, so qt_foo
instead of qt5_foo.
The non-versioned functions will call the versioned functions,
depending on the value of QT_DEFAULT_MAJOR_VERSION, which can be
set by an application developer before finding the Qt package.
Set QT_DEFAULT_MAJOR_VERSION to 5 if the value has not been defined
in the current scope.
Application developers can set QT_NO_CREATE_VERSIONLESS_FUNCTIONS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned functions.
Application developers can set QT_NO_CREATE_VERSIONLESS_TARGETS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned targets.
Setting these can be useful when both find_package(Qt5) and
find_package(Qt6) are in the same project.
If none of these are set by the user, then the first find_package(Qt5)
will create versionless targets with the major version being "5",
which means the second find_package(Qt6) will not create versionless
targets.
Handle versionless plugin names in qt_import_plugins, so both
Qt::QCocoaIntegrationPlugin and Qt5/6::QCocoaIntegrationPlugin
are recognized by the function.
Allow specifying multiple types in EXCLUDE_BY_TYPE in
qt_import_plugins, to be consitent with the Qt 6 version.
Make sure to set the QT_PLUGIN_CLASS_NAME property to compatible with
Qt 6.
Task-number: QTBUG-74137
Task-number: QTBUG-80477
Change-Id: Ib89d090ea6f7794d7debd64f03f29da963a17ca7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Helps pass it through QVariant, and needed for QML support.
Change-Id: Id161ff9b8f81ad55a7ee7a7c4c614bdf74bca4a1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
If focusRect was 5 pixels past the right side of the viewport, then the
scroll area would need to be scrolled by 5 pixels. The error arises
because of this:
focusRect.right() - d->viewport->width() == 4
focusRect.right() is still inside the rectangle but width is not.
So one has to be added. Likewise for focusRect.bottom() and height.
Change-Id: Ice47a7758d136b2e4bdcbe25a33a015b37f500c1
Fixes: QTBUG-80093
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When the tested widget has a focus proxy, then we should check if the
current focus widget is not the same as that focus proxy before setting
it to be the widget that gets focus. This ensures that when back-tabbing
from a widget like QDoubleSpinBox that it will not get stuck inside that
widget and will back-tab to the next correct one.
Fixes: QTBUG-81097
Change-Id: I3f689c7715da7f3ce8c3d2f616041528f5778a2f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
When closing a popup (submenu) triggers closing another popup (the menu)
programatically it can happen that QApplicationPrivate::popupWidgets is
destroyed. Therefore we have to check if popupWidgets is still valid
after the focus change event was delivered.
Fixes: QTBUG-81222
Change-Id: Ide3a6897e43f389d396a80d8b158f7c8eb04e3aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Deprecate QTextBrowser::highlighted(QString) to avoid the use of
qOverloadOf<>.
Task-number: QTBUG-80906
Change-Id: I757622c976f7540ecef9225026299ebb0b90d007
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
QComboBox::setItemDelegate() does delete the old delegate which is in
constrast to all other setItemDelegate() functions which is quite
confusing. Sync in by *not* deleting the delegate in
QComboBox::setItemDelegate() and adjust the documentation to explicitly
state that the ownership is *not* passed to the affected classes.
[ChangeLog][QtWidgets][QComboBox] QComobBox::setItemDelegates no longer
deletes the previous delegate set.
Fixes: QTBUG-72483
Change-Id: I89c8e53903e7c9924a980c57b83ce40f5866e6ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The function is used by QGraphicsRotation, which is in widgets.
QGraphicsRotation is marked as a friend, so that it can access the
private method. QtQuick needs access to the same method, so internally
it declares a "fake" QGraphicsRotation class, just so that it can
private access. This breaks now that QtQuick needs to do QT += opengl,
which implies widgets and thus ends up including the header file that
also declares QGraphicsRotation.
So instead of these hacks, let's make the function public, but remain
\internal in terms of docs.
Change-Id: I671f68c9d7ab0aac985e0b583f63f3ee962567dc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Update instance of old code using JNI_VERSION_1_4 to make the code
consistent.
Change-Id: I779696738caa3b844f4adf33104b4328dba748a5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
We always pass the same value. The builtins are also using exactly this
"cd command" unconditionally.
This deduplicates the code at the call sites of
callExtraCompilerDependCommand a bit.
Change-Id: I5c412c815d50afdac55e1b45021f37f2545ce8f0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Use the central callExtraCompilerDependCommand in the last place where
the code to call an extra compiler's depend_command was duplicated.
Note that this is in the "Bad hack" section. We're making this hack less
bad, but the comment still applies.
Change-Id: Iaa857af20ca46b2d73053d3e264c63124c87a41b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
src/corelib/tools/qmap.cpp:1199: (qdoc) warning: Can't link to 'QMultiMap::unite()'
src/gui/kernel/qevent.cpp:949: (qdoc) warning: Unknown command '\see'
src/gui/painting/qpaintengine_raster.cpp:344: (qdoc) warning: clang found diagnostics parsing \fn Type QRasterPaintEngine::type() const
error: unknown type name 'Type'
src/gui/doc/src/qtgui.qdoc:45: (qdoc) warning: Can't link to 'Build with CMake'
examples/widgets/doc/src/gallery.qdoc:28: (qdoc) warning: Cannot find file 'widgets/gallery/gallery.pro' or 'widgets/gallery/gallery.pyproject'
src/widgets/kernel/qwidget.cpp:5950: (qdoc) warning: Can't link to 'setFilePath'
src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut()
Change-Id: I2395af854efebef719d4762da466f69f7c5aab9e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
We use automatic menu enabling, so the only property that should define
whether the item in the menu is enabled or not is QCocoaMenuItem::enabled,
which will then get read from validateMenuItem:, and synced to the native
menu item by AppKit.
Change-Id: I860d05bf4675c9bc2058d2ede44b5ac3551453b6
Fixes: QTBUG-81375
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The default menu items in the application menu are not part of a
traversable menu object hierarchy, so we never find a menubar.
Since that is only the case for those items, we can disable them
during any modal session.
Change-Id: Ie8d8db274176237de664c6e5ebfe5015e13800e4
Fixes: QTBUG-80273
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The assorted characters making up numbers can potentially need
surrogate pairs for their encoding, so Qt6 shall make the methods
returning them return QString instead of QChar. Prepare callers of
these methods to cope when that happens.
This follows up on commit f91af791cc,
which announced the intent to change the return type.
Task-number: QTBUG-81053
Change-Id: I99896c1d4fc2e24758c6486eaca32fd915b9a673
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSystemLocale::query() can return an empty string for PositiveSign on
Windows, apparently. In any case, we shouldn't be taking .at(0) of a
QString without checking it's non-empty.
Fixes: QTBUG-81530
Change-Id: I4d496a2650362f225d02998bd7b8be9fd783edb4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
On some inputs a QXmlStreamReaderPrivate may allocate another
QXmlStreamReaderPrivate as its entityResolver. Which, recursively,
may allocate yet another one.
This "chain" of QXmlStreamReaderPrivate objects was managed using
raw pointers, and a leak was possible by resetting one of
these pointers to nullptr without freeing the corresponding object.
Change-Id: I2c6e1f023a2ed68b2b1857db25c53cce7f6bd3e7
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
There's no point at keep raising errors after encountering the
first malformed attribute.
Change-Id: Idb37e577ea96c3bd850b3caf008fe3ecd57dd32e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Modifications of the CONFIG variable in the project file wasn't taken
into account in the handling of DEFINES_DEBUG and DEFINES_RELEASE,
because it was happening before the evaluation of the project file.
Moved the handling code into default_post.prf where the other *_DEBUG
and *_RELEASE variables are handled.
In practice that means: to avoid the addition of the NDEBUG define one
has to remove NDEBUG from DEFINES_RELEASE.
This amends commit 1456b809.
[ChangeLog][qmake] To remove the NDEBUG define that is added by
default in MSVC mkspecs, write DEFINES_RELEASE -= NDEBUG in your .pro
file.
Fixes: QTBUG-81569
Change-Id: I2ea5628653275a4e48ad002977d34969c0663815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Otherwise we can end up not writing anything due to recoverable libpng
error reports.
Change-Id: I4d4db42305482babffbe2bcf25535a35b51502a9
Fixes: QTBUG-81604
Reviewed-by: Boudewijn Rempt <boud@valdyas.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This is meant to correspond to required properties in QML.
Change-Id: I2645981e13f7423bc86b48370c165b3cfe2aaa62
Task-number: QTBUG-81561
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
If support for regular expression is disabled, fixed string can
still be used.
[ChangeLog][QtCore][QSslCertificate] Add overload of fromPath that does
not make use of QRegExp and deprecate the QRegExp variant.
Task-number: QTBUG-72587
Change-Id: I507d8941cc7d70166da0948375dc421fe5e7d967
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.
In addition, there was some manual changes to fix the compilation errors.
Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.
QVariant(QVariant::Invalid) in qstylesheet made no sense.
But note that in QVariant::save, we actually wanted to use the non-user type.
In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.
Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The existing code positioning the menu in
QToolButtonPrivate::popupTimerDone() had a clause checking
whether any receivers were connnected to QMenu::aboutToShow()
causing the sizeHint to be -1,-1 in that case (apparently
trying to accommodate menus populated in slots). In that
case, the checking for screen borders would not work, causing
the similar checks in QMenu::popup() to trigger, potentially
positioning the menu over the mouse.
To solve this dilemma, add a parameter taking a std::function
calulating the position of the menu from the sizeHint to
QMenuPrivate::exec()/popup() and invoke that in QMenuPrivate::popup()
after emitting QMenu::aboutToShow() when the sizeHint is known.
Fixes: QTBUG-78966
Change-Id: I180bd2dc7eadcaca6cadca13745ed4a2dd89e412
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The ForceIntegerMetrics flag was added in Qt 4.7 specifically because
of WebKit, which was rounding text metrics and getting mismatches
with the underlying font engine whenever it supported fractional
advances. For backwards compatibility with how the CoreText engine
worked before this, we added a flag to allow rounding all metrics.
Rounding advances gives very broken rendering and is hopefully not
used by anyone anymore, so lets remove this flag in Qt 6.
As for OpenGLCompatible, this flag is not used anywhere. I am
not exactly sure what this flag did, but all fonts are
"OpenGL-compatible" at this point.
[ChangeLog][QtGui][QFont] Deprecated QFont::ForceIntegerMetrics
and QFont::OpenGLCompatible, with the intention of removing them
in Qt 6.0.0.
Change-Id: I0a492c153348023f00d561bab8ab4b5104c6c7c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
They are now version 4, which is hopefully the final format,
relying on nothing but QDataStream.
Except for the qshader autotest which tests all the 1..4 versions
and so needs appropriate test data.
Also unifies the batch file naming.
Change-Id: Iec478be86d14dbec7ffb9d5f9b62c14fca5d7c9e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The eglfs_viv backend has Vulkan support now. While the support code is
common (lives in api/vulkan), we will not expose this for any other integration
yet, without the appropriate testing.
While putting this to eglfs seems unintuitive at first, it turns out that
for Vivante in particular this is very useful, since we can rely on the existing
framebuffer device infrastructure to solve certain problems (like the lack of
vsync)
The VK_KHR_display implementation of Vivante currently exhibits all the known issues
of the old, fbdev-style EGL plumbing (presumably since it lives on top of that):
- No vsync. This can be fixed by setting QT_QPA_EGLFS_FORCEVSYNC.
- May need a manual call to fbset to set the correct resolution before
launching the Qt app.
- And of course it lacks all the multi-screen features provided by drm.
- Plus, it seems the swapchain only supports a min/max buffer count of 1. This
needs special handling in QRhi since until now we assumed that there was always
at least 2 buffers available.
[ChangeLog][Platform Specific Changes][Linux] Vulkan is now supported by eglfs
(eglfs_viv backend) on i.MX8 devices with the Vivante graphics stack. This is done
via VK_KHR_display so no windowing system is required.
Task-number: QTBUG-78754
Change-Id: I7530aa026d4b904b9de83f9bdbdc4897ae770e71
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
On iOS, it was no longer using the Cocoa specific code needed to get
the locale and uiLanguages information so this functionality is brought
back as it was accidently lost.
In addition, this has a side-effect of fixing a problem with Android
versions below API 24 where it has no UiLanguages functionality so it
gets the information based on the system locale as a fallback.
Fixes: QTBUG-81307
Fixes: QTBUG-81357
Change-Id: I1709675b5bd5e9cedefb99eaec28279f20a347a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When a framework is loaded from a Samba share CoreFoundation will fail
to resolve its Resources directory, and hence its Info.plist, which
means we can't look up the bundle by id.
Until this has been fixed in CoreFoundation and/or the macOS Samba
implementation we work around it by manually looking for QtCore.
This fixes our particular use-case of finding QtCore so we can resolve
the relocatable prefix, but there's still a potential issue if any other
code tries to use CF for bundle lookups. We don't seem to have any of
those in Qt itself, but this should be kept in mind if we see similar
issues in the future.
Change-Id: I8fd471e44f6afe33a7459ce550f0fcec9acfefb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We don't know which versions these blacklistings actually apply on
unless we actually get macOS 10.14 and 10.15 into the CI and running
tests, so let's start with that, and then granularize the blacklists
after that.
Task-number: QTBUG-75786
Change-Id: Id79642afa50cb20efa2cd209286b6933918d3a4a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>