diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2023-11-08 16:50:35 +0100 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2023-11-09 14:59:41 +0000 |
commit | c93ab8c2a015b40b9a487ed9f23a72aebea8d52a (patch) | |
tree | 3aab74d5cda5c14ebe3f9bedf81767996de4e8dc /src/widgets/widgets/qdockwidget_p.h | |
parent | c02f8b9d4d9a6578bb2017bafbb963d09641383f (diff) |
QDockWidget: Remove "group" bool trap
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>
Diffstat (limited to 'src/widgets/widgets/qdockwidget_p.h')
-rw-r--r-- | src/widgets/widgets/qdockwidget_p.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index 2adf62d03e..72cf08177f 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -51,6 +51,11 @@ class QDockWidgetPrivate : public QWidgetPrivate }; public: + enum class DragScope { + Group, + Widget + }; + void init(); void toggleView(bool); void toggleTopLevel(); @@ -86,7 +91,7 @@ public: void setWindowState(bool floating, bool unplug = false, const QRect &rect = QRect()); void nonClientAreaMouseEvent(QMouseEvent *event); void initDrag(const QPoint &pos, bool nca); - void startDrag(bool group = true); + void startDrag(DragScope scope); void endDrag(bool abort = false); void moveEvent(QMoveEvent *event); void recalculatePressPos(QResizeEvent *event); |