Add DockWidget::open()

Show/hide/visibility is being deprecated
This commit is contained in:
Sergio Martins
2022-09-10 12:10:25 +01:00
parent b5a9c03c21
commit 3cb6c2b8d0
2 changed files with 15 additions and 2 deletions

View File

@@ -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())) {

View File

@@ -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.