From ca414cf7fdb8bd9b2b2f1b9065a84819ee7ac217 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Fri, 5 Jul 2024 12:15:16 +0100 Subject: [PATCH] qtquick Add QtQuick::Group::closeAllDockWidgets() Can't name it close as it clashes with View::close(). Part of issue #513 --- src/qtquick/views/Group.cpp | 5 +++++ src/qtquick/views/Group.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/qtquick/views/Group.cpp b/src/qtquick/views/Group.cpp index e165b47d2..bd5a25448 100644 --- a/src/qtquick/views/Group.cpp +++ b/src/qtquick/views/Group.cpp @@ -280,3 +280,8 @@ void Group::setMDISize(QSize sz) layout->resizeDockWidget(m_group, sz); } + +bool Group::closeAllDockWidgets() +{ + return m_inDtor || m_group->close(); +} diff --git a/src/qtquick/views/Group.h b/src/qtquick/views/Group.h index 62102f2d0..1a11f6a4c 100644 --- a/src/qtquick/views/Group.h +++ b/src/qtquick/views/Group.h @@ -69,6 +69,9 @@ class DOCKS_EXPORT Group : public QtQuick::View, public Core::GroupViewInterface /// Sets the size of this group in the MDI layout Q_INVOKABLE void setMDISize(QSize); + /// Convenience that just calls close() on all its dock widgets + /// Returns whether all dock widgets accepted the close + Q_INVOKABLE bool closeAllDockWidgets(); protected: void removeDockWidget(Core::DockWidget *dw) override;