From 3cb6c2b8d01ff71a2d288fe7220079d9c46fe9f1 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Sat, 10 Sep 2022 12:10:25 +0100 Subject: [PATCH] Add DockWidget::open() Show/hide/visibility is being deprecated --- src/controllers/DockWidget.cpp | 5 +++++ src/controllers/DockWidget.h | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/controllers/DockWidget.cpp b/src/controllers/DockWidget.cpp index 0ec67217..cea0e5d6 100644 --- a/src/controllers/DockWidget.cpp +++ b/src/controllers/DockWidget.cpp @@ -411,6 +411,11 @@ QStringList DockWidget::affinities() const } void DockWidget::show() +{ + open(); +} + +void DockWidget::open() { if (view()->isRootView() && (d->m_lastPosition->wasFloating() || !d->m_lastPosition->isValid())) { diff --git a/src/controllers/DockWidget.h b/src/controllers/DockWidget.h index 2445fdec..f2d84e19 100644 --- a/src/controllers/DockWidget.h +++ b/src/controllers/DockWidget.h @@ -310,8 +310,16 @@ public: */ QStringList affinities() const; - /// @brief Equivalent to QWidget::show(), but it's optimized to reduce flickering on some - /// platforms + /// @brief Opens this dock widget. + /// Does nothing if already open. + /// The dock widget will appear floating unless it knows about its previous layout position, + /// in which case it will appear docked (or tabbed) into the main window. + void open(); + + /// @brief Deprecated, use open() instead. + /// Visibility isn't a good concept since tabbed non-current dock widgets are not visible but + /// still open. + /// @deprecated void show(); /// @brief Brings the dock widget to the front.