mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Adds function to raise a section-content.
This commit is contained in:
parent
747874b1e5
commit
7e41d18a6d
@ -63,6 +63,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool hideSectionContent(const SectionContent::RefPtr& sc);
|
bool hideSectionContent(const SectionContent::RefPtr& sc);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Selects the specific SectionContent as current, if it is part of a SectionWidget.
|
||||||
|
* If SC is floating, it does nothing (or should we show it?)
|
||||||
|
*/
|
||||||
|
bool raiseSectionContent(const SectionContent::RefPtr& sc);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Creates a QMenu based on available SectionContents.
|
* Creates a QMenu based on available SectionContents.
|
||||||
* The caller is responsible to delete the menu.
|
* The caller is responsible to delete the menu.
|
||||||
|
@ -112,7 +112,10 @@ bool ContainerWidget::showSectionContent(const SectionContent::RefPtr& sc)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qFatal("Unable to show SectionContent, don't know where 8-/");
|
|
||||||
|
// Already visible?
|
||||||
|
// TODO
|
||||||
|
qDebug("Unable to show SectionContent, don't know where 8-/ (already visible?)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,10 +161,46 @@ bool ContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search SC in hidden elements
|
||||||
|
// The content may already be hidden
|
||||||
|
if (_hiddenSectionContents.contains(sc->uid()))
|
||||||
|
return true;
|
||||||
|
|
||||||
qFatal("Unable to hide SectionContent, don't know this one 8-/");
|
qFatal("Unable to hide SectionContent, don't know this one 8-/");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContainerWidget::raiseSectionContent(const SectionContent::RefPtr& sc)
|
||||||
|
{
|
||||||
|
// Search SC in sections
|
||||||
|
for (int i = 0; i < _sections.count(); ++i)
|
||||||
|
{
|
||||||
|
SectionWidget* sw = _sections.at(i);
|
||||||
|
int index = sw->indexOfContent(sc);
|
||||||
|
if (index < 0)
|
||||||
|
continue;
|
||||||
|
sw->setCurrentIndex(index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search SC in floatings
|
||||||
|
for (int i = 0; i < _floatings.size(); ++i)
|
||||||
|
{
|
||||||
|
FloatingWidget* fw = _floatings.at(i);
|
||||||
|
if (fw->content()->uid() != sc->uid())
|
||||||
|
continue;
|
||||||
|
fw->setVisible(true);
|
||||||
|
fw->raise();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search SC in hidden
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QMenu* ContainerWidget::createContextMenu() const
|
QMenu* ContainerWidget::createContextMenu() const
|
||||||
{
|
{
|
||||||
// Fill map with actions (sorted by key!)
|
// Fill map with actions (sorted by key!)
|
||||||
|
Loading…
Reference in New Issue
Block a user