Further move onCloseEvent to base class

So that it can be reused by MDI layouts too
This commit is contained in:
Sergio Martins
2022-03-09 14:58:35 +00:00
parent 3454b67a45
commit 01cc915734
4 changed files with 14 additions and 14 deletions

View File

@@ -397,15 +397,3 @@ DockWidgetBase *DropArea::mdiDockWidgetWrapper() const
return nullptr;
}
void DropArea::onCloseEvent(QCloseEvent *e)
{
e->accept(); // Accepted by default (will close unless ignored)
const Frame::List frames = this->frames();
for (Frame *frame : frames) {
qApp->sendEvent(frame, e);
if (!e->isAccepted())
break; // Stop when the first frame prevents closing
}
}

View File

@@ -77,8 +77,6 @@ public:
/// Returns the helper dock widget for implementing DockWidget::Option_MDINestable.
DockWidgetBase *mdiDockWidgetWrapper() const;
void onCloseEvent(QCloseEvent *);
private:
Q_DISABLE_COPY(DropArea)
friend class Frame;

View File

@@ -302,3 +302,15 @@ LayoutSaver::MultiSplitter LayoutWidget::serialize() const
return l;
}
void LayoutWidget::onCloseEvent(QCloseEvent *e)
{
e->accept(); // Accepted by default (will close unless ignored)
const Frame::List frames = this->frames();
for (Frame *frame : frames) {
qApp->sendEvent(frame, e);
if (!e->isAccepted())
break; // Stop when the first frame prevents closing
}
}

View File

@@ -189,6 +189,8 @@ public:
virtual bool deserialize(const LayoutSaver::MultiSplitter &);
LayoutSaver::MultiSplitter serialize() const;
void onCloseEvent(QCloseEvent *) override;
protected:
void setRootItem(Layouting::ItemContainer *root);
/**