Make Frame deal in LayoutWidget instead of its derived class DropArea

This commit is contained in:
Sergio Martins
2021-02-09 16:32:42 +00:00
parent f6ad75e214
commit 6ad01f4994
2 changed files with 11 additions and 12 deletions

View File

@@ -545,21 +545,21 @@ QStringList Frame::affinities() const
}
}
void Frame::setLayoutWidget(DropArea *dt)
void Frame::setLayoutWidget(LayoutWidget *dt)
{
if (dt == m_dropArea)
if (dt == m_layoutWidget)
return;
const bool wasInMainWindow = dt && isInMainWindow();
if (m_dropArea)
if (m_layoutWidget)
disconnect(m_visibleWidgetCountChangedConnection);
m_dropArea = dt;
m_layoutWidget = dt;
if (m_dropArea) {
// We keep the connect result so we don't dereference m_dropArea at shutdown
if (m_layoutWidget) {
// We keep the connect result so we don't dereference m_layoutWidget at shutdown
m_visibleWidgetCountChangedConnection =
connect(m_dropArea, &LayoutWidget::visibleWidgetCountChanged, this,
connect(m_layoutWidget, &LayoutWidget::visibleWidgetCountChanged, this,
&Frame::updateTitleBarVisibility);
updateTitleBarVisibility();
if (wasInMainWindow != isInMainWindow())
@@ -569,7 +569,7 @@ void Frame::setLayoutWidget(DropArea *dt)
bool Frame::isTheOnlyFrame() const
{
return m_dropArea && m_dropArea->numFrames() == 1;
return m_layoutWidget && m_layoutWidget->visibleCount() == 1;
}
bool Frame::isOverlayed() const
@@ -708,8 +708,7 @@ QRect Frame::dragRect() const
MainWindowBase *Frame::mainWindow() const
{
return m_dropArea ? m_dropArea->mainWindow()
: nullptr;
return m_layoutWidget ? m_layoutWidget->mainWindow() : nullptr;
}
TabWidget *Frame::tabWidget() const

View File

@@ -317,9 +317,9 @@ private:
bool event(QEvent *) override;
/// @brief Sets the LayoutWidget which this frame is in
void setLayoutWidget(DropArea *);
void setLayoutWidget(LayoutWidget *);
DropArea *m_dropArea = nullptr;
LayoutWidget *m_layoutWidget = nullptr;
FrameOptions m_options = FrameOption_None;
QPointer<Layouting::Item> m_layoutItem;
bool m_updatingTitleBar = false;