mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Fixes invisible SectionWidget TAB, if the content was hidden previously, by calling setvisible(true) on title-widget - content-widget is managed by QStackedWidget.
This commit is contained in:
parent
c5e39068b2
commit
94d8fe3e25
@ -143,24 +143,29 @@ void SectionWidget::addContent(const InternalContentData& data, bool autoActivat
|
|||||||
{
|
{
|
||||||
_contents.append(data.content);
|
_contents.append(data.content);
|
||||||
|
|
||||||
|
// Add title-widget to tab-bar
|
||||||
|
// #FIX: Make it visible, since it is possible that it was hidden previously.
|
||||||
_sectionTitles.append(data.titleWidget);
|
_sectionTitles.append(data.titleWidget);
|
||||||
_tabsLayout->insertWidget(_tabsLayout->count() - 2, data.titleWidget);
|
_tabsLayout->insertWidget(_tabsLayout->count() - 2, data.titleWidget);
|
||||||
|
data.titleWidget->setVisible(true);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
|
QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
|
||||||
#else
|
#else
|
||||||
QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
|
QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Add content-widget to stack.
|
||||||
|
// Visibility is managed by QStackedWidget.
|
||||||
_sectionContents.append(data.contentWidget);
|
_sectionContents.append(data.contentWidget);
|
||||||
_contentsLayout->addWidget(data.contentWidget);
|
_contentsLayout->addWidget(data.contentWidget);
|
||||||
|
|
||||||
// Active first TAB.
|
// Activate first TAB.
|
||||||
if (_contents.size() == 1)
|
if (_contents.size() == 1)
|
||||||
setCurrentIndex(0);
|
setCurrentIndex(0);
|
||||||
// Switch to newest.
|
// Switch to just added TAB.
|
||||||
else if (autoActivate)
|
else if (autoActivate)
|
||||||
setCurrentIndex(_contents.count() - 1);
|
setCurrentIndex(_contents.count() - 1);
|
||||||
// Mark is as inactive tab.
|
// Mark it as inactive tab.
|
||||||
else
|
else
|
||||||
data.titleWidget->setActiveTab(false); // or: setCurrentIndex(currentIndex())
|
data.titleWidget->setActiveTab(false); // or: setCurrentIndex(currentIndex())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user