mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
parent
f2a352c305
commit
932ec71ad8
@ -153,6 +153,13 @@ signals:
|
||||
*/
|
||||
void activeTabChanged(const SectionContent::RefPtr& sc, bool active);
|
||||
|
||||
/*!
|
||||
* Emits whenever the visibility of a SectionContent changes.
|
||||
* \see showSectionContent(), hideSectionContent()
|
||||
* \since 0.2
|
||||
*/
|
||||
void sectionContentVisibilityChanged(const SectionContent::RefPtr& sc, bool visible);
|
||||
|
||||
private:
|
||||
// Elements inside container.
|
||||
QList<SectionWidget*> _sections;
|
||||
|
@ -163,6 +163,7 @@ bool ContainerWidget::showSectionContent(const SectionContent::RefPtr& sc)
|
||||
fw->setVisible(true);
|
||||
fw->_titleWidget->setVisible(true);
|
||||
fw->_contentWidget->setVisible(true);
|
||||
emit sectionContentVisibilityChanged(sc, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -178,11 +179,13 @@ bool ContainerWidget::showSectionContent(const SectionContent::RefPtr& sc)
|
||||
if (hsi.preferredSectionId > 0 && (sw = SWLookupMapById(this).value(hsi.preferredSectionId)) != NULL)
|
||||
{
|
||||
sw->addContent(hsi.data, true);
|
||||
emit sectionContentVisibilityChanged(sc, true);
|
||||
return true;
|
||||
}
|
||||
else if (_sections.size() > 0 && (sw = _sections.first()) != NULL)
|
||||
{
|
||||
sw->addContent(hsi.data, true);
|
||||
emit sectionContentVisibilityChanged(sc, true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -190,6 +193,7 @@ bool ContainerWidget::showSectionContent(const SectionContent::RefPtr& sc)
|
||||
sw = newSectionWidget();
|
||||
addSection(sw);
|
||||
sw->addContent(hsi.data, true);
|
||||
emit sectionContentVisibilityChanged(sc, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -210,6 +214,7 @@ bool ContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc)
|
||||
if (!found)
|
||||
continue;
|
||||
_floatings.at(i)->setVisible(false);
|
||||
emit sectionContentVisibilityChanged(sc, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -240,6 +245,7 @@ bool ContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc)
|
||||
sw = NULL;
|
||||
deleteEmptySplitter(this);
|
||||
}
|
||||
emit sectionContentVisibilityChanged(sc, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
_container->setOrientation(Qt::Vertical);
|
||||
#if QT_VERSION >= 0x050000
|
||||
QObject::connect(_container, &ADS_NS::ContainerWidget::activeTabChanged, this, &MainWindow::onActiveTabChanged);
|
||||
QObject::connect(_container, &ADS_NS::ContainerWidget::sectionContentVisibilityChanged, this, &MainWindow::onSectionContentVisibilityChanged);
|
||||
#else
|
||||
QObject::connect(_container, SIGNAL(activeTabChanged(const SectionContent::RefPtr&, bool)), this, SLOT(onActiveTabChanged(const SectionContent::RefPtr&, bool)));
|
||||
QObject::connect(_container, SIGNAL(sectionContentVisibilityChanged(SectionContent::RefPtr,bool)), this, SLOT(onSectionContentVisibilityChanged(SectionContent::RefPtr,bool)));
|
||||
#endif
|
||||
setCentralWidget(_container);
|
||||
|
||||
@ -151,6 +153,11 @@ void MainWindow::onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bo
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onSectionContentVisibilityChanged(const ADS_NS::SectionContent::RefPtr& sc, bool visible)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << sc->uniqueName() << visible;
|
||||
}
|
||||
|
||||
void MainWindow::onActionAddSectionContentTriggered()
|
||||
{
|
||||
return;
|
||||
|
@ -24,8 +24,10 @@ public slots:
|
||||
private slots:
|
||||
#if QT_VERSION >= 0x050000
|
||||
void onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bool active);
|
||||
void onSectionContentVisibilityChanged(const ADS_NS::SectionContent::RefPtr& sc, bool visible);
|
||||
#else
|
||||
void onActiveTabChanged(const SectionContent::RefPtr& sc, bool active);
|
||||
void onSectionContentVisibilityChanged(const SectionContent::RefPtr& sc, bool visible);
|
||||
#endif
|
||||
void onActionAddSectionContentTriggered();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user