Adds API method ContainerWidget::isSectionContentVisible.

Updates demo project with example.
This commit is contained in:
mfreiholz
2016-04-21 07:51:26 +02:00
parent 1fb78aa873
commit 3a5cd2118a
4 changed files with 38 additions and 0 deletions

View File

@@ -278,6 +278,35 @@ bool ContainerWidget::raiseSectionContent(const SectionContent::RefPtr& sc)
return false;
}
bool ContainerWidget::isSectionContentVisible(const SectionContent::RefPtr& sc)
{
// Search SC in floatings
for (int i = 0; i < _floatings.count(); ++i)
{
const bool found = _floatings.at(i)->content()->uid() == sc->uid();
if (!found)
continue;
return _floatings.at(i)->isVisible();
}
// Search SC in sections
for (int i = 0; i < _sections.count(); ++i)
{
SectionWidget* sw = _sections.at(i);
const int index = sw->indexOfContent(sc);
if (index < 0)
continue;
return true;
}
// Search SC in hidden
if (_hiddenSectionContents.contains(sc->uid()))
return false;
qWarning() << "SectionContent is not a part of this ContainerWidget:" << sc->uniqueName();
return false;
}
QMenu* ContainerWidget::createContextMenu() const
{
// Fill map with actions (sorted by key!)