summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QDockWidget: Use resizer without native window decorationAxel Spoerl2024-03-021-4/+4
| | | | | | | | | | | | | | 975c0bdf732ea7c5f7632913a27a1b6ae5cd5b26 has disabled usage of a resizer on Windows. This has caused a regression, when a dock widget was rendered frameless. Use a resizer in that case. Fixes: QTBUG-120694 Task-number: QTBUG-102196 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I9fbcb1a8b1d8869995093bc1da7524ec81e9f02d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QDockWidget: fix dock buttons sizeChristian Ehrlicher2024-02-161-1/+1
| | | | | | | | | | | | | | | The previous fix calculated an icon size of 12 instead 10 for the icon size when SH_DockWidget_ButtonsHaveFrame is set. This lead to a too large icon. It was also rendered blurry because there was no native png with 12x12 pixels so it has to be scaled. This amends 04f4b27774ba70ebba425394fa8a1ffdffb2483b Pick-to: 6.7 Fixes: QTBUG-122214 Task-number: QTBUG-118643 Change-Id: Iaf332a21681e5b84222299d79d4b28d0c26b0cda Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Reapply: Remove const/ref debug operator for QDockWidgetVolker Hilsheimer2024-02-031-10/+9
| | | | | | | | | | | | | | | | QObjects are usually passed by pointer, so we leave the override taking a pointer. This amends bbeff2a3350dd3396400865525d509b784c2d93e, and reverts the previous revert in b148a362c36a9b34b0c21c60530353d6bf6b92cb. Now that we have removed the incorrectly added operators from the 6.6 branches entirely, we can remove the unnecessary const/ref operator from 6.7. Task-number: QTBUG-119952 Pick-to: 6.7 Change-Id: Id196367ddf3ffb443db44194002f850dcfec5d79 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Revert "API Review / QDockWidget: Remove const/ref debug operator"Axel Spoerl2024-01-181-9/+10
| | | | | | | | | | This reverts commit ca2f46c04c26ed4649cb6c2c62d3b2e52cd8d5ad. Reason for revert: <BIC in 6.6 found by Marc Mutz> Pick-to: 6.7 6.6 Change-Id: Ia5b8849e55ebccb514bc753ce1d31855d91e2406 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove note about QDockWidget::DockWidgetClosable not working on macOSTor Arne Vestbø2024-01-161-3/+1
| | | | | | | | It does nowadays. Pick-to: 6.7 6.6 6.5 Change-Id: Ie14a84460abfebd42c93e5ae41969d9e3b4c4f5d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* API Review / QDockWidget: Remove const/ref debug operatorAxel Spoerl2024-01-101-10/+9
| | | | | | | | | | | | | | | Remove the debug operator taking a const QDockWidget & argument. Leaving the override taking a pointer. This amends bbeff2a3350dd3396400865525d509b784c2d93e. Change-Id: I0fbca6ea7dbffe6269c70e5e9eb29af9f84c3600 Found-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Task-number: QTBUG-119952 Pick-to: 6.7 6.6 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QDockWidget: Clarify documentation of floating propertyAxel Spoerl2023-12-141-3/+6
| | | | | | | | | | | | QDockWidget::isFloating() returns true for single, floating dock widgets. It returns false, if the dock widget is part of a floating tab (i.e. it is a QDockWidgetGroupWindow child). => Clarify documentation. Pick-to: 6.7 6.6 6.5 Change-Id: I3c5a4a86b89dcb001e7561de7dcc604bae0d9cee Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMainWindowPrivate::layout - use QPointer instead of bare pointerAxel Spoerl2023-12-051-0/+4
| | | | | | | | | | | | | | | | | qt_mainwindow_layout(mainWindow) returns the pointer to a stale object, if the layout has already been deleted. Most users of qt_mainwindow_layout() assert the returned pointer, or handle nullptr explicitly. If the mainwindow layout has already been deleted, they will still access it. While this has not lead to (known) issues yet, a UAF exception is thrown in an ASAN build. => Use a QPointer instead of a bare pointer. => Add missing nullptr check in QDockWidgetPrivate::endDrag() Pick-to: 6.6 6.5 Change-Id: I3484b53e0e2213b82085ceed3ffa66913947189f Reviewed-by: David Faure <david.faure@kdab.com>
* QDockWidget: Fix group unpluggingAxel Spoerl2023-11-181-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A floating dock widget could either be a single QDockWidget object, or a QDockWidgetGroupWindow with a single QDockWidget child. The former could be dropped on the latter. Dropping the latter on the former caused a crash. The existence of QDockWidgetGroupWindows with a single dock widget child was accepted to be by design. Previous fixes, such as 9ff40b59da58160dc26c54204a615a2456e07405, attempted to wrap all single floating dock widgets in QDockWidgetGroupWindows. These attempts fell short, because of the manifold programmatic and manual options to create a floating dock widget: - drag a single dock widget out of a main window dock area - drag a dock widget out of a tab bar on the main window - drag a dock widget out of a floating tab - call `QDockWidget::setFloating(true)` in any situation - create a new QDockWidget, that floats from the beginning Whenever a QDockWidgetGroupWindow with a single QDockWidget child was hovered and/or dropped on a QDockWidget without a group window, crashes or screen artifacts were observed. Previous fixes made them occur less often. QDockWidgetGroupWindow is not designed to hold a single QDockWidget child. Such a state is inconsistent and may only exist, while a QDockWidgetGroupWindow is constructed. The reason why such invalid QDockWidgetGroupWindows started to exist, is a bool trap: QDockWidgetPrivate::mouseMoveEvent() starts a drag operation, when a dock widget is moved by mouse. It called startDrag() with no argument, which defaulted to startDrag(true) and caused a group drag. This assumption is *correct*, when a tabbed group of dock widgets is dragged out of the main dock as a whole, to become floating tabs. *wrong*, when a single dock widget is dragged out of a docked group, to become a single floating dock widget. In the second case, the dock widget was wrapped in a new, floating, invisible QDockWidgetGroupWindow. Looking like a single, floating dock widget, the group window caused a crash, when attempted to be dropped on another dock widget. This patch eliminates all cases, where a QDockWidgetGroupWindow with a single QDockWidget is created: (1) Implement QDockWidgetPrivate::isTabbed(). This enables mouseMoveEvent to determine, whether the move relates to a group of tabbed dock widgets, or to a single dock widget. startDrag() can therefore be called with the right argument. It will no longer create a QDockWidgetGroupWindow with a single QDockWidget child. (2) Change QMainWindowTabBar::mouseReleaseEvent When a dock widget was dragged out of a tab bar and became a single, floating dock widget, it was still parented to the group window. That is wrong, because it has no more relationship with that group window. => Reparent it to the main window, just like any other single floating dock widget. That enables QDockWidgetGroupWindow to detect, that the 2nd last child has gone and no more group window is needed (see next point). (3) React to reparenting, closing and deleting If the second last dock widget in a floating tab gets closed (manually or programmatically), reparented or deleted, also unplug the last one and remove the group window. (4) Amend 9ff40b59da58160dc26c54204a615a2456e07405 Remove the code path where a QDockWidgetGroupWindow with a single QDockWidget child was created 'just in case', to make it compatible others, created by (1), (2) or (3). (5) Change QMainWindowLayout::hover() When the hover ends without a successful drop and a temporary group window with a single dock widget child has been created, remove the group window. The patch fixes smaller inconsistencies, which have not become visible due to assertions and crashes earlier in the chain. The patch finally extends tst_QDockWidget, to cover all 4 cases. - Creation of floating tabs The creation of floating tabs is extracted from floatingTabs() to the helper function createFloatingTabs(). In addition to creating floating tabs, the helper verifies that dragging a dock widget out of the main window doesn't accidently wrap it in a group window. This covers case (1). - tst_QDockWidget::floatingTabs() The test function verifies now, that both test dock widgets have the same path before plugging them together and after unplugging them from the floating tab. This covers case(4). - tst_QDockwidget::deleteFloatingTabWithSingleDockWidget() This test function is added, to cover cases (2) and (3). - tst_QDockWidget::hoverWithoutDrop() This test function hovers two floating dock widgets hover each other, and returns the moved dock widget to its origin before releasing the mouse. This covers case(5). This fixes a lot of long standing bugs, making the author of this patch modestly happy :-) Fixes: QTBUG-118223 Fixes: QTBUG-99136 Fixes: QTBUG-118578 Fixes: QTBUG-118579 Fixes: QTBUG-56799 Fixes: QTBUG-35736 Fixes: QTBUG-63448 Fixes: QTBUG-88329 Fixes: QTBUG-88157 Fixes: QTBUG-94097 Fixes: QTBUG-44540 Fixes: QTBUG-53808 Fixes: QTBUG-72915 Fixes: QTBUG-53438 Found-by: Keith Kyzivat <keith.kyzivat@qt.io> Found-by: Frederic Lefebvre <frederic.lefebvre@qt.io> Pick-to: 6.6 6.5 Change-Id: I51b5f9e40cb2dbe55fb14d769541067730538463 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove bool trap in QDockWidgetPrivate::endDrag()Axel Spoerl2023-11-171-10/+9
| | | | | | | | | | | | | | endDrag(false) meant to end a drag with a dock location change. endDrag(true) meant to abort a drag without a dock location change. Replace this with a meaningful enumeration. Define a dummy enum for builds w/o QDockWidget. Task-number: QTBUG-118578 Task-number: QTBUG-118579 Pick-to: 6.6 6.5 Change-Id: I786f4210f5a3ee67ffcf0dc9285f77a480148569 Reviewed-by: David Faure <david.faure@kdab.com>
* QDockWidget: Remove "group" bool trapAxel Spoerl2023-11-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | The unplug() and startDrag() functions of QMainWindowLayout and QDockWidget used a boolean argument specifying whether a single dock widget or a group of dock widgets should be unplugged. The argument defaulted to true. That has lead to inconsistent unplug operations, broken item_lists and crashes, especially when the methods were called without an argument. To improve code readability, replace bool trap with a meaningful enum. Remove default arguments, in order to force explicit calls. This patch does not change behavior, it is just carved out to facilitate reviews. Task-number: QTBUG-118578 Task-number: QTBUG-118579 Pick-to: 6.6 6.5 Change-Id: I50341b055f0bb76c2797b2fb1126a10de1fee7dd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Extend qDebug functionality for QDockWidgetAxel Spoerl2023-11-081-0/+21
| | | | | | | | | | | | Add features and floating flag to QDockWidget debugging. Debug dockwidget parents of a group window. Task-number: QTBUG-118578 Task-number: QTBUG-118579 Pick-to: 6.6 Change-Id: If2a6caacf5d02f9018c2a3073fdbc1de39bce1ee Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
* QDockWidget: fix dock buttons sizeChristian Ehrlicher2023-11-041-23/+2
| | | | | | | | | | | | | | | | The size of the dock buttons did not account the SH_DockWidget_ButtonsHaveFrame style hint and therefore was too large when a full 16x16 icon was used (which was the case after the latest style cleanups) and therefore appeared too large. This also allows the remove of the hack for the windows style. The windows vista/11 style is not even affected by this hack because there the size comes from windows itself and can not be modified via PM_SmallIconSize. Fixes: QTBUG-118643 Task-number: QTBUG-118122 Change-Id: Ie09a6a4e89df66b5393c5a57735002da47415c0e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QDockWidget: use pmf-style connect syntaxChristian Ehrlicher2023-11-011-8/+9
| | | | | | | | Use pmf-style connect syntax for the three connections within QDockWidgetPrivate. Change-Id: I091a210d6a822903f0cc183f9090e03b124875e6 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QDockWidget: Do not propagate title from a closed dock widgetAxel Spoerl2023-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When a dock widget is closed while floating, it still reports being floating even though the QWidget::windowHandle()->isVisible() returns false. This is documented behavior and will not be changed. c153066baaa88718ed45b68230d81285eb436d3d relied on the isFloating() to return false, if the dock widget is closed. When the window title was changed by setWindowTitle(), the change was overridden by reading the old value from the window handle. => Amend the patch and add a windowHandle()->isVisible() as a condition. In c153066baaa88718ed45b68230d81285eb436d3d, an autotest for the title propagation (QTBUG-113591) was added to floatingTabs(). => Harden the setWindowTitle() test function. Move the tests related to QTBUG-113591 and QTBUG-117764 to this function. Fixes: QTBUG-117764 Pick-to: 6.6 6.5 Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QDockWidget: Don't use QWidgetResizeHandler on WindowsAxel Spoerl2023-10-021-0/+4
| | | | | | | | | | | | | | | | | | | | | QWidgetResizeHandler sets its own mouse cursor, which can cause the wrong icon being shown in corner cases (e.g. floating dock with custom title bar and windows container). Windows handles resizing of toplevel windows on platform level. A QWidgetResizeHandler is not necessary. => Do not create one on Windows. Resizing of floating dock widgets is tested in tst_QDockWidget::dockPermissions(), floatingTabs(), hideAndShow(). => No separate autotest needed. Fixes: QTBUG-102196 Pick-to: 6.6 6.5 6.2 Change-Id: I20ab203e6b7ecc1dbda0524c7ff9bef271a7c04f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Timothée Keller <timothee.keller@qt.io>
* QDockWidget: ignore close event if DockWidgetClosable is not setVolker Hilsheimer2023-09-211-1/+7
| | | | | | | | | | | | | | | [ChangeLog][QtWidgets][QDockWidget] A floating dockwidget that doesn't have the DockWidgetClosable feature flag set can no longer be closed by a call to QWidget::close or a corresponding keyboard shortcut (such as Alt+F4). Fixes: QTBUG-116752 Pick-to: 6.6 6.5 Change-Id: I7859a2eed11f0e4ee013f7f56611e282e9bcae9a Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix build with -no-feature-dragandropTasuku Suzuki2023-08-171-0/+6
| | | | | | Change-Id: I9ac2a9edb747608ef93008ac865886b1ee0ea82a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: David Redondo <qt@david-redondo.de>
* Fix qdoc link warnings after moving a few examples to manual testsTor Arne Vestbø2023-06-271-1/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: I81a6e9d52e858c3f733d4c527c70408772813b56 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update documentation of signal QDockWidget::visibilityChangedAxel Spoerl2023-06-161-0/+4
| | | | | | | | | | | | | | The signal can deviate from QWidget::isVisible(). This patch clarifies the signal's documentation. Since its name suggests that it is in sync with QWidget::isVisible(), A TODO comment is added to consider deprication in Qt7. It appears to be more reliable to listen to hide/show events. Pick-to: 6.6 6.5 Fixes: QTBUG-48161 Change-Id: I43aa16c2ecb4877abd8effb7da8e07576438d6d2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QDockWidget: Propagate window title when re-dockingAxel Spoerl2023-06-071-3/+9
| | | | | | | | | | | | | | | | When a floating dockwidget's title changes, it is rendered as a window title. When the title changes while floating, the change will be reverted to the pre-change title when the dockwidget is docked again. This patch explicitly propagates the window title, if it has been programmatically changed while the dock widget is floating. It adds test functionality in tst_QDockWidget::floatingTabs(). Fixes: QTBUG-113591 Pick-to: 6.6 6.5 Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use platform drags for drags of docks and toolbars on waylandDavid Redondo2023-06-021-2/+26
| | | | | | | | | | | | | | | | | | On Wayland we can't know where windows are in relation to each other so the whole mechanism was broken, toolbars were unmovable once undocked and could be blindly redocked. Dockwidgets had native toolbars to move them around but could not be redocked. This introduces an alternative code path that uses a platform drag with a special mimetype that enables the platform to issue a combined drag and window move using the relevant protocol. Should the protocol not be available this doesn't make things actively worse as it will be similar broken as before. Fixes: QTBUG-87332 Change-Id: I3b8bdc0b1bc22569a64cb8bf7ca7d37d223936a6 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Introduce events for Window device pixel ratio changesDavid Edmundson2023-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There is a mix between screen device pixel ratio. Currently we store the property on a per-window basis, but the change notifications are still on a per screen basis which can fall apart on edge cases. On wayland we are getting per window DPR changes without as useful screen change events so it's important to fix. It also has potential to clean up the Windows backend in the future where the backend is currently papering over the two concepts. This patch introduces two new events: A QWindowSystemInterface to trigger a window DPR change independently of a screen change. An event to notify windows the new DPR rather than needing to track signals on the screen. This happens either when the window dpr changes or implicitly through a screen change. This can deprecate an existing event ScreenChangeInternal so the value is reused and renamed for clarity. Change-Id: I637a07fd4520ba3184ccc2c987c29d8d23a65ad3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace warning with debug message in dockwidget high DPI mappingAxel Spoerl2022-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When a dock widget is moved between high DPI screens, it's native position is calculated and applied. The calculation falls back to a mapping without high DPI, if the dock widget's initial position cannot be mapped to a QScreen. A warning was emitted in that case, to inform the user about a potential screen misconfiguration (e.g. a physical screens not being mapped exactly next to each other, leaving a gap). Despite of the warning, the position calculation safely falls back to non high DPI. The warning also kicks in when the dock widget's top left position is located outside a screen, hence being invisible. Since calculating an invisible top left position is possible without high DPI mapping, this patch replaces the warning with a debug message. Fixes: QTBUG-108311 Pick-to: 6.4 Change-Id: I692034e5aeb5f7a94cca519ce055795fa72ea216 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix native titlebar offset and resizing upon unplugging dock widgetsAxel Spoerl2022-09-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | When a dock widget received a native title bar upon unplugging, the position of the newly unplugged dock widget was calculated without taking the title bar's height into consideration. Furthermore, dock widgets grew by the separator size upon undocking. That is fixed by 10a143ccd762c810f4096a5b2e986d16ea0107ad by relying on the assumption that passing a QRect() to the unplugging method leads to un unchanged dock widget geometry. However, when more than one dock widgets are docked in the same main window dock on macOS or Windows, the size is stil increased. This patch corrects the position offset for native title bars. It also corrects an unplugged dock widget's geometry by the sparator's size. Fixes: QTBUG-106530 Fixes: QTBUG-106531 Pick-to: 6.4 6.2 5.15 Change-Id: Ia4bcb556841e14146f19c1377f4010d5ae009bcf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Refix QDockwidget drag out dockwidgetThorbjørn Lund Martsum2022-09-061-1/+1
| | | | | | | | | | | | | | In f082458c4609dfa20fdfb8bfe3e625c311b145da a fix attempt was made and in a lucky example on Mac it worked well. However, the logic was still not correct and that could be seen in other systems/examples. This patch updates the logic to be the correct behavior in general. Pick-to: 6.4 6.3 6.2 5.15 6.4.0 Fixes: QTBUG-106064 Change-Id: I3b098be9942d37c367b146a7359185bcfd127762 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix dragging a docked QDockWidget [REG-fix]Thorbjørn Lund Martsum2022-08-311-1/+1
| | | | | | | | | | | | | In 54f328f0e8205480749a6d8d2ebe0e58cb1cdb67 issues with dragging dock widgets between screens were solved. However, it only worked well if the widget was floating. It worked wrong when dragging out a docked widget. That is fixed by this patch. Pick-to: 6.4 6.3 6.2 5.15 Fixes: QTBUG-106064 Change-Id: I8d486d30a334719a2931828464ccaceb8ba2e019 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deliver non-client area mouse events to WASM windowsMikolaj Boc2022-07-271-2/+2
| | | | | | | | | | QWasmCompositor now delivers non-client area mouse events to windows as it should, which fixes a lot of issues with window manipulation. One of such issues is re-docking of dock widgets. Fixes: QTBUG-105092 Change-Id: I9de45b7e1b1a80b64387031eb0cc0b31a4be2571 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QDockWidget warning log for an unexpected situationThorbjørn Lund Martsum2022-07-051-1/+4
| | | | | | | | | | It didn't enter the original patch because it would prevent it to be backported to 6.2 and 5.15. Pick-to: 6.3 6.4 Change-Id: I9af30b86b98d5d101b0784cf45781cf46d216c6d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix QDockWidget move between screens with different dprThorbjørn Lund Martsum2022-06-291-1/+28
| | | | | | | | | | | | | | | | | | | When partly moved back and forth between screens with different dprs (device pixel ratios) unexpected jumps and size changes could occur. (See the linked issue for details) This patch maps global coordinates to native ones and vice versa (in QDockWidgetPrivate::mouseMoveEvent()), so that the calculated position is the right coordinate on the right screen. Pick-to: 6.4 6.3 6.2 5.15 Fixes: QTBUG-104205 Change-Id: I0e59792a946e0444fed2e2b857f2f8b140afc9b7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-151-2/+2
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-3/+5
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QDockWidget parenting and dock permissionsAxel Spoerl2022-04-191-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check DockWidgetArea permissions of QDockWidgetGroupWindows with single dock widget. Obtain a dock widget's tab position from a dock widget group window if it can't be established otherwise. Remove hardcoded assumption that a dock widget is in the left dock. Both cases have lead to inconsistent entries and dangling pointers in QDockAreaLayoutInfo::item_list. Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds value '0', which becomes obsolete by the fix. Create a QDockWidgetGroup window prepered to become a floating tab, whenever a dock widget is being hovered over. Store it in item_list so it can be found and deleted when required. No longer call e->ignore() after propagating close events to the first dock widget and thus preventing others from receiving the event. Add logging category qt.widgets.dockwidgets Update dock widget autotest with tests to check the fixes mentioned: plugging, unplugging, hiding, showing, closing and deleting. Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android due to flaky isFloating() response after a dock widget has been closed or plugged. QSKIP dockPermissions and floatingTabs test on Windows due to mouse simulation malfunction. QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059) Fixes: QTBUG-99136 Pick-to: 6.3 6.2 Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QStylePainter when painting widgetsMorten Johan Sørvig2022-01-201-3/+3
| | | | | | | | This makes it easier to set global painter options which affect all style painting. Change-Id: I6a38204ed2d874255e92345e6a6a50d27939fb24 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Allow dragging of a floating dockwidget on macOS with a custom titlebarAndy Shaw2021-08-021-1/+1
| | | | | | | | | | This amends 3224c6d7d150164241c13ccf7d47377a39c0a6bb to account for the case when the dockwidget is already floating. Task-number: QTBUG-70137 Pick-to: 6.2 6.1 5.15 Change-Id: If8b345565b11b44beb3fb4b697cfe812c29c6396 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use On icon for pressed dock widget title buttons without frameVolker Hilsheimer2021-06-241-2/+4
| | | | | | | | | | | | | | | The QCommonStyle provides explicit pixmaps for the SP_TitleBarCloseButton and SP_TitleBarNormalButton, but never showed the "down" pixmap on macOS because the button has no frame, so the On state flag was never set. Set the style states so that the "down" pixmap is used on a button that is either pressed or checked if it doesn't have a frame. Since QIcon only has two states, use the "On" state for both pressed and checked. Pick-to: 6.2 Task-number: QTBUG-38776 Change-Id: Ic04070196b97a4fb66d7a2669e9894fd7960230e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Add a note about a limitation in QDockWidget on macOSAndy Shaw2021-06-081-0/+5
| | | | | | Pick-to: 6.1 5.15 Change-Id: I3599304d2dab9a6e64f110644b22e65494f3c0a8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* 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). Pick-to: 6.1 5.15 Fixes: QTBUG-70137 Change-Id: Ic309ee8f419b9c14894255205867bce11dc0c414 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-4/+4
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change QWidget::enterEvent signature to take a QEnterEventVolker Hilsheimer2020-09-051-2/+2
| | | | | | | | | | | | | | | | | | | This is a source incompatible change for widget implementors. Leaving the old enterEvent as a virtual overload is problematic due to shadowing. Best to make a clean cut, widget reimplementors will get a compile time warning if they mark their override as such, or if they try to call the parent class implementation. Addresses ### Qt 6 comment. [ChangeLog][QtWidgets][QWidget] The virtual enterEvent handler now receives a QEnterEvent, which contains information about mouse position and button states, rather than a plain QEvent. Change-Id: I233f594fd79c0c090983b3db8532913d00132fde Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* High-DPI: Remove usage of Qt::AA_EnableHighDpiScalingTor Arne Vestbø2020-08-281-2/+2
| | | | | | | | This attribute is now on by default. Change-Id: I7c9d2e3445d204d3450758673048d514bc9c850c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Mark some Qt namespace enum members properly as deprecatedEdward Welbourne2020-08-271-2/+0
| | | | | | | | | | | | | | | | A comment is not good enough, Some of the enum members were even still in use, or mentioned in documentation. WA_ContentsPropagated, WA_WState_DND and WA_ForceAcceptDrops have been deprecated since 4.5.1; and at least the last has been an \omitvalue in the docs for even longer. (WA_ShowModal and WA_GroupLeader have been similarly marked, but are in use, see QTBUG-85816.) Push back to 5.15.1 in order to be able to remove these at Qt 6. Pick-to: 5.15.1 Change-Id: I6ea3839767e5f5158b0fed508f65798470191908 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove deprecated QStyleOption::init()Christian Ehrlicher2020-06-211-2/+2
| | | | | | | | Even it was not marked as deprecated the replacement function initFrom() is available since Qt4 times (and init() is deprecated since then) Change-Id: I09a4ebbf66b01fbe7aec67691dc68d2e42d1cd78 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Phase 2 of removing QDesktopWidgetVolker Hilsheimer2020-06-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove QDestopWidget public header, simplify the implementation that maintains a Qt::Desktop type QWidget for each QScreen, and turn QWidget's initial target screen into a QScreen pointer. QApplication::desktop() now takes an optional QScreen pointer, and returns a QWidget pointer, so that applications and widgets can get access to the root widget for a specific screen without having to resort to private APIs. QDesktopWidgetPrivate implementations to look up a screen for an index, widget, or point are now all inline functions that thinly wrap QGuiApplication::screens/screenAt calls. We should consider adding those as convenience APIs to QScreen instead. Note that QWidget::screen is assumed to return a valid pointer; there is code that handles the case that it returns nullptr (but also code that trusts that it never is nullptr), so this needs to be defined, verified with tests, and asserted. We can then simplify the code further. Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-081-8/+8
| | | | | | | Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove deprecated members from QtWidgets/widgets classesVolker Hilsheimer2020-04-171-5/+0
| | | | | | | | | | | | | | | | | | | Cleaning up those that are trivial to remove because they have direct replacements. The QLabel changes to the pixmap/picture getters provide the following migration path: QPixmap *ppix = l->pixmap(); // up to 5.15, warns in 5.15 QPixmap pval = l->pixmap(Qt::ReturnByValue); // new in 5.15, works in 6 QPixmap pixmap = l->pixmap(); // from Qt 6 on The overload with argument can be deprecated after the first LTS or so. Change-Id: I8494ceeea55b2aeda0bd340640ad95cb7c91f7d6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>