Skip to content

Commit

Permalink
feat: make the size of splitter be remembered
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers authored and deepin-bot[bot] committed Oct 27, 2023
1 parent f72fd1c commit f72fc05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/interface/vlistmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class VListModulePrivate
, m_view(nullptr)
, m_splitter(nullptr)
, m_childMargin(20)
, m_splitterSize({})
{
}

Expand Down Expand Up @@ -151,13 +152,19 @@ class VListModulePrivate
onAddChild(tmpChild);
}
});
QObject::connect(m_splitter, &QSplitter::splitterMoved, m_splitter, [this]([[maybe_unused]] int pos, [[maybe_unused]] int index) {
m_splitterSize = m_splitter->sizes();
});
m_childMargin = 0;//20;
if (qobject_cast<HListModule *>(q->getParent())) {
m_childMargin = 0;//10;
m_view->setContentsMargins(10, 0, 10, 10);
}
onCurrentModuleChanged(q->currentModule());
m_splitter->setSizes({200,600});
if (m_splitterSize.isEmpty()) {
m_splitterSize = {200, 600};
}
m_splitter->setSizes(m_splitterSize);
return m_splitter;
}

Expand All @@ -171,6 +178,7 @@ class VListModulePrivate
QHBoxLayout *m_hlayout;
QList<DCC_NAMESPACE::ModuleObject *> m_extraModules;
int m_childMargin;
QList<int> m_splitterSize;
};
}

Expand Down

0 comments on commit f72fc05

Please sign in to comment.