summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Make dockwidget title bar buttons show againVolker Hilsheimer2021-06-151-4/+6
| | | | | | | | | | | Amends f61304fc77a622170ef3bbcbcb37c5a90c6f87ea, which renamed the files but didn't adjust the code. Task-number: QTBUG-38776 Change-Id: If54dd986975dd28f147a98628317b1369d0c690f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 22571c21c9be10d9ada756c598f519f74273579a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix misplacement of placeholder text in QLineEdit with RTL contentFan RuiJie2021-06-112-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | The placeholder text was rendered in the wrong position after clicking on the clear button in a QLineEdit with right-to-left content. The button was still taking up space while it was fading out, so the first paintEvent rendered the placeholder with space reserved for the clear button. Once the button gets hidden, no new update was issued, so garbage was left behind. Fix this by not giving a fading-out clear button any margin space. The result of this is that the placeholder text is visible underneath the fading-out clear button. This is preferable to the placeholder text being first rendered next to the fading-out clear button, and then popping to the edge when the clear button is hidden (which would have been the result of issuing a complete update for the line edit at the end of the fade-out animation). Fixes: QTBUG-93742 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: Id0429362a60bba6839aa02068b00edb15e3ab8ab Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit dc794f7622bc00f7ca50fab65d6965695d6d2972) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: close visible gap between tab bar base line and tabsVolker Hilsheimer2021-06-111-1/+1
| | | | | | | | | | | | | | | | | Dock widgets enable the QTabBar::drawBase property, but the clip region left a gap of 3 pixels on each side between the base line and the tabs. Correct the size of the hole cut into the clip region accordingly. Visually tested on macOS 10.15.7 and macOS 11.2.1 using the dockwidgets and tabdialog example. As a drive-by, fix a spelling mistake in related documentation. Fixes: QTBUG-86362 Change-Id: Iada027999467741d0590576ee4508e6f41fb056d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit f5d6f8dca0c45f311b19731128a495392884ec8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Correctly support style sheet for toolbutton menus and arrowsVolker Hilsheimer2021-06-101-25/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | QToolButton can show an arrow instead of an icon, and that arrow can, as per the documentation, styled via the ::down/up/left/right-arrow pseudo element. This was not working at all, as the implementation confused the down-arrow with the menu arrow. Implement this correctly for all arrow types. A QToolButton can also have different ways to show a menu, either by using a separate section of the button that can be clicked; this section can be styled via ::menu-button and ::menu-arrow. Or by instant or delayed menu popup when clicking the button itself, in which case the button shows an indicator in the button itelf; that indicator can be styled via the ::menu-indicator pseudo element. The old implementation confused the various options, and the name of the PseudeoElement_ToolButonDownArrow didn't help with that. So rename that element to PseudoElement_ToolButtonMenuIndicator, and render it when there is no separate drop down. Fixes: QTBUG-27640 Change-Id: Ia142a5d7498fa717e70f4e5382305e305b29effa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 2b2e7b2ac50e5b4f6e1888e594f6e32338dd2a80) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Check scrollbar ScrollBarOverlap when computing QListView marginsZhang Hao2021-06-101-0/+1
| | | | | | | | | | | | | | | | | | When the listview setWordWrap is true and ScrollBarPolicy is ScrollBarAsNeeded, if QStyle::PM_ScrollView_ScrollBarOverlap returns true, the text displayed an empty line. Fix this by not reserving the width of the vertical scrollbar if the flow is TopToBottom and the vertical scrollbar, and QStyle returns true for PM_ScrollView_ScrollBarOverlap. Amends aeef92c3c33e4ebcb7e5d8dd955020f4f4600e84 Fixes: QTBUG-94248 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I4d47c7e86bbb86474cb1a99bb26d8b67f0e8a7e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0242be90606b377864c6fd02d5a8e0afaf635acf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix scrolling of tab bar when the visible tab is wider than the visible spaceVolker Hilsheimer2021-06-101-4/+9
| | | | | | | | | | | | | | | When finding the index we need to scroll to, use the one where both start and end of the tab rect are outside the currently visible section. Otherwise we wouldn't scroll when the left-most index ends outside the visible section. Add test, which requires that the scroll buttons have object names. Fixes: QTBUG-70498 Change-Id: Id153c77dd5fca146612375e0ff39bd1f3e0536b1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 06b1e404c936847038cc7a371720b05f31532b6a) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTabBar: don't let tab shine through (semi-transparent) scroll buttonsVolker Hilsheimer2021-06-101-0/+14
| | | | | | | | | | | | | | | | On styles where the tab bar's scroll buttons are rendered semi- transparently, or where the buttons don't fill their entire rect (for example have rounded edges), the tab that's covered by the buttons should not shine through the gaps, or even shine through the button. Clip the painter so that the area of each button is not painted by the tabs. Fixes: QTBUG-50866 Change-Id: Ie81f6d260f36d5a17868822e683745844a6a6b2f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0965cf0f1e49185097b0698e51ea9ad464eaa573) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractItemView: block autoScroll from interfering with QScrollerVolker Hilsheimer2021-06-091-0/+4
| | | | | | | | | | | | | | | | | When pressing an index in order to start a flick gesture, QAIV sets the current index. When QScroller changes state to Dragging, then QAIV restores the current index to what it was before the press, as the user is clearly scrolling the view. With autoScroll enabled, this will produce an ugly jump if the old current index is no longer in the viewport. To prevent this, disable autoScroll before restoring the currentIndex. Fixes: QTBUG-64543 Change-Id: I3e0a18a6a179d80b9d810fce5aa658f0cfff9a29 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit b1fdcc8c0fefe0660302494618032342b623e199) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QListView: add assert for static analyzerVolker Hilsheimer2021-06-081-0/+2
| | | | | | | | | | | | | The loop that initializes the item should execute at least once, so the pointer should be pointing to something valid. The static analyzer doesn't see that, and warns about unguarded access to the item pointer in report with hash d008dbef4573afca54be0139e2971a4a. Add asserts for both the condition that makes the loop run at least once, and for the item pointer not being nullptr. Change-Id: I94b9f3db3b3ce3d82445cf66788c05854b441aaf Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit ddc886d670694df9e400ea6f04f76df19d0e1145) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Calculate space requirement of menu items based on widest elementsVolker Hilsheimer2021-06-081-4/+5
| | | | | | | | | | | | | | | | | | | Since icon, checkmark, text, and shortcut are each rendered aligned within their own column, we need to take the widest of each element into account when calculating the size requirement of each item. Otherwise an item with very long text but no icon will get enough space for the text, but no space for the icon, resulting in the text running over the shortcut or edge of the menu. Fortunately, QStyleOptionMenuItem provides us with the necessary information. Fixes: QTBUG-86754 Change-Id: I0cf0e9adfe480d1004106e7475e498e718bf027b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c8cb2409477bdc3bc41d6bbdfc5055441cda084f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add a note about a limitation in QDockWidget on macOSAndy Shaw2021-06-081-0/+5
| | | | | | | Change-Id: I3599304d2dab9a6e64f110644b22e65494f3c0a8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit e5aada1ba7133dedc7ec00e67c5cca68186b738d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Clarify the QLineEdit document of editingFinished signalZhang Hao2021-06-081-1/+2
| | | | | | | | | | | | | QLineEdit gets focus and don't type any character when QLineEdit lost focus, document say QLineEdit will issue editingFinished signal. In fact,QLineEdit doesn't issue editingFinished signal. Fix this by clarify the document. Fixes: QTBUG-94057 Change-Id: I88eed2ec7a28823598dc46f1df26fd305eb99c1f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 8ee2186830d33cf2e0ebc7c9ab59166a27fe81a5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: allow Qt::AA_DontShowShortcutsInContextMenus overridesVolker Hilsheimer2021-06-072-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Following the discussion in QTBUG-69452, the resulting change in cc33dd079796437bafed8f42de7fbf8f17d19ec8, and the documentation of QAction::shortcutVisibleInContextMenu, the intention is that the attribute allows the overriding of the platform default. However, QAction did ask both the attribute and the platform integration, making the override impossible. Instead, ask only the attribute, but default the value of the attribute to what the platform integration provides. [ChangeLog][QtGui][QAction] The shortcutVisibleInContextMenu property defaults to the value of the Qt::AA_DontShowShortcutsInContextMenus attribute, which in turn defaults to the platform integration. To override the default, set the application attribute after instantiating QApplication, or override the default for each QAction instance. Task-number: QTBUG-73990 Change-Id: Iaba330913555d93d05efe1b3965a6aea39db5554 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 68297195759492594ac4143b7f208e17fe6f594b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add missing prepositionPaul Wicking2021-06-071-2/+2
| | | | | | | | Fixes: QTBUG-93969 Change-Id: I60e08ab7f17459b6cff969767273228a8406cfc3 Reviewed-by: Johanna Vanhatapio <johanna.vanhatapio@qt.io> (cherry picked from commit 3bc80defdc0ebd77d7eafe32153693aa44c5f2fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractItemView: don't block dragging after double clickVolker Hilsheimer2021-06-043-3/+7
| | | | | | | | | | | | | | | | | | | | | | After d6551fe12520 it was no longer possible to start a drag with a double click (where the first click selects an item, and the second press+move starts the drag). Resetting the pressedItem variable to block the emission of the clicked() signal had this unwanted side effect. Instead, use an explicit boolean to store that the next release event will be the result of a double click, so that the clicked() signal is not emitted again (preventing the double-emission was the purpose of change d6551fe12520). Task-number: QTBUG-77771 Fixes: QTBUG-94087 Change-Id: I082c5169d89eb980dcd7985ef3d302b6ff060fb9 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Olivier BARTHELEMY <perso.olivier.barthelemy@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix copy-and-paste bug in QDTEP::getMaximum()Edward Welbourne2021-06-031-2/+2
| | | | | | | | | | It had a copy of a line from getMinimum(). The results were predictably broken. Change-Id: I3582edb08696bec4311f43fc426f7e54dc069f53 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit a15a3fef0b5dae4e83bd94b23dd2418208159d05) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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>
* Fix PageDown behavior and PageUPTang Haixiang2021-05-311-14/+39
| | | | | | | | | | | | | | When the PageDown is pressed, the current's rect cannot be used to match the item, because we don't know the size of the rect. Move the rect by the height of the viewport, and then move the rect upwards until it matches the button <= viewport's bottom of the item Fixes: QTBUG-92583 Change-Id: I210edc0e8b942984f3fc20e7752c6e1315152ea1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c77840d734883c91079c942e052cbdc0994c2f01) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QComboBox: add space for scrollbar if needed after showing popupVolker Hilsheimer2021-05-311-6/+13
| | | | | | | | | | | | | | | | | | QComboBox tests if a horizontal scrollbar is needed before sizing and showing the popup, but QListView only knows whether a scrollbar is needed only after laying itself out during the initial show and paint event. So test whether the need has arisen as part of this initial layout, and then provide the additional space. Resizing the widget after showing it is not ideal, but in practice makes no visible difference (and it's either way preferable to not being able to access the item covered by the scrollbar). Fixes: QTBUG-93736 Change-Id: I0bf077e18116ce174ae7f9218cb3b0dfa82964e1 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 11e88eaa6df629a2c23a60815a1f7826dd2ac31a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QComboBox: propagate style change on widget to internal containerVolker Hilsheimer2021-05-312-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When changing the style of the combobox, the change will not propagate to the internal container widget, so the changeEvent handler won't be called. This is correct (as per QWidget::setStyle documentation). QComboBoxPrivateContainer asks the combobox style for relevant settings, such as the frame style, which is then used for sizing and positioning. If the combobox's and container's settings become inconsistent, then the combobox popup will not get the correct size and/or position. Move some of the style-dependent changes into a separate function and call it when the QComboBox::changeEvent handles the style change so that both widgets have a consistent set of settings. Add a test case that verifies that the style is asked for the relevant setting when the style changes. Note: QComboBox does a lot of style-dependent setup work in different places, which is quite messy and complex. Trying to consolidate that further breaks tests though, so this change is doing the minimum necessary to fix the reported issue. Fixes: QTBUG-92488 Change-Id: Ia957d504b2d800add26fc0565be727b5c08a5358 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit d36ef40d18b40cfc6f57c1002079f02a15eb41d3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix BASE argument of qt_add_resourcesJoerg Bornemann2021-05-181-192/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BASE argument of qt_add_resources now denotes the root point of the alias of the file. Before, BASE was merely prepended to every file that got passed to qt_add_resources. Old behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "images/button.png") Alias is "../shared/images/button.png", and pro2cmake generated QT_RESOURCE_ALIAS assignments to fix this. New behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "../shared/images/button.png") The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment is needed. The new behavior is in effect for user projects and for Qt repositories that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be ported one by one to this new behavior. Then the old code path can be removed. Task-number: QTBUG-86726 Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 92185d417de43237ae62eae55599c65922cd9a15) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDockWidget, macOS: don't drag on native widgetsRichard Moe Gustavsen2021-05-121-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | When using native dock widgets on macOS, it will currently fail if you try to drag on a dock widget inside QMainWindow to make it floating. The reason is that the drag will basically start as as drag inside one NSWindow (QMainWindow), but continue as a drag on another NSWindow (QDockWidget). And this is not handled well by AppKit, especially since the NSView where the drag was started is reparented into a new NSWindow (the floating QDockWidget) while the dragging is ongoing. And there seems to be no practical solution to how we can support this from the cocoa QPA plugin This patch will therefore change the logic in QDockWidget to simply make the dock widget floating if you drag on it, rather than actually starting a drag (but only for the described case). Fixes: QTBUG-70137 Change-Id: Ic309ee8f419b9c14894255205867bce11dc0c414 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 3224c6d7d150164241c13ccf7d47377a39c0a6bb) 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>
* Improve handling of minimumHeightForWidth()Jan Arve Sæther2021-05-105-1/+55
| | | | | | | | | | This also aligns the implementation with QWidgetItem::heightForWidth() Fixes: QTBUG-92599 Change-Id: I0de68c61ec37a16a8c338575d07ff9e8168a0b98 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 4d4eb11fe340bf0b3a1ce0caae62d9319bf941cf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add note about the risk of setting min-width/height in a style sheetVolker Hilsheimer2021-05-071-2/+8
| | | | | | | | Task-number: QTBUG-86677 Change-Id: I1e5e10ee79d80fee40d04afe439489d6ce16a43e Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 6fd480142bd253de095c1e4b79c119c9ed7d20a5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't draw focus frame if widget has style rules that affect borderDoris Verria2021-05-071-0/+9
| | | | | | | | | | | | | | Skip drawing the focus ring if the widget has a custom styled border, custom focus ring, or any rule that affects the border. For QPushButton, if the style rule has a background set, the bevel will be drawn in the Windows style. Skip drawing the Mac focus frame in that case too. Fixes: QTBUG-93032 Change-Id: I7c4d4bf6f6ce7bbcd17cd620586c5efa44f2b8d6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 05f7dd5ead5927ef7b3301380b81d7194d9e0593) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTabBar: take a style sheet's font into account when laying out tabsVolker Hilsheimer2021-05-061-3/+18
| | | | | | | | | | | | | | | If a tab has a font assigned to it through a style sheet, then take the font size into account when calculating the contents rectangle. Add a test, which hardcodes the windows style to avoid flaky behavior when e.g. macOS lays tabs out in the center. Fixes: QTBUG-92988 Change-Id: Ifb0ac97db7647cc25367972737be8878e50f6040 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit e3b2b12a912361af309302a4b1fc27c2206322af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMdiArea: Fix top level window title when using ↵Friedemann Kleint2021-05-062-4/+28
| | | | | | | | | | | | | | | DontMaximizeSubWindowOnActivation When trying to find the original window title, check for another maximized sub window and use its title. Protect the calls to setWindowTitle to prevent the original title from being cleared. Fixes: QTBUG-92240 Change-Id: I55175382ab261b4cf8b5528304adaaec4fbe2c31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 8886462872db9cdab4d7683823fd24fb9f8920c4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix read-only pseudo-state in QPlainTextEdit stylesheetEirik Aavitsland2021-05-061-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>
* Document that a toplevel window QSizeGrip doesn't get rendered on macOSVolker Hilsheimer2021-05-031-0/+4
| | | | | | | | | | | | | | Amends b8947e9194f0f88f464448ac51f6a05113d36a33 which removed the grip's rendering unless they are in a QMdiSubwindow. This was a deliberate choice to comply with the macOS HIG. Rather than putting in another widget attribute, document that another style can be used. Fixes: QTBUG-90945 Change-Id: Id227fd31d8bafaaab7005e5ff5340da96c0f65b3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 18f5b83e97828dd572eaf67c054a43aa5472a668) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ItemViews: don't delete dragged items when a subclass accepted the moveVolker Hilsheimer2021-05-013-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 0f1008a5936c903ca9448193df7df6117e2c617b, which introduced the dropEventMoved private data member through which the drop-site itemview can notify the drag-site that the drop handler has taken care of the move operation. However, if a subclass of an item view overrides dropEvent to move and accept the event before calling the default implementation, then the flag would not be set, as the dropOn helper would return false. So QAbstractItemView still removed the item, resulting in two items being removed when one was move-dropped. Set the dropEventMoved member also when the QTreeWidget::dropEvent handler is called by a subclass override and the event is already accepted. This way, overrides don't have to artifically set the accepted action to "IgnoreAction" to disable the handling in drag site. [ChangeLog][QtWidgets][QAbstractItemView] Classes overriding dropEvent for MoveAction events to move data can call accept() on the event before calling the superclass to prevent QAbstractItemView from deleting the source item. Task-number: QTBUG-87057 Task-number: QTBUG-77427 Change-Id: Ibe75fc1b2ca60627c825ad9b9b6d48953577edec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 808a6dedcb4aabcb81f096f03d0b1bb4ae2ea0d1) 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>
* Fix a build when QT_DISABLE_DEPRECATED_BEFORE is set to 6.1.0Jarek Kobus2021-04-231-0/+2
| | | | | | | | | | Amends: ff8d757e222d0b9b8618b83e6c4186e366e917e9 Task-number: QTBUG-93033 Change-Id: I67b7bda0f63fdb3c4e1864e38c872b96df90a8ae Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 43d6778ce59266067d2fb5adf88a1ba3f73b29ae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Re-layout QProgressDialog when setting the cancel buttonQiang Li2021-04-201-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>
* 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 label margins for pulldowns with custom styled menu indicator on macOSDoris Verria2021-04-061-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>
* Variable is Assigned a never used value in qt_make_filter_list()Huang Jie2021-03-301-11/+4
| | | | | | | | | | Variable 'i' is assigned a value that is never used in qt_make_filter_list() Change-Id: Id845ecb5231b97a899443bdcb9f49cccb7f20bea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 8a226cd76b96527970b1600f6975c13eccddf109) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Font style name 'Normal' and 'Regular' have the same meaningOliver Eftevaag2021-03-301-0/+8
| | | | | | | | | | | | | | | Some popular fonts on linux systems follow a naming convention, where font styles are named 'Regular', 'Italic', 'Bold' and 'Bold Italic'. Qt so far only accepts the words Italic and Oblique interchangably, but not with Regular and Normal. This change will make sure that Regular is interpreted the same as the Normal font style. Fixes: QTBUG-90396 Change-Id: Ibbaf086de742c91f4d380c937ca80e846aa32a2e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 426b363761dbb4c95d263df2e4acdfab071c8018) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix z-value of QGraphicsItems being ignored during drawQiang Li2021-03-301-1/+1
| | | | | | | | | | | | | | | | In QGraphicsScene's function draw, don't copy the children into a const copy (to prevent detaching in the loops), as they might get sorted. Instead, use a const reference. Amends e349f787d595aa343ca86af94159b6730d55b8d5, which introduced the bug by making a copy of the unsorted list. Fixes: QTBUG-81316 Change-Id: Iab9b87e75178a883806088a9db234c7a2aaa9301 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 269fdef53d98386b714bf6852a1f214e9159faa1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Redundant condition: tornoffZou Ya2021-03-301-1/+1
| | | | | | | | | | | Redundant condition: tornoff. '!tornoff || (tornoff && scroll)' is equivalent to '!tornoff || scroll' Change-Id: I8339faa4d53360db280173ee489e48eba4883b70 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 712117f8b89cdb2578d6aaa424141da216799fe9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFontDialog: Fix crash when passing QFont constructed from empty ↵Friedemann Kleint2021-03-301-1/+1
| | | | | | | | | | | | | | string/stringlist The standarddialogs example showed a crash when opening the font dialog due to the empty list. Amends d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8. Change-Id: I93191485c72712d9b2d3ea0ae104f5edb9621f0c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit e49e5d87be4b30522a85037b5dd81be703882b67) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace QTextDocumentResourceProvider with a std::functionVolker Hilsheimer2021-03-303-6/+6
| | | | | | | | | | | | | | | | | | | | | | | 376e3bd8ecf40881685714f6f19e12d68e92127e added the new class for Qt 6.1, but during header review we concluded that using a class introduces complexity wrt instance ownership and API design that can be avoided by using a std::function instead. The functionality is tied to QTextDocument, so the type definition and the default provider API is added there. Since std::function is not trivially copyable, the atomicity of the previous implementation is not maintained, and concurrent modifications of and access to the global default provider from multiple threads is not allowed. The relevant use case can be supported by implementing a resource provider that is thread safe. Task-number: QTBUG-90211 Fixes: QTBUG-92208 Change-Id: I39215c5e51c7bd27f1dd29e1d9d908aecf754fb7 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit ccf1a1a9536be7b904494f5b3243202d71a33b06) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rename QUrlResourceProvider to QTextDocumentResourceProviderVolker Hilsheimer2021-03-293-6/+6
| | | | | | | | | | | | | | | | | | While the class name is now a bit more than a mouthful, it's purpose is very narrowly tied to QTextDocument, so don't use a very generic name for it. That resources are provided based on a URL is to some degree an implementation detail, and URLs are resource locators so we don't need that in the class name. Address code review comment for 6.1. Add documentation and links to existing APIs with a similar purpose. Task-number: QTBUG-90211 Task-number: QTBUG-92208 Change-Id: I4f09057cc2f53a5595513c1c9422e6ccaad6ca13 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit c8f6f8a2220ce8fd628c969f19dfae6f38d7311c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix invalid pointer return with QGridLayout::itemAt(-1)Zhang Yu2021-03-231-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>