If an application added an "About" menu action, and then loaded
the qtbase translations, we would try to match the incoming menu
title ("About") against QCoreApplication::translate("QCocoaMenuItem",
"About"), which since qtbase provides translation in the QCocoaMenuItem
context would fail, and we would not detect the menu item role
successfully.
For this to work, the application developer would need to add their
own translations for every menu item, and these translations would
have to match the QCocoaMenuItem translations in qtbase.
By also comparing the menu titles against the untranslated heuristics
we now account for the situation that the app has not translated
its menu items.
If the app does add translations of its menu items these still need
to match the QCocoaMenuItem context translations.
Change-Id: Ic2f019cd42b7e080187f9738840f84b0cec239df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It adds nothing new to what the trivial and license wizard examples
show, other than a bunch of somewhat messy and outdated code to generate
C++ code files based on the input.
The example is referenced in a few parts of the documentation, but there
are equivalent snippets in the trivial and license wizard examples, so
point at those instead, and add some relevant API usage where needed.
Pick-to: 6.5
Change-Id: If1ff57e775bad28920d9e019aeccae69d1f4d127
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The workaround also is no longer needed on Windows so it can be removed
completely.
This patch amends 6a28b391f7.
Task-number: QTBUG-113556
Pick-to: 6.5
Change-Id: I69155e54da26acd49faf72816d1439fb3e322de9
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Rename it to "Translucent Background", as that's what the example shows
how to do. And modern applications shouldn't use a (binary) mask to
create shaped windows. Instead, set the TranslucentBackground attribute,
don't paint pixels that should be fully transparent and use anti-aliased
or semi-opaque painting for pixels that should be translucent.
Adjust the example and documentation accordingly. Move the statment that
widget masks create coarse visual clipping to the QWidget::setMask
documentation.
Pick-to: 6.5
Change-Id: Id49d854093f2cb471afb178d32723081c7543543
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The logic was introduced in 186589abd48b17fdb9b631211008753e2d1701b3
due to Windows supposedly not supporting NoSystemBackground. It's
not clear whether this is still the case, but as this workaround
causes problems on other platforms, such as bringing up the screen
capturing permission dialog on macOS, it should be limited to Windows.
Fixes: QTBUG-113556
Pick-to: 6.5
Change-Id: I197adb5fc177faebc0f2fcd28612e3daa0c22ed5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The tutorial is building an elaborate UI around a QMap. It doesn't use
structured data, and it doesn't use model/view (which the dedicated
addressbook example in itemviews does).
It's not a good way of building an application, and the individual APIs
for creating layouts, dialogs, or import/export are explained well
enough in other examples.
Pick-to: 6.5
Change-Id: Iffe47a0f6e04a933edb917c877ae845f50b74b4a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Q_ENUMS() is deprecated in favor of Q_ENUM().
Pick-to: 6.5
Task-number: QTBUG-113229
Change-Id: I29cc23c87b1d6e8eeb49dd1d3ddaf4ca7d2cf8c2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Rewrite the whole macro as a function and use QVersionNumber instead
of manual parsing to make it more modern and more readable.
Change-Id: I25498320ef6cd9f19be9267421e2727cd28cfd7c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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>
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>
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>
QTableWidgetItem uses additional enum flag ItemIsHeaderItem which has
the same numerical value as ItemFlag ItemNeverHasChildren.
This causes conflict since the user can set the latter flag using
the setFlags, while the ItemIsHeaderItem is only used internally
to mark header items.
Remove the additional flag and use boolean instead to fix the conflict.
Pick-to: 6.2 6.5 6.5.1
Fixes: QTBUG-113209
Change-Id: Icff549c7e452d9f84575a524361719204817274e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends ca15f650a1, after which scrolling
right to fill any gap might have resulted in overshooting to a negative
scrollOffset.
When we scroll right to fit the current tab, then we never want to end
up with a negative scroll, so clamp the result accordingly.
Augment test case accordingly. Since some styles align the tab bar in
the center, replace the calculation of the scroll offset with access to
the private data member (which inverts the sign when compared to the
calculated value).
Task-number: QTBUG-113140
Fixes: QTBUG-113376
Pick-to: 6.5 6.5.1
Change-Id: Ibdc6686b9dbd41b1ae3560e2227fa121d9b20e18
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
If there is an effect on the selected item we want to show it,
but if there is no item to highligh we just close the combo.
Fixes: QTBUG-113311
Pick-to: 6.5
Change-Id: I287af75d27e6f6ff969e4706e16cc8c4812129ea
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The native style may not match the program style and it
makes sense to give an option rather than forcing native style.
Before it could only be done with setting AA_DontUseNativeDialogs
on the app, but it is reasonable to use native file dialogs and
Qt styled messageboxes - and it is extremely cumbersome - especially
since messageboxes often can start save dialogs.
It can look a bit strange that these introduced options has just one
option (DontUseNativeDialog) and four functions, but this way it works
similar to QColorDialog, QFileDialog and QFontDialog.
[ChangeLog][QWidgets][QMessageBox] Added options functionality to
QMessagebox. The currently only option available is DontUseNativeDialog.
Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
These warnings slipped in during a time period where documentation
testing in the CI was disabled.
src/network/kernel/qhostinfo.cpp:254: (qdoc) warning: clang couldn't
find function when parsing \fn template<typename Functor>
int QHostInfo::lookupHost(const QString &name, Functor functor)
src/widgets/widgets/qcheckbox.cpp:102: (qdoc) warning: clang couldn't
find function when parsing
\fn void QCheckBox::stateChanged(Qt::CheckState state)
src/corelib/kernel/qcoreapplication.cpp:2769: (qdoc) warning: clang
couldn't find function when parsing
\fn template<typename Functor> void
QCoreApplication::requestPermission(
const QPermission &permission, Functor functor)
src/corelib/serialization/qxmlstream.cpp:3806: (qdoc) warning: clang
couldn't find function when parsing
\fn bool QXmlStreamAttributes::hasAttribute(
const QString &qualifiedName) const
src/corelib/text/qtliterals.qdoc:11: (qdoc) warning: Multiple topic
commands found in comment: \namespace and \headerfile.
Pick-to: 6.5
Change-Id: I38c605f358dbca1ef3e2bfe20a6424f7a4d44b4a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
On macOS, swiping with a single finger on the track pad (which Qt
identifies as a QInputDevice::DeviceType::TouchPad) results in a
TouchBegin event. For widgets that accept touch events (perhaps
implicitly because they want pan gestures, like QGraphicsView),
this results in a TouchBegin event to be delivered.
QApplication::notify will then check the widget's focus policy, and with
ClickFocus set, will set focus on the widget.
This is not what we want for a TouchBegin on a touch pad, so skip the
setting of the focus for that device type.
Pick-to: 6.5
Fixes: QTBUG-112922
Change-Id: Ie828793a784cc0e2fa47954bf5b396d6a44bd5e8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Changes code snippets that are visible in the docs.
Task-number: QTBUG-113116
Pick-to: 6.5
Change-Id: If743234bfe6947acf02307bf1144daad4fba5d73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
QTabBar lays out the tabs when the bar's size or content changes,
often lazily. This should not change the scroll offset of the tabbar,
which is controlled by the user, or at most when a tab needs to be made
visible (e.g. when it becomes the current tab).
Move the logic of updating the scoll offset into the makeVisible
function, so that the scroll is only adjusted to either leave no gap
between the last tab and the right edge of the widget of there is still
a scroll; or to reset it to 0 if there is enough space for the entire
tab bar. Since layoutTabs does show and hide the scroll buttons, we
cannot skip this when the buttons are invisible. However, the
normalizedScrollRect helper now needs to return the entire widget rect
if there are no visible scroll buttons.
Add a test case that simulates the previously broken behavior where
the scroll got unnecessarily reset to 0 when resizing.
Fixes: QTBUG-113140
Pick-to: 6.5
Change-Id: Ic19fbb82821ea09cc5e7646dcbce3aa7607909c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Rounding distances up can result in coordinates outside of
the clip rect. So stick to always round distances down when we multiply
a scaling.
Fixes: QTBUG-109640
Pick-to: 6.5
Change-Id: I784b7c90da9b6e7f5a925d4275eb67497616001d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
b1802a164b added handling for a parent to
become focus proxy of a child. The respective 'else if' branch didn't
check whether setFocusProxy() was called with a nullptr argument.
This patch adds the missing nullptr check.
It also adds functionality to tst_QWidget::tabOrderComboBox() to test
the removal of a focus proxy, as well as the complete removal of an
element from the focus chain.
Change-Id: I4cb865b9ac4497fc5e2595910738fb77694f5837
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
There seems to be a Value already defined in Integrity, and we `#undef`
it here: `text/qcssparser_p.h:39` to avoid symbol confusion. However,
this is not robust during the unity build where we might not necessary
end up with the preferred ordered of things.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ide37ab2035f0aa482a1d53d8e1511e0ab0109b3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When a parent became a new child's focus proxy in an existing focus
chain, the child was appended at the end of the chain.
That leads to broken tab order, e.g. with a QComboBox which became
editable after a focus chain has been set.
This patch captures the case and insertes the new child after its
parent in the focus chain.
A corresponding test function is added in tst_QWidget.
Fixes: QTBUG-111978
Pick-to: 6.5
Change-Id: I3a426c0560fa830b7b7ffead54f26dd0adef499f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When a tab was moved by dragging, the tab's rectangle was drawn empty,
without the tab text. When a tab was moved by animated snap back to
its original position, the tab text was already drawn on the original
position, while the rectangle was still moving due to animation.
Adds the enum value QStyleOptionTab::TabPosition::Moving
When this option is set, QCommonStyle draws the tab text at the
current position instead of the original home position of the tab.
The QMacStyle switches over the TabPosition enum. As a moving tab
is laid out like the last tab in the given orientation, the enum value
Moving is treated like End.
Fixes: QTBUG-112277
Change-Id: I42a2d9c269dadfe9819c12dbc69e3ae995a45b09
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is invalid and might assert in the model (e.g. in
QConcatenateTablesProxyModel)
Pick-to: 6.5 6.2
Change-Id: I6602d8b9eca83ef6cae760944a999d55244bb181
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QComboBoxPrivate::itemIcon() wasn't checking for an invalid index,
unlike QComboBoxPrivate::itemText().
QComboBoxPrivate::setCurrentIndex calls updateLineEditGeometry,
which calls QComboBox::itemIcon, even for an invalid combobox.
Pick-to: 6.5 6.2
Change-Id: I5e6105ae56836cd237a91a405d331f1424f49b37
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The makes sure that the scale factor used by the style
is identical to the scale factor used by Qt Gui, by for
instance taking scale factor rounding into account.
Task-id: QTBUG-109715
Change-Id: Ia0354a7ce0f51eb9fd5f2591ee6c4057291943f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The custom dialog-deleting lambda in QFileDialog::saveFileContent
is redundant
Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Depending on the corner that the size grip lives in, the style sheet
style rotates the painter before rendering the drawable. However, that
needs to be done around the center of the size grip, not around the
origin, as otherwise the image rotates out of the rect.
Use a static array to map the corner to the rotation value, and
translate/rotate/translate back only if there is a rotation.
Pick-to: 6.5
Fixes: QTBUG-112252
Change-Id: I59f69385bd6699ecc8db46390c5f7cc933574ce8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The previous patch for QTBUG-112019 could lead to an uneven length which
in results in an incorrect center. Fix it by making sure that the length
(and width) of the two rectangles are even so we always get a proper
center without fiddling around with float values. Also honor
PM_ButtonShiftHorizontal/Vertical now (was forgotten in the last patch).
Pick-to: 6.5
Fixes: QTBUG-112019
Fixes: QTBUG-112861
Change-Id: Ifc19b863c761ae545208b996ba60d1f33bceb2b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Otherwise, it could break the unity build.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b3ac51b8a9e8bb93a3b1a4d6717fa45099e91b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We sometimes use Objective-C++ code in files with a .cpp extension,
to avoid the churn of adding a foo_mac.mm file. Instead of manually
telling the compiler to build these files in Objective-C++ mode, we
use CMake's intended mechanism, which means genex constructs such as
$<$<COMPILE_LANGUAGE:OBJCXX> will work for these files as well.
Pick-to: 6.5 6.2
Change-Id: If295c3f34f6bee9f4d9f877f519c9c7770665fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
A QPointer is used as a guard for calling setChecked on a stale object.
The guard is not checked on accessibility updates.
This patch wraps the accessibility update in a guard check.
Fixes: QTBUG-112759
Pick-to: 6.5
Change-Id: Ida47c181b7968911c1805dc244b86347e7afe81b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Don't activate the mainwindow layout while it is being restored.
Otherwise we might end up in recursive calls to setGeometry.
Pick-to: 6.5
Fixes: QTBUG-111538
Change-Id: I4b6cba9e0abfbae479f71a65b1c4526d92dac081
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Don't append separator widgets at the end if their slot in the list is
still free.
Pick-to: 6.5
Task-number: QTBUG-111538
Change-Id: Id9ada2c083345cfd69633e506cceedc9ae6f2ae4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QMenu::exec opens a blocking loop, which is problematic for webassembly.
Replace with QMenu::popup, and reset the down-state of the button when
the menu is about to hide. QMenu emits aboutToHide immediately before
existing the event loop in the hideEvent override, so the timing is the
same.
Change-Id: Iccb418d10fcb25f6ad1f73f9cdce6ea6581bd73b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The "two widgets at a time" API to set the tab order is awkward and
easily misused (as the documentation explicitly explains). Add an inline
overload that takes an initializer_list, and call the existing function
for each consecutive pair of widgets in the list.
Add documentation with snippet, and a test.
Change-Id: I8e6f14a242866e3ee7cfb8ecade4697d6bdfb4d4
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
When QStyleFactory::create() is unable to find/create an override style
set with QT_STYLE_OVERRIDE or "-style", clear the styleOverride. Reason
for this is that Qt Quick Controls otherwise tries to use this invalid
style.
Task-number: QTBUG-100563
Pick-to: 6.5
Change-Id: I48fa6c211ce27d902e2eaf90c34cb5694ad7ecfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QHeaderView is using QStyleOptionHeaderV2 which should later be used in
the subelements drawings. But since the subelement rect must be
adjusted, a copy is done - sadly only to QStyleOptionHeader so we're
loosing the V2 information.
Therefore explicitly check if it's a V2 and copy it over to the correct
structure.
Pick-to: 6.5 6.2
Fixes: QTBUG-97571
Change-Id: I1482f118e2114cd6ef21c2a800785bd9910c1c5b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This is a bit of a cleanup, mainly around unity build, and a few other
minor things:
- I replaced the direct inclusion of sources files using
`set_source_files_properties`, and instead used
`NO_UNITY_BUILD_SOURCES` when possible. In most cases, they are being
excluded in their respective `qt_internal_extend_target` but sometimes
I had to make a new extension.
- In few cases, we had to manually exclude the NO_PCH files, so, I
instead passed them directly to the NO_PCH_SOURCES which also exclude
them from the unity build as well.
- Removed a few unnecessary ""
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I466576592c1d115a2da4d88672c1e4b9f995f2ed
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Render the Up/Down and Plus/Minus images for QSpinBox in high-dpi mode.
Found during investigation of QTBUG-112019.
Pick-to: 6.5
Task-number: QTBUG-112019
Change-Id: Ie531311b657180790b0e12a36663012a5f4da6be
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
QListView generates a move, when an item is dropped directly behind
itself. This causes unexpected behavior, e.g. item widgets getting
discarded.
This patch prevents a move from being generated in that case.
It adds an autotest to tst_QWidget, to verify item widgets and item
data do not get discarded in case of a no-op drag&drop.
Fixes: QTBUG-100128
Pick-to: 6.5 6.2
Change-Id: I02a755320a7b71dad218293c9c94c88da6507423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>