summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* QWidgetTextControl: ignore GroupSwitchModifier for BackSpaceIgor Kushnir2021-05-311-1/+1
| | | | | | | | | | | | | | | | | | "The keypad and group switch modifier should not make a difference" when matches a QKeySequence, see QKeyEvent::matches() implementation. Qt(xcb) treats AltGr as GroupSwitchModifier in hard code, which should come from Qt 4 era. Nowadays, with different xkb setups, Mode_switch could be different keys. When it is AltGr, Qt will get AltGr as GroupSwitchModifier. When it is not AltGr, another key like Less/Greaterkey(details in bug report), GroupSwitchModifier will not be set in the case. Fixes: QTBUG-36565 Change-Id: I7251963d41a70d61800d25e43d5012b859693f69 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 4b0b87b5c2173ee70eacfdd7cea08aea8a5164c8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Do not remove non-widget items when removeWidget() called with nullptrPiotr Srebrny2021-05-111-0/+5
| | | | | | | | | | | | child->widget() returns null if the layout item is not a widget. Thus, calling removeWidget(nullptr) will remove all non-widget items such as layouts or strechers. Change-Id: I772c1158d0f7e8e2850b6e571b0405a2896f09b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 867c0b8d8a53974074b1fff5b132f3ae9f150066) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Check scrollbar visibility when computing QListView marginsChen Bin2021-05-111-1/+1
| | | | | | | | | | | | | | | | | | When the listview setWordWrap is true and ScrollBarPolicy is ScrollBarAsNeeded, if the text needs a newline display and the vbar is not shown, the width of the item was subtracted from the width of the scrollbar. In most cases, the listview needs to reserve the size of the scrollbar. But if the flow is TopToBottom and the vertical scrollbar is not visible, the width of the vertical scrollbar cannot be reserved. Fixes: QTBUG-92366 Change-Id: I73cce691099a253d409019dbb3fe9a16e1830bb1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit aeef92c3c33e4ebcb7e5d8dd955020f4f4600e84) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QTreeModel calling beginRemoveRows twiceLuca Beldi2021-04-261-11/+7
| | | | | | | | | | | | | | For items that are children of other items, removeRows calls beginRemoveRows directly and then once again inside takeChild() The signal blocker that dates back to the monolitic import from Nokia prevents the model from emitting extra signals but the persistent indexes are corrupted nonetheless. Fixes: QTBUG-90030 Change-Id: I5bc4b2598bf13247683b113faeec22471f1f04a4 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 6ec3fa2842b5c4714dc9a3953b2721ef70dd957b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Re-layout QProgressDialog when setting the cancel buttonQiang Li2021-04-191-0/+2
| | | | | | | | | | | | | | | Setting a cancel button on QProgressDialog more than once caused the layout to be invalid. The layout was only applied when the dialog resizes or the style changes, but not when a new cancel button is set. The solution is to update the layout() before showing the dialog when adopting new child widgets. Fixes: QTBUG-19983 Change-Id: Id8fb1ac56e94a9bd97d4559a2e8d4835856fd7d0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 777053cfff40570282e861527e0e52e22a359629) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Correct item indent in checkable menus in stylesheet styleEirik Aavitsland2021-04-141-2/+2
| | | | | | | | | | | Not only the checkable items need to be indented, but all items in the same menu, so that they line up. Fixes: QTBUG-90242 Change-Id: I559005f753b5cd19eaeeeb6658178d62de93b4ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 96e9c8cc8aae718942f79ac98e775f06501b0e25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Only scroll QMenu when there is a valid active actionZhang Hao2021-04-141-1/+1
| | | | | | | | | | | | | | | When changing the active action via QMenu::setActiveAction the menu will scroll to the active action, but we were scrolling the menu also when the active action was null, resulting in the menu scrolling back to the top. We fix this by guarding the call to scrollMenu. Fixes: QTBUG-92096 Change-Id: I998f99ddacec32640834d59a907d569fdda458f0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 94e03e506a0e953f72c21c4ca827174a3d1f0d73) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix build without features.menuTasuku Suzuki2021-04-131-7/+7
| | | | | | | Change-Id: If7947839b8da5abc8ee84aace60cc7de7a053e04 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d84bf703b505db470e5c7916e3cd630c3e456cef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix read-only pseudo-state in QPlainTextEdit stylesheetEirik Aavitsland2021-04-091-1/+7
| | | | | | | | | | | Was implemented for the other text edit widgets, but not for QPlainTextEdit. Fixes: QTBUG-92490 Change-Id: Idd2a1b5c743fc030d3f2d4dd24e98f806b58f4d9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f3a042c5ab998c0d283017f3569bb72c392580b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix incorrectly-drawn menu indicator for QPushButton on macOSDoris Verria2021-04-081-1/+2
| | | | | | | | | | | | | | Because the QPushButton's bevel rect is smaller than its actual widget's rect, custom styled menu indicators are drawn outside the bevel frame on macOS. Fix this by drawing the menu indicator inside the bevel's rect instead of the widget's rect. Fixes: QTBUG-90250 Change-Id: Ie63d68d8f564a4a640bdb8e7564f028784faab97 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0eb0fc87014b8de06473055bd2298b2423d480f6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix label margins for pulldowns with custom styled menu indicator on macOSDoris Verria2021-04-071-0/+7
| | | | | | | | | | | | | Don't apply the QMacStyle's pulldownButton titlemargins to the QPushButton's contents rect if the button has a custom styled menu indicator. This causes the button's text/icon to be misaligned. Fixes: QTBUG-86134 Change-Id: I6ef95d51071c1d79f1cc07425a46958f50091b7e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 37f9f2e7afb2539ead355f1115e10835c2df9f92) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Document change to QAbstractItemView::viewOptions in porting guideVolker Hilsheimer2021-04-041-0/+8
| | | | | | | | | | | | We couldn't deprecate and add the replacement in 5.15, so list it explicitly here. Amends c501e09efacb8a60deb41f85f3402f6f4c041d95. Change-Id: I174a7b6214cd8b9579b029ebf57e4d5b2e28e574 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit a395372ccf7b6ce5575aeec627b403c4f9af9647) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix invalid pointer return with QGridLayout::itemAt(-1)Zhang Yu2021-03-221-3/+3
| | | | | | | | | | | QGridLayout::takeAt() and QLayoutItem *itemAt() only check the upper bound. If the index < 0, these function will return invalid pointer. Fixes: QTBUG-91261 Change-Id: Idfb9fb6228b9707f817353b04974da16205a835c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit c47bb4478a4c3a29c0505d7d89755f40601b326f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Consistently check for nullptr in QGraphicsTextItem::inputMethodQueryVolker Hilsheimer2021-03-191-8/+10
| | | | | | | | | | | | | If dd->control is nullptr, then it's nullptr all the way, so don't dereference it in the calls to dd->controlOffset. Fixes static analyzer warning 9c33d9bc9b8cf438dccb63aa52afcbe0. Change-Id: I7a61b6438422373678d4fcb66255b750c550724d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 7edf0fbb9e8cca2e2f2695a1b5dc7a0a143bc211) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Change section titles that cause bad linksPaul Wicking2021-03-121-3/+3
| | | | | | | | | | | | Section titles are valid targets for QDoc's autolinker. When they are identical to other valid link targets, such as for example a class, these sections may cause invalid links. Fixes: QTBUG-91141 Change-Id: Ie9a6258d2bf83932335976d8c0b5fc59f2028ae5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5fa8f5df7bb722c5b7451229f5eecd13bd13326f) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Revert "QPushButton: fix support of style sheet rule for text alignment"Volker Hilsheimer2021-03-111-4/+2
| | | | | | | | | | | | | | | | | This reverts commit 6269438af95bbd988ead08829fa3bc9dc25891e8, and adds a test. This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The code already interprets the textAlignment values from the rule, also if no icon is set. Adding the same, or some default textAlignment to the text flags if there is no icon doesn't work. Fixes: QTBUG-91735 Task-number: QTBUG-86857 Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 674747bac1c8b57d4940de2ee68b6b562dfcad61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the crashes when animated QTreeWidgetItems are hiddenQiang Li2021-03-081-1/+3
| | | | | | | | | | | | | | | | | | | QTreeView's drawTree implementation performs lazy layouting when calling itemDecorationAt. If animations are enabled, this can change the list of items, and invalidate the copy made earlier. Don't copy the list of items, use a reference instead so that code iterating over the items later operates on valid data. Add an assert in the private itemHeight method, it must not be called with an index that is out of bounds. Fixes: QTBUG-42469 Change-Id: Ifdb782881447912e00baffd1c407de10a1d8d0d4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f140ef04a0c54c2c8a699db33433b8d7235d137c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLineEdit: Fix editingFinished() not being emitted when pressing the clear ↵Dong Rui2021-02-231-1/+1
| | | | | | | | | | | | | | | button When pressing the clear button, the editingFinished() signal was not received when focussing out. Call _q_textEdited(QString()) when pressing the clear button. Fixes: QTBUG-83295 Change-Id: Ie4bc6d9a2f27f89163c05c4c15175540c7631a30 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit c5904cb96aed3b171c543a2cf0bed8f8ac5f95c4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMdiSubWindow: Set correct ControlLabel sizeMorten Johan Sørvig2021-02-191-2/+2
| | | | | | | | | | | The label pixmap may be a high-dpi pixmap. Set the ControlLabel fixed size to be the pixmap device independent size. Fixes: QTBUG-87871 Change-Id: Ib836e322d25599cb5e79011ea597e32ee1f8d093 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 33ddacdd24523acbdafcda0f520dd2d73c879cfb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* fix windows build when both whatsthis and tooltip are disabledNick Shaforostov2021-02-181-1/+5
| | | | | | | | | | msvc produces warning there and it is treated as error Change-Id: Ic386df615df591fa1563b147342d670bbec771d2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0ad434c2e9c81ae319840b1bc563c9f04efac524) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPlainTextEdit: adjust scroll bars when showing upWang Chuan2021-02-091-0/+1
| | | | | | | | | | | | The text of QPlainTextEdit might change when it is invisible, so an adjustment of scroll bars is needed when the QPlainTextEdit showing up, otherwise the range of scroll bars might be incorrect. Fixes: QTBUG-77937 Change-Id: I45c686c7e09ca7b2944c36122e9157de0ec4f0e0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 13ae47d98057c2ddca8c865b845973d7e4c8dd8b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows: Fix flicker when resizing translucent windows with QSizeGripFriedemann Kleint2021-02-011-3/+15
| | | | | | | | | | | Do not use the startSystemResize() functionality in that case. Fixes: QTBUG-90628 Fixes: QTBUG-73011 Change-Id: I8d4843c1715c7f75f9b41c904e6f1aebbf0e02d7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 90dc13ae5facf97a2760edf054d2e002d0eae5d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLineEdit Cursor show white areaZhang Hao2021-01-291-2/+4
| | | | | | | | | | | | | fix QLineEdit Cursor Rect and InputMask area overlapping, the cursor rect area is white. when inputMask is set,we don't need draw cursor. Fixes: QTBUG-89578 Change-Id: Ibec7f8f1f7331a12438fd821c2002903260da10a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 795ea19ca0a7e484793655b35f19de8dbc88e987) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix that the placeholdertext of QCombobox is not drawnChunLin Wang2021-01-271-2/+4
| | | | | | | | | | If the current index is invalid,a placeholdertext will be displayed. Fixes: QTBUG-90595 Change-Id: Id4c6b9c959242b96ee0944b8fc3131a9a2fdcccc Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 6da6b6da4494439dc34e92fee7d69b5ad48a783d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix populating selection clipboard with keyboardVolodymyr Samokhatko2021-01-265-6/+23
| | | | | | | | Task-number: QTBUG-59879 Change-Id: I6948919fc90995c60a34b5bd6b4a225c1a59fd9b Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 976f28e7bb7cddb11459600f293868abcf7da948) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QComboBox/Fusion style: elide text when it's too longChristian Ehrlicher2021-01-231-1/+2
| | | | | | | | | | | The fusion style did not elide a very long text in a QComboBox as it's done in other styles / non-popup mode. Fixes: QTBUG-86632 Change-Id: I356a61809220d41717a9039d2b33dd706d034941 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1a9095e1fa4bb5d74b91d1661d55893d0e8620e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QStyle::proxy() always return the leaf proxySergio Martins2021-01-201-2/+4
| | | | | | | | | | | | | | For example: fusion -> proxy1 -> proxy2 Now returns proxy2. Fixes: QTBUG-85556 Change-Id: I2a60329f948b59ef7d0752d273bee3854a200547 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 61c3f3539c3d2d7dc867c3fef0270a2f5c9ed376) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ItemViews: Don't remove items on internal moveChristian Ehrlicher2021-01-192-4/+8
| | | | | | | | | | | | | | | When an itemview only allows internal moving of items it can happen that the target accepts the drag'n'drop operation since it's out of the control of Qt (e.g. Recycle Bin or an other application). Due to the nature of a move, the original item is deleted. Therefore check if the internal move target is the same as the source and don't delete it otherwse. Fixes: QTBUG-86020 Change-Id: I69de4b8d76d1b0f57338b402aee87580226cd6cb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 12d8bb0709bf7982061cb0c3e608e4a581892e35) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix small typo in the QMdiArea documentationOliver Eftevaag2021-01-181-1/+1
| | | | | | | | | | Added missing whitespace character in the documentation for QMdiArea, in the 'detailed explanation' section. Change-Id: I6be1d664bc15e3e461c5fc3d8f82311cc6ea60ea Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 3cb2b5bfe3e3c84dcd4c1a04c8c981dbaf85f0a4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Mark QFileDialog::DontConfirmOverwrite as unsupportedMorten Johan Sørvig2021-01-151-0/+3
| | | | | | | | | | | | | | | | | | The native NSSavePanel does not have an option corresponding to DontConfirmOverwrite. Qt has a workaround where the save-file-name is temporarily given a prefix in order do bypass the overwrite check, however this has stopped working on recent versions of macOS. (Confirmed on macOS 11) Users who want to use DontConfirmOverwrite should use Qt’s file dialog instead. Fixes: QTBUG-39791 Change-Id: Id3b9e6de72c2afc9526c96f1d9fdbce78db92aeb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 9cd3ff2bdea0d5a009a8284288bbbdaaaec817be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix setting active window as application's focus widgetSona Kurazyan2021-01-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | | When setting the application's focus widget we search for the next child widget that can hold the focus and call its setFocus() method, which also updates focus widgets of all its parent wigets. In case if the focus widget is the active window itself, we only set it as the application's focus widget, but we don't update the focus widget of the active window itself. Because of this the focusWidget() method always results nullptr for the active window. This prevents from setting the focus back to active window after the focus has changed (for example after a context menu is closed, as in the bugreport). Transfer the focus to active window by calling the setFocus() method, as it is done in case of transferring the focus to any other widget. Fixes: QTBUG-85846 Change-Id: I91ebf182fd5bb7d451a1186e2f3e38c8d48acc4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 154573929a76d9051920756b19ed033c4b2ac649) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTabBar/Windows: Fix close button icons being too small on high-res screensFriedemann Kleint2021-01-156-11/+32
| | | | | | | | | | Add 32x32 versions. Move the icon creation to a helper function. Fixes: QTBUG-88230 Change-Id: I6dda2084e0122234eacea17ac191a19f6855f466 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit f3251bcb878d655e5f897335ec6bc6dbf69323e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the tips still show when cursor move to another actionQiang Li2021-01-151-0/+2
| | | | | | | | | | | | In this case, the previous action's tip is still displayed when the cursor moves from one action with tip to another action without tip. Fixes: QTBUG-89082 Change-Id: I0a00595dc3d716725678487be9cbb363c4d3b392 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3f3d5e6716d9130776b3613ccbd5595de7d4af8d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QApplication::font returns the font unstable according to the objectChunLin Wang2021-01-151-7/+11
| | | | | | | | | | If a default font was not registered for the widget's class, it returns the default font of its nearest registered superclass. Fixes: QTBUG-89910 Change-Id: I6e6b2c6a0044462f84db9f76a03be0c6cfaaae8e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit dafd26acbe7b08f5ddfe60432fe0e49422ac085c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Widgets: fix setTabOrder for QAbstractSpinBox-like widgetsIvan Solovev2021-01-141-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setTabOrder was not considering the case, when a child widget has its focus proxy set to its parent widget. This happens, for example, for the QLineEdit that is nested inside the QAbstractSpinBox. For such cases the lastFocusChild was calculated incorrectly, and, as a result, such child widgets were not correctly positioned in the focus chain. This could lead to an error while backtabbing. Here is a brief example. Suppose we have 3 widgets arranged like this: auto spinBoxOne = new QDoubleSpinBox; auto spinBoxTwo = new QDoubleSpinBox; auto button = new QPushButton; Then the default widget focus order is: - spinBoxOne - lineedit (from spinBoxOne) - spinBoxTwo - lineedit (from spinBoxTwo) - button Before this commit setting the explicit tab order changed the focus order in the following way: QWidget::setTabOrder(spinBoxOne, spinBoxTwo); QWidget::setTabOrder(spinBoxTwo, button); - spinBoxOne - spinBoxTwo - button - lineedit (from spinBoxOne) - lineedit (from spinBoxTwo) In this case, backtabbing from spinBoxOne actually leads us to lineedit (from spinBoxTwo), which refers to spinBoxTwo. And so we're stuck in a loop. This commit fixes the issue by handling such special case, and preserving correct focus order. Note: the actual unit-test in this patch uses QLineEdit instead of QPushButton, because one can't tab to buttons on macOS by default. However the general idea is the same. Fixes: QTBUG-81097 Change-Id: I5d16da7733a4d63f809cab28b8ca9e116b87cffa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 00505ed2b57d0a6911c8274af2bff883a93f583a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix read-only pseudo-state in QTextEdit/Browser stylesheetEirik Aavitsland2021-01-131-0/+13
| | | | | | | | | | Was implemented for QLineEdit but not QTextEdit. Fixes: QTBUG-83056 Change-Id: I1e67ad0f1c230a062a1e12e8bc0b209c5289dc32 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2054f451b1fc182fb3f53976b8f1e0026cfcd89a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QComboBox: fix select all columns in the viewChristian Ehrlicher2021-01-131-2/+4
| | | | | | | | | | | | | | | When the QComboBox gets a custom view with multiple columns, only the first one is selected even the selection mode of the view is SelectRows. The selection changes afterwards properly honor the mode though. Therefore check for the selection mode and call setCurrentIndex() with the appropriate flags. Fixes: QTBUG-86776 Change-Id: Ieba7b9e009358e7b6e802b7847640161ec776c64 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b3b28faf2627aad3a0c47fb4c7c711e0d19984aa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Set the PlaceholderText color in the palette from the stylesheet as wellAndy Shaw2021-01-121-0/+1
| | | | | | | | | | | The color should be used across the board, so the PlaceholderText color should also be respecting the one passed for Text and so on. Fixes: QTBUG-89815 Change-Id: I2accb3db35488f95a1c8ebacf2316a08ee416fac Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit bb00b63dee85bfe77bd721dd962c768e62c1b1e3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip already closing widgets when checking whether application can quitTor Arne Vestbø2021-01-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | QApplication tries to close all windows on quit using closeAllWindows, but closeAllWindows skips windows that are already closing. This can happen when calling quit() from a close event for example. QApplication then tries to verify that all windows have been closed, and that logic should skip the same kind of windows as closeAllWindows does. The fact that these two logics diverge was identified earlier in 5af73cd9db52, but aligning them required further work. As that commit notes, the right fix to align them is building on top of tryCloseAllWidgetWindows(), which already returns true/false based on whether it could close all windows or not. But, unlike the existing logic in QApplication::event(), it doesn't skip Popups or Dialogs, so that discrepancy needs further research. Fixes: QTBUG-89580 Change-Id: I87bff56f2eb8a539f1c859c957f5f239dc1eb93d Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e7370d0583ea8a50b0d5c15bb2b1afee2efc6a7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TableView: Trigger the resizing of editors resizing a row/columnAndy Shaw2021-01-051-0/+4
| | | | | | | | | | | | If there is an editor in the table then this needs to be updated as the resize happens, otherwise it will not adapt to the new size correctly and can appear drawn over other cells. Fixes: QTBUG-85484 Change-Id: I918c37f1ee1b0614c03c6b38f95f0f8b35a571f2 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit 9d36ee1904114a91a5c08b18ccfb72cd1d33d58f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTreeWidgetItem: fix documentation error for childIndicatorPolicy()Christian Ehrlicher2021-01-051-1/+1
| | | | | | | | | | | The default value is 'DontShowIndicatorWhenChildless' and not 'ShowForChildren'. Fixes: QTBUG-83648 Change-Id: I5d4dd9f3f58bcac09ed38d8ae451e3b771695ce7 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit 39773571202194cafd4992e4fe7c4a33733b53af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractItemView: fix selectionCommand() with no eventChristian Ehrlicher2021-01-051-3/+3
| | | | | | | | | | | | | QAbstractItemView::selectionCommand() returned the wrong SelectionFlags when no event is given since c4366ff0183a9a4a5c6eff0312b713e9c5eb97ea. Therefore re-add the call to QGuiApplication::keyboardModifiers() when no event is given and add a unittest for them so it's not removed again. Fixes: QTBUG-89711 Change-Id: I107357df08c4ff1b1a14d49523401c5e7b428f56 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 672d2ea8f414fa5f79f1801d965533b705831921) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Simplify and fix issues with QMenuPrivate::moveWidgetToPlatformItemTor Arne Vestbø2021-01-042-49/+35
| | | | | | | | | | | | | | | | | | View embedding when QWidget is involved is a bit finicky. This change breaks down the steps needed to embed it into an NSMenu item, and simplifies the process by not relying on a container widget. The main issue is that QCocoaWindow::recreateWindowIfNeeded() will potentially create an NSWindow for the embedded view, resulting in a stray view. To prevent this we set the Qt::SubWindow flag on the window, but QWidget tends to reset this flag when the widget doesn't have a parent, so we need to be careful about which order we do the setup. Change-Id: I505f7c0a2d8e4350511fdb01a5e9b9c623a40a41 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit c30d05e794e49d69cbc981ae2ff21e5713c5a81f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractButton: don't access nullptr in queryButtonList()Christian Ehrlicher2021-01-011-1/+3
| | | | | | | | | | | | | When a button has no parent, QAbstractButtonPrivate::queryButtonList() unconditionally accessed parent which results in a nullptr access. Did not crash because qt_qFindChildren_helper checks for nullptr and therefore could only be found with a sanitizer. Fixes: QTBUG-83865 Change-Id: I591e546e96acba50770935b9c3baaf08b09b833d Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit f0818f6ed8a616dcc94785637039ac21468ef311) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStylesheetStyle: fix push button label alignmentChristian Ehrlicher2020-12-241-1/+1
| | | | | | | | | | | | Due to a copy'n'paste error in 01ec11507d7ef3de09bad9d1ef8e6d4a3d6c4428 the valign was not properly determined for text-align bottom. Fixes: QTBUG-89366 Change-Id: I081e1b24bba0edd9dd3754599a111c1658b18746 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 41e665a452166259b5cad64994de3298751eb7f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QListView: don't crash when an empty container is passed to itemsRect()Christian Ehrlicher2020-12-221-7/+3
| | | | | | | | | | | QIconModeViewBase::itemsRect() is crashing with Qt6 when an empty container is passed. Fixes: QTBUG-89434 Change-Id: I324f1a34b62e67c7bbd3fe33227f4174df7d3d37 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 6fbcfd9164ae23b221ebce7fc3185505a8a1fb6e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QPushButton on macOS use QFocusFrame to fix alignment problemsDoris Verria2020-12-212-1/+8
| | | | | | | | | | | | | | | Alignment problems occur for pushbuttons because they appear smaller then their actual widget geometry, which is used for their alignment in layouts. To fix, shift the pushbutton's rect to the left, adjust SE_PushButtonLayoutItem accordingly and use QFocusFrame to render the focus frame ring outside the widget's paintable area. Fixes: QTBUG-89133 Fixes: QTBUG-81452 Change-Id: Iee885a4fb3674d966e5ff3b5c04a0845521b2d72 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c6379e34993370e7e2208b51be384b738ce35817) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't show focus rect for QCommandLinkButtonDoris Verria2020-12-111-0/+1
| | | | | | | | | | | | Since QPushButton sets WA_MacShowFocusRect attribute upon init, this will be set for QCommandLinkButton too. However, we do not want to draw the Mac focus frame for QCommandLink buttons so remove this attribute for them. Change-Id: Ida7a437a54be078caaebc2c0744243d50e14a87f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f8f955151a6a218e1d274663c7c309b8eb6ca92a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Override initStyleOption() for QCommandLinkButtonDoris Verria2020-12-112-0/+7
| | | | | | | | | | | | | | In QPushButton::initStyleOption() there is no style option feature set to distinguish QCommandLinkButtons. The QStyleOptionButton::CommandLink Button feature is only set during the paintEvent, but in some cases we need to check for this feature before painting. To fix, override initStyleOption for QCommandLinkButton and set the fea ture there. Change-Id: I8831a6be7da642dcf8830812d99681213e7515dc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d3ee976acab59019fdd781691f29e6f12e4dedc8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Disable WA_QuitOnClose on menu item widget containerTor Arne Vestbø2020-12-101-0/+1
| | | | | | | | | | Otherwise it will prevent quitting of the application when the last window is closed, on account of (seemingly) being a top level window. Change-Id: Ib79615dd1e9394c96d39c8f9851005b4c073c165 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 6198ba217f3a9b31d44375b26f3635f15fc01b3d) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>