From 3428a4b8b4df1272092980e253e0501cd0d0e3b0 Mon Sep 17 00:00:00 2001 From: Sanakan8472 Date: Mon, 17 Feb 2020 08:15:11 +0100 Subject: [PATCH] Added CDockManager::floatingWidgetCreated event (#121) This allows to subscribe to events of the newly created window. A common use case is to show a message box if a dock container with many modified documents in it is closed. This allows for the user to decide whether he wants to save / discard all the changes or cancel the closing of the window. --- src/DockManager.cpp | 1 + src/DockManager.h | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 1ac5a91..bb72777 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -440,6 +440,7 @@ CDockManager::~CDockManager() void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget) { d->FloatingWidgets.append(FloatingWidget); + emit floatingWidgetCreated(FloatingWidget); ADS_PRINT("d->FloatingWidgets.count() " << d->FloatingWidgets.count()); } diff --git a/src/DockManager.h b/src/DockManager.h index 4b97727..27b1caa 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -450,10 +450,17 @@ signals: /** * This signal is emitted if the dock manager finished opening a - * perspective + * perspective. */ void perspectiveOpened(const QString& PerspectiveName); + /** + * This signal is emitted, if a new floating widget has been created. + * An application can use this signal to e.g. subscribe to events of + * the newly created window. + */ + void floatingWidgetCreated(CFloatingDockContainer* FloatingWidget); + /** * This signal is emitted, if a new DockArea has been created. * An application can use this signal to set custom icons or custom