On the mac, the push button's bevel doesn't cover the entire widget
rectangle, but is smaller to leave space for focus frame, shadow, and
in general to meet style guidelines. Without this change, a click
anywhere inside the widget would activate the button.
QAbstractButton::hitButton can be reimplemented to limit the area in
which the button is triggered. However, getting the rectangle also
requires an addition to QStyle, so that we can query
QStyle::subElementRect for the actual area the button's bevel covers.
As a side effect, tests that use QPushButton and assume that it
responds to clicks at position 0,0 have to be fixed so that they
don't fail on mac.
Change-Id: I01b60a763bccf39090aee5b2369af300f922d226
Fixes: QTBUG-81452
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This adds instrumentation to the binaries. At the end of their
execution, these will then write a file containing information which code
was executed. This can be used for code coverage analysis.
[ChangeLog][QtCore][configure] Add switch "-coverage source-based" to
enable clang's "source-based" code coverage feature. This can be used
for code coverage analysis.
Change-Id: If31c6849aa797ff8820e041e85a492a14e2f1a6b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This can be used to create custom client side window decorations.
Refactors the xcb implementation to use edges instead of corners and we now use
the last mouse position for `root_x` and `root_y` in the `_NET_WM_MOVERESIZE`
event. Touch has also been changed, so just pick a point that's currently being
pressed.
The workaround for QTBUG-69716 has now been moved to QSizeGrip, as the comment
in the bug report says that it should ideally be fixed at the widget level.
On Windows, we no longer abort when GetSystemMenu returns false. I assume this
code was added to check whether the window didn't have any decorations and not
resize in that case. However, since the point of this patch is to let windows
without native decorations resize/move, it makes most sense to remove the
check.
Adds a manual test, which calls QWindow::startSystemMove and startSystemResize
on touch and mouse events.
[ChangeLog][QtGui] Added API for starting interactive window resize and move
operations handled by the system.
Fixes: QTBUG-73011
Change-Id: I7e47a0b2cff182af71d3d479d6e3746f08ea30aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
For every executable that uses a static Qt library (e.g. rcc using
libQt5Bootstrap.a) we got a warning: 'direct access in function...to
global weak symbol'.
This was because we've built all libraries with -fvisibility=hidden
-fvisibility-inlines-hidden but not the executables linking against
them. On macOS however, all translation units must have the same
visibility setting.
We're now setting the same visibilty for libs and executables on
darwin.
Fixes: QTBUG-81297
Change-Id: I2668e9385caa7f0ce78bf3727b4e5322bc4a294f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When a new model is set, a valid index is selected. When a model is
reset, this is not the case which is slightly inconsistent. Fix it by
using the same logic to find a valid index when the model is reset
Fixes: QTBUG-80998
Change-Id: I6c167511e199a6664343cf1dc3bcd27c65389bfd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Deprecate the overloaded signals
buttonClicked/buttonPressed/buttonReleased/buttonToggled taking an int
to avoid to need to use QOverload<> when connecting the signal. The id
of a button in a button group can be easily fetched with
QButtonGroup::id().
Task-number: QTBUG-80906
Change-Id: Idaaab54bbcb25cba543fc99f305b9f4743ee3ed8
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
InheritPriority may not be set, but the warning only occurs on Windows.
Move the warning to the public class.
Change-Id: I51d401300f840e4c1396c2c30182e49ed45d60d2
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the Qt-specific properites to the list.
Fixes: QTBUG-37938
Change-Id: I178de6cd5e17cd282a20ccee9ce8355f540c38a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
I missed copying over the documentation from QMap::unite when
deprecating it.
Amends 4ec6748c6a
Change-Id: I118382c4645bdc679a378e02a462d104b9af9aad
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
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>
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>