Commit eb28b1cc authored by Ahmad Samir's avatar Ahmad Samir Committed by Christoph Cullmann
Browse files

De-dupblicate some code

parent 88597864
......@@ -636,6 +636,15 @@ bool Sidebar::isCollapsed()
return m_splitter->sizes().at(ownSplitIndex) == 0;
}
void Sidebar::showRaisedTabs()
{
for (const auto &[wid, id, _] : m_toolviewInfo) {
if (isTabRaised(id)) {
wid->show();
}
}
}
void Sidebar::handleCollapse(int pos, int index)
{
Q_UNUSED(pos);
......@@ -671,11 +680,7 @@ void Sidebar::handleCollapse(int pos, int index)
m_isPreviouslyCollapsed = true;
} else if (m_isPreviouslyCollapsed && m_resizePlaceholder->isVisible()) {
// If the sidebar is manually expanded again, we need to show the activated plugin-views again
for (const auto &[wid, id, _] : m_toolviewInfo) {
if (isTabRaised(id)) {
wid->show();
}
}
showRaisedTabs();
m_resizePlaceholder->hide();
m_isPreviouslyCollapsed = false;
......@@ -705,11 +710,7 @@ void Sidebar::expandSidebar(ToolView *widget)
// when the sidebar was collapsed, the activated widgets were hidden, so we need to show them again
// see Sidebar::handleCollapse
for (const auto &[wid, id, _] : m_toolviewInfo) {
if (isTabRaised(id)) {
wid->show();
}
}
showRaisedTabs();
m_resizePlaceholder->hide();
m_isPreviouslyCollapsed = false;
......
......@@ -266,6 +266,8 @@ private Q_SLOTS:
void buttonPopupActivate(QAction *);
private:
void showRaisedTabs();
enum ActionIds {
PersistAction = 10,
HideButtonAction = 11,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment