summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Don't refer to "this" in QToolTip documentationVolker Hilsheimer2020-12-091-1/+1
| | | | | | | | | | All APIs are static, so there is no "this" pointer. Task-number: QTBUG-89082 Change-Id: I4bfe6c14304d311b903878acd5b4c8169f4065c7 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 4aa174ed86db9b8832f6d0447850b9f942aac96f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Qml accessibility fixesPiotr Mikolajczyk2020-12-092-2/+30
| | | | | | | | | | | | | | | | | | | - Accessibility focus can follow the position of the widget (for example when swiping on a scrollview) - controls are clickable directly after appearing on the screen after scroll (previously you had to click somewhere else on the screen, and after that you could focus the newly appeared control) - checkbox and switch react correctly on click action - fixed combobox behavior with accessibility enabled Task-number: QTBUG-79611 Change-Id: If36914ab0165f33593e68fd7ecf168693f8538a7 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit fd20bc2277f98b86bddbd3f8a0ca92457a8c7c70) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSplashScreen: draw pixmap with SmoothTransfromMorten Johan Sørvig2020-12-081-0/+1
| | | | | | | | | | | | Use high-quality scaling to improve rendering in cases where the pixmap has to be scaled down, such as when drawing a @2x pixmap at 150%. Change-Id: I216b03b61dfa2cc2cc8c573e24a576424f6f5d17 Fixes: QTBUG-88982 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit fdc687913df2dbd92c7469082690381fea55e628) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStyleAnimation: make sure the last frame of animation is renderedWang Chuan2020-12-071-2/+2
| | | | | | | | | | | Amend to 8738f09b9fc1b35e3dc78211368d87069f3071f7. The last frame of animation might be lacked if [_skip < fps]. Fixes: QTBUG-89118 Change-Id: Ia0345e2aff7579afe2d60c4e7495bfaa1f36198c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 04fed9f77e3288f69fe89bcb8a3f1cdbe02ce219) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPushButton: fix support of style sheet rule for text alignmentXiang Xiaojun2020-12-041-2/+4
| | | | | | | | Fixes: QTBUG-86857 Change-Id: I7e3e2b5323b1e46f572cacfddae20cb6e7882a47 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6269438af95bbd988ead08829fa3bc9dc25891e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-12-0412-14/+14
| | | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 0440614af0bb08e373d8e3e40f90b6412c043d14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove non-existent function QApplication::desktop() from docsAndreas Buhr2020-12-031-1/+0
| | | | | | | | | | | The method QApplication::desktop() was removed. This patch removes a line mentioning it in the documentation. Task-number: QTBUG-88533 Change-Id: I123e41c342d64da347b9bd59378e52a8e0301c1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d7828a5ed385f1c4630239922266d5dd554772a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Adjust the format of code blocks in function mouseReleaseEventQiang Li2020-12-031-1/+1
| | | | | | | Change-Id: I8441b1c4f22ec04e34e8c2c5e9ccc69d34c67e01 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d6dcf508a6a751c8c32273112957607b062899e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix links to Application ExampleVolker Hilsheimer2020-12-029-14/+16
| | | | | | | | | | | The example was renamed in 6cb36d825d365988ea7a601218bdd3a329290469. Change-Id: Ic9daac60002c9988dfeb5c7dcde74edb69388f37 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com> (cherry picked from commit 0cc9a99865c4b6dfb1a212a5aba0fc5907f19b24) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QHeaderView: fix spurious sortingGiuseppe D'Angelo2020-12-012-6/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QHeaderView sorting may be triggered when the user performs some mouse interactions that should really not result in sorting. Generally speaking, this happens when the user: * presses on a non-movable section (A) * moves on another section (B) * releases on that section resulting in B becoming sorted / flipping sorting. (Non-movable is required, otherwise dragging would cause section moving, not sorting.) To make the matter worse, QHeaderView doesn't check that the release happens within its geometry. This makes sense when moving sections: one is able to drag a section horizontally/vertically even if the mouse leaves the QHeaderView. But when not moving sections, this means that one can * press on section (A), * move the mouse anywhere vertically (for a horizontal bar, mut.mut for a vertical) above or below another section (B), that is, outside QHeaderView's geometry * release the mouse and cause B to be sorted. Fix it by 1) remembering which one was the section that the user originally clicked on; that's the only one that can possibly become sorted (if we're not moving and other conditions hold). No other variable seemed to remember this. 2) on release, check that it happens within that section's geometry. If so, sort. Change-Id: Icfb67662221efbde019711f933781ee1e7d9ac43 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit b5b2640a65de20d05890fa9e6462bb7b88f83964) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-12-011-1/+1
| | | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 130b2090147e0d28e35fd736fbefcd588c0014f6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix various documentation warningsTopi Reinio2020-11-301-1/+1
| | | | | | | | | | | | | | - QList iterators are now nested classes inside QList. - Drop reference to Qt OpenGL Widgets landing page, there is no such page. - Fix typos and linking issues. Fixes: QTBUG-86295 Change-Id: I964843deb81aa55ff8ddb9a1c2b004cb72e68de9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 99abdd180bd6f626f4ca94806fdaddbeb3774325) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Restore pass-by-ref to QRect QCalendarWidget::paintCell()Edward Welbourne2020-11-272-2/+2
| | | | | | | | | | | Accidentally changed to pass-by-value while doing that to QDate, in commit af837734b2259201f126b206bd5299497e080f7b Task-number: QTBUG-86400 Change-Id: I8d2db532f537e5f82a5f3b36e72fcf7fefdd2ee5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 8db0d701e8b1fe00cdd5d71c18afff84de606013) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtWidgets: Propagate event device when translating mouse eventsFriedemann Kleint2020-11-275-6/+12
| | | | | | | | | | | | There are a few places left over, for example the QTextEdit creating mouse events in a timer and notably QGraphicsView. Task-number: QTBUG-88678 Task-number: QTBUG-46412 Change-Id: I7ed23911be3b86b4b39fb478b947ec3b7a60761f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 21fa38b6ad0167673148709faa4907b220853c5a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rename Application ExampleVolker Hilsheimer2020-11-261-1/+1
| | | | | | | | | | | Prefix it with "Qt Widgets -" to make it a bit clearer in the list of highlighted examples which module this one is about. Change-Id: I0bf65b02db72173f1adfe0bcf8657be7905dbd6c Reviewed-by: Tuukka Turunen <tuukka.turunen@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 6cb36d825d365988ea7a601218bdd3a329290469) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStackedLayout: fix a memory leakGiuseppe D'Angelo2020-11-231-1/+3
| | | | | | | | | A layout takes ownership of the QLayoutItem passed to addItem. Change-Id: Iea3c64453f3cbf4f1b5660e505c1a35dca537833 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1fcc882d7ca564f17e49b8d51adc43eb5b97c57b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Update CMake functions in Qt Widgets for Qt 6Kai Koehne2020-11-233-80/+12
| | | | | | | Change-Id: I4110e8695c75c40cec6f94bb94879b07282b29d3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c082213556991c6619ef2d2c00a7042406f867a7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* wasm: fix showing tooltipsLorn Potter2020-11-191-1/+1
| | | | | | | Change-Id: I4c82ccc2bfa1019ef105ccf20982786097c126b9 Fixes: QTBUG-87227 Pick-to: 5.15 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Ensure that QMenu is polished before setting the screen in popup()David Redondo2020-11-181-1/+2
| | | | | | | | | | | | | | Some styles alter the widget that will influence the underlying platform window. An example is when a style would want to draw the menu with some transparency and sets the Qt::WA_TranslucentBackground attribute. This needs to happen before the platform window is created. However calling QWidgetPrivate::setScreen will end up creating the window and the surface format will be fixed at this point. Pick-to: 5.15 Change-Id: I707cf1de5c1614382cffbea1aae8cdb01f7de44a Reviewed-by: Nate Graham Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix x-height name in stylesheet docsFlorian Bruhin2020-11-171-1/+1
| | | | | | | | | | | The *height* of an x being called "ex width" makes no sense. Also, it seems like this measurement is typically called "x-height" rather than "ex height", see e.g. https://en.wikipedia.org/wiki/X-height Pick-to: 5.15 5.12 Change-Id: Id8e2c1aa9be1a4a60e667a076486777d34f1e76d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix QGraphicsItem crash if click right button of mouseZhang Yu2020-11-181-2/+6
| | | | | | | | | | | In this case, the 'parent' is QGraphicsTextItem which isn't a object inheriting from QWidget. Converting QGraphicsTextItem to QWidget by static_cast and using it as QWidget leads to crash. Fixes: QTBUG-88309 Pick-to: 5.15 Change-Id: I3c583f43125eb36841848434d1fa9a135b0e9f57 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Get rid of Q_COMPILER_CONSTEXPR checksAllan Sandfeld Jensen2020-11-171-4/+0
| | | | | | | Is required now. Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Update landing pages and module pages in qtbaseJerome Pasion2020-11-171-0/+2
| | | | | | | | | | -Qt SQL, Qt D-BUS, Qt GUI, Qt OpenGL, Qt Widgets, Qt Test, Qt Concurrent, Qt XML, Qt Network, Qt Core -language edits for consistency, add links Task-number: QTBUG-87155 Change-Id: Ic61350c9fa15090c802a42d8e9116219591eba73 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Allow QMutableSinglePointEvent to be copy- and default-constructedVolker Hilsheimer2020-11-172-6/+5
| | | | | | | | | | | | | | | | | Since QMutableSinglePointEvent is just an access-helper to QSinglePointEvent, we can safely create one from the other. This covers QMouseEvent as well with the right casting in place. And by making QMSPE default constructable, we can use it in code that needs to frequently copy event data, for example in QtQuick. This allows us to make the copy c'tor and assignment operators for QEvent classes protected, which prevents potentially dangerous (ie. slicing) implicit copies. Change-Id: I815774847cca63896f46c43df683053b3d952b61 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove old QtGui and QtWidgets examples from highlighted listVolker Hilsheimer2020-11-171-4/+1
| | | | | Change-Id: I86c879568dd71981abd417c1bfb71e4582599276 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-1642-187/+187
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>