summaryrefslogtreecommitdiff
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Detect menu bar roles for untranslated menu titles as wellTor Arne Vestbø2023-05-161-7/+9
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove the "classwizard" exampleVolker Hilsheimer2023-05-161-21/+13
| | | | | | | | | | | | | | 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>
* Convert "extension" dialog example into snippetsVolker Hilsheimer2023-05-163-6/+37
| | | | | | | Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Don't grab QWhatsThis background on WindowsOliver Wolff2023-05-161-17/+0
| | | | | | | | | | | | | The workaround also is no longer needed on Windows so it can be removed completely. This patch amends 6a28b391f71d8626c1793aa3bf732dea10519653. 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>
* Revamp the shapedclock exampleVolker Hilsheimer2023-05-161-4/+12
| | | | | | | | | | | | | | | | 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>
* Don't grab QWhatsThis background on non-Windows platformsTor Arne Vestbø2023-05-151-0/+9
| | | | | | | | | | | | | 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>
* Move the addressbook tutorial into manual testsVolker Hilsheimer2023-05-1522-0/+0
| | | | | | | | | | | | | | 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>
* Doc: Replace mentions of deprecated macroTopi Reinio2023-05-151-2/+2
| | | | | | | | | 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>
* Fix the QT_REQUIRE_VERSION macroYuhang Zhao2023-05-151-15/+23
| | | | | | | | | | 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>
* QStyleSheetStyle: avoid #define ceil()Marc Mutz2023-05-111-4/+1
| | | | | | | | | | | | | 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>
* QStyleSheetStyle: fix unity-build with chunk-size 13Marc Mutz2023-05-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The definition of ceil() as a function-style preprocessor macro appears to clash with the definiton of QFixed::ceil(), included later. That's an educated guess, though, because the error is completely different: qstylesheetstyle.cpp:141:19: error: expected unqualified-id before ‘int’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ^~~ qstylesheetstyle.cpp:141:19: note: in definition of macro ‘ceil’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ^~~ qstylesheetstyle.cpp:141:19: error: expected ‘)’ before ‘int’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ~^~~ qstylesheetstyle.cpp:141:19: note: in definition of macro ‘ceil’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ^~~ qstylesheetstyle.cpp:141:19: error: expected ‘)’ before ‘int’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ~ ^~~ qstylesheetstyle.cpp:141:19: note: in definition of macro ‘ceil’ 141 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | ^~~ Fix by #undef'ing at the end of the TU. This is a minimal fix, suitable for backporting to older branches. A more modern fix will be forthcoming as a follow-up patch. Pick-to: 6.5 6.2 Change-Id: I8c1b6c7834e55b2bf28044a78ddf5bb544b23c65 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Don't add scrollbar container as a11y child if scroll bar is re-parentedTor Arne Vestbø2023-05-101-2/+8
| | | | | | | | | | | | | | | 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>
* Clarify module changes in Qt6Jaishree Vyas2023-05-091-1/+1
| | | | | | | | | Changed Briefs for better understanding Fixes: QTBUG-109324 Pick-to: 6.5 Change-Id: I15b0c0dc12b1bf96626fb8ea4ad16d04b2b118ca Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QWizard: Win: fix wrong frame size and title bar sizeYuhang Zhao2023-05-061-1/+1
| | | | | | | | | | | | | | 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>
* Use boolean to indicate QTableWidgetItem is header itemAntti Määttä2023-05-052-10/+7
| | | | | | | | | | | | | | | 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>
* QTabBar: don't overshoot when scrolling rightVolker Hilsheimer2023-05-041-3/+3
| | | | | | | | | | | | | | | | | | | | Amends ca15f650a1a914bb9a41131109c46c4e52c5ebb1, 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>
* Fix hiding in QComboBox when there is no selectionVolker Hilsheimer2023-05-041-19/+18
| | | | | | | | | | | 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>
* Allow disable native messagebox dialogThorbjørn Lund Martsum2023-05-022-2/+112
| | | | | | | | | | | | | | | | | | | | | | 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>
* Doc: Fix documentation warningsTopi Reinio2023-04-291-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Don't set focus when moving the cursor with a touch padVolker Hilsheimer2023-04-281-1/+2
| | | | | | | | | | | | | | | | | | | 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>
* Doc: Use qt_add_executable() not add_executable() in snippetsLeena Miettinen2023-04-261-1/+1
| | | | | | | | | 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: don't scroll when laying out the tabsVolker Hilsheimer2023-04-261-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Improve style drawing under DPR scaling furtherDavid Schulz2023-04-251-8/+8
| | | | | | | | | | | 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>
* Add missing nullptr check in QWidget::setFocusProxyAxel Spoerl2023-04-251-1/+1
| | | | | | | | | | | | | | b1802a164b8682ed9e8956a5a19a90ade65c25d0 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>
* Use QCss:: namespace when accessing Value on IntegrityAmir Masoud Abdol2023-04-232-31/+31
| | | | | | | | | | | | | 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>
* Handle parent being a child's focus procy in QWidget::setFocusProxyAxel Spoerl2023-04-221-0/+24
| | | | | | | | | | | | | | | | | 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>
* QTabBar: draw text within moving tabAxel Spoerl2023-04-204-11/+25
| | | | | | | | | | | | | | | | | | | | 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>
* QWidgetTextControl: emit cursorPositionChanged() when select allLiang Qi2023-04-201-0/+3
| | | | | | | | Fixes: QTBUG-91643 Pick-to: 6.5 Change-Id: I31745a3106321da0be4074a33768da8b84a8ae3f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWidgetTextControl: ignore invalid input method eventLiang Qi2023-04-191-0/+5
| | | | | | | | | | to avoid update the text document. Fixes: QTBUG-112953 Pick-to: 6.5 6.2 5.15 Change-Id: Ib72de57133314e4eb38a15758b8318d901196d75 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
* QComboBox: don't call index(-1, 0) on the underlying modelDavid Faure2023-04-191-1/+1
| | | | | | | | | 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>
* QComboBox: don't call data(invalid index) on the underlying modelDavid Faure2023-04-181-0/+2
| | | | | | | | | | | 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>
* Use QHighDpiScaling when determining scale factorMorten Sørvig2023-04-181-7/+4
| | | | | | | | | | 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>
* FileDialog: Use well-known DeleteOnClose instead of custom lambdaMikolaj Boc2023-04-181-12/+2
| | | | | | | | | 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>
* QStyleSheet: rotate QSizeGrip image around centerVolker Hilsheimer2023-04-181-6/+5
| | | | | | | | | | | | | | | 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>
* Remove unused documentation code snippetsFriedemann Kleint2023-04-178-247/+0
| | | | | | | | | | | | | | | | | | | Modules: - Core - Gui - Widgets - Open(Widgets) - PrintSupport - Sql - Network - Concurrent - Testlib Pick-to: 6.5 Change-Id: I63e58c01bec4bd162486020f0085227fdaa83b18 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CommonStyle/QSpinBox: fix rendering up/down symbols in high-dpi modeChristian Ehrlicher2023-04-151-16/+15
| | | | | | | | | | | | | | 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>
* Add [[maybe_unused]] attribute to an unused variableAmir Masoud Abdol2023-04-141-1/+4
| | | | | | | | | 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>
* Use LANGUAGE OBJCXX rather than COMPILE_FLAGS "-x objective-c++"Tor Arne Vestbø2023-04-131-1/+1
| | | | | | | | | | | | | 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>
* QAbstractButton::setChecked() - don't update accessibility if staleAxel Spoerl2023-04-131-5/+6
| | | | | | | | | | | | 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>
* QMainWindow: fix potential crash when restoring tab bar stateColin Snover2023-04-112-1/+5
| | | | | | | | | | 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>
* QMainWindow: fix potential assert when restoring dock widget stateColin Snover2023-04-111-2/+13
| | | | | | | | | | 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>
* QPushButton: use QMenu::popup instead of exec to show menuVolker Hilsheimer2023-04-111-7/+4
| | | | | | | | | | | | 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>
* QWidget: add overload to set tab order as a list of widgetsVolker Hilsheimer2023-04-113-0/+42
| | | | | | | | | | | | | 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>
* Clear invalid QApplication styleOverrideKaj Grönholm2023-04-061-0/+2
| | | | | | | | | | | | 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>
* Fix some extra semicolon warningsJoni Poikelin2023-04-051-2/+4
| | | | | | | Fixes: QTBUG-112648 Pick-to: 6.5 Change-Id: I71446459c7fd6018ecb4deb60a7b9b412c0972ba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Widgets/Styles: pass correct style option struct to subelementsChristian Ehrlicher2023-04-043-2/+14
| | | | | | | | | | | | | | | 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>
* Use Qt CMake APIs to exclude files from Unity BuildAmir Masoud Abdol2023-04-031-4/+4
| | | | | | | | | | | | | | | | | | | | 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>
* QComboBox: Disable items marked as disabled in native popupsSebastian Beckmann2023-03-311-0/+2
| | | | | | | Fixes: QTBUG-56064 Pick-to: 6.5 6.2 5.15 Change-Id: I00a17a19b4c14c874e16ec863e794218f0570346 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CommonStyle/QSpinBox: fix rendering up/down symbols in high-dpi modeChristian Ehrlicher2023-03-311-9/+44
| | | | | | | | | | 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: No-op, when a list item is dropped directly behind itselfAxel Spoerl2023-03-311-1/+2
| | | | | | | | | | | | | | | | | 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>