From 94d8fe3e2502ebefd091961f3cef2e3d2b4ddc1c Mon Sep 17 00:00:00 2001 From: mfreiholz Date: Fri, 4 Mar 2016 06:50:22 +0100 Subject: [PATCH] Fixes invisible SectionWidget TAB, if the content was hidden previously, by calling setvisible(true) on title-widget - content-widget is managed by QStackedWidget. --- AdvancedDockingSystem/src/SectionWidget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/AdvancedDockingSystem/src/SectionWidget.cpp b/AdvancedDockingSystem/src/SectionWidget.cpp index 7cd1c34..3c50cc0 100644 --- a/AdvancedDockingSystem/src/SectionWidget.cpp +++ b/AdvancedDockingSystem/src/SectionWidget.cpp @@ -143,24 +143,29 @@ void SectionWidget::addContent(const InternalContentData& data, bool autoActivat { _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); _tabsLayout->insertWidget(_tabsLayout->count() - 2, data.titleWidget); + data.titleWidget->setVisible(true); #if QT_VERSION >= 0x050000 QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked); #else QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked())); #endif + // Add content-widget to stack. + // Visibility is managed by QStackedWidget. _sectionContents.append(data.contentWidget); _contentsLayout->addWidget(data.contentWidget); - // Active first TAB. + // Activate first TAB. if (_contents.size() == 1) setCurrentIndex(0); - // Switch to newest. + // Switch to just added TAB. else if (autoActivate) setCurrentIndex(_contents.count() - 1); - // Mark is as inactive tab. + // Mark it as inactive tab. else data.titleWidget->setActiveTab(false); // or: setCurrentIndex(currentIndex()) }