From ad49745b18100a83055503d6e1fc98964c2a87c5 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Wed, 22 Feb 2017 22:33:48 +0100 Subject: [PATCH] Refactorings to improve code, started to refactor secion content --- AdvancedDockingSystem/include/ads/API.h | 4 +- .../include/ads/ContainerWidget.h | 8 +- .../include/ads/FloatingWidget.h | 16 +- AdvancedDockingSystem/include/ads/Internal.h | 4 +- .../include/ads/MainContainerWidget.h | 7 +- .../include/ads/SectionContent.h | 16 +- .../include/ads/SectionContentWidget.h | 57 ++++++- .../include/ads/SectionTitleWidget.h | 6 +- .../include/ads/SectionWidget.h | 12 +- AdvancedDockingSystem/src/API.cpp | 2 +- AdvancedDockingSystem/src/ContainerWidget.cpp | 22 +-- AdvancedDockingSystem/src/FloatingWidget.cpp | 12 +- .../src/MainContainerWidget.cpp | 54 +++---- AdvancedDockingSystem/src/SectionContent.cpp | 28 ++-- .../src/SectionContentWidget.cpp | 140 +++++++++++++++++- .../src/SectionTitleWidget.cpp | 13 +- AdvancedDockingSystem/src/SectionWidget.cpp | 8 +- .../src/dialogs/SectionContentListModel.cpp | 8 +- .../src/dialogs/SectionContentListModel.h | 6 +- .../src/dialogs/SectionContentListWidget.h | 2 +- AdvancedDockingSystemDemo/src/mainwindow.cpp | 14 +- AdvancedDockingSystemDemo/src/mainwindow.h | 2 +- 22 files changed, 301 insertions(+), 140 deletions(-) diff --git a/AdvancedDockingSystem/include/ads/API.h b/AdvancedDockingSystem/include/ads/API.h index 07716cf..6b5d55d 100644 --- a/AdvancedDockingSystem/include/ads/API.h +++ b/AdvancedDockingSystem/include/ads/API.h @@ -65,7 +65,7 @@ class QSplitter; //#define ADS_ANIMATION_DURATION 150 ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; class SectionWidget; enum DropArea @@ -82,7 +82,7 @@ enum DropArea }; Q_DECLARE_FLAGS(DropAreas, DropArea) -void deleteEmptySplitter(MainContainerWidget* container); +void deleteEmptySplitter(CMainContainerWidget* container); QSplitter* findParentSplitter(QWidget* w); QSplitter* findImmediateSplitter(QWidget* w); diff --git a/AdvancedDockingSystem/include/ads/ContainerWidget.h b/AdvancedDockingSystem/include/ads/ContainerWidget.h index 09b68a2..7230179 100644 --- a/AdvancedDockingSystem/include/ads/ContainerWidget.h +++ b/AdvancedDockingSystem/include/ads/ContainerWidget.h @@ -35,7 +35,7 @@ namespace ads class SectionWidget; class DropOverlay; class InternalContentData; -class MainContainerWidget; +class CMainContainerWidget; /** * @brief @@ -51,7 +51,7 @@ class CContainerWidget : public QFrame friend class ContainerWidgetPrivate; public: - explicit CContainerWidget(MainContainerWidget* MainContainerWidget, QWidget *parent = nullptr); + explicit CContainerWidget(CMainContainerWidget* MainContainerWidget, QWidget *parent = nullptr); virtual ~CContainerWidget(); /** @@ -82,7 +82,7 @@ public: void dumpLayout(); - MainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} + CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} void addSectionWidget(SectionWidget* section); @@ -112,7 +112,7 @@ protected: QPointer m_Splitter; // $mfreiholz: I'd like to remove this variable entirely, // because it changes during user interaction anyway. - MainContainerWidget* m_MainContainerWidget = 0; + CMainContainerWidget* m_MainContainerWidget = 0; unsigned int m_zOrderIndex = 0; static unsigned int zOrderCounter; diff --git a/AdvancedDockingSystem/include/ads/FloatingWidget.h b/AdvancedDockingSystem/include/ads/FloatingWidget.h index 31e8d1e..5b4656c 100644 --- a/AdvancedDockingSystem/include/ads/FloatingWidget.h +++ b/AdvancedDockingSystem/include/ads/FloatingWidget.h @@ -25,9 +25,9 @@ class QBoxLayout; #include "ads/SectionContent.h" ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; class SectionTitleWidget; -class SectionContentWidget; +class CSectionContentWidget; class InternalContentData; class SectionWidget; class CContainerWidget; @@ -40,7 +40,7 @@ private: QPoint m_DragStartPosition; QPoint m_DragStartMousePosition; FloatingWidget* floatingWidget() const; - MainContainerWidget* mainContainerWidget() const; + CMainContainerWidget* mainContainerWidget() const; void moveFloatingWidget(QMouseEvent* ev); private slots: @@ -65,12 +65,12 @@ class FloatingWidget : public QWidget { Q_OBJECT - friend class MainContainerWidget; + friend class CMainContainerWidget; friend class CFloatingTitleWidget; public: - FloatingWidget(MainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, SectionContentWidget* contentWidget, QWidget* parent = NULL); - FloatingWidget(MainContainerWidget* container, SectionWidget* sectionWidget); + FloatingWidget(CMainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent = NULL); + FloatingWidget(CMainContainerWidget* container, SectionWidget* sectionWidget); virtual ~FloatingWidget(); /** @@ -79,7 +79,7 @@ public: unsigned int zOrderIndex() const; CContainerWidget* containerWidget() const {return m_ContainerWidget;} - MainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} + CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} public://private: bool takeContent(InternalContentData& data); @@ -100,7 +100,7 @@ private slots: private: void setDraggingActive(bool Active); - MainContainerWidget* m_MainContainerWidget; + CMainContainerWidget* m_MainContainerWidget; CContainerWidget* m_ContainerWidget; CContainerWidget* m_DropContainer; bool m_DraggingActive = false; diff --git a/AdvancedDockingSystem/include/ads/Internal.h b/AdvancedDockingSystem/include/ads/Internal.h index 3a6d688..c73733a 100644 --- a/AdvancedDockingSystem/include/ads/Internal.h +++ b/AdvancedDockingSystem/include/ads/Internal.h @@ -31,7 +31,7 @@ ADS_NAMESPACE_BEGIN class SectionContent; class SectionTitleWidget; -class SectionContentWidget; +class CSectionContentWidget; class InternalContentData @@ -45,7 +45,7 @@ public: QSharedPointer content; SectionTitleWidget* titleWidget; - SectionContentWidget* contentWidget; + CSectionContentWidget* contentWidget; }; diff --git a/AdvancedDockingSystem/include/ads/MainContainerWidget.h b/AdvancedDockingSystem/include/ads/MainContainerWidget.h index 2dd30c8..8f86ad1 100644 --- a/AdvancedDockingSystem/include/ads/MainContainerWidget.h +++ b/AdvancedDockingSystem/include/ads/MainContainerWidget.h @@ -46,7 +46,7 @@ class InternalContentData; * ContainerWidget is the main container to provide the docking * functionality. It manages multiple sections with all possible areas. */ -class ADS_EXPORT_API MainContainerWidget : public CContainerWidget +class ADS_EXPORT_API CMainContainerWidget : public CContainerWidget { Q_OBJECT @@ -57,10 +57,11 @@ class ADS_EXPORT_API MainContainerWidget : public CContainerWidget friend class ContainerWidgetPrivate; friend class CFloatingTitleWidget; friend class CContainerWidget; + friend class CSectionContentWidget; public: - explicit MainContainerWidget(QWidget *parent = nullptr); - virtual ~MainContainerWidget(); + explicit CMainContainerWidget(QWidget *parent = nullptr); + virtual ~CMainContainerWidget(); // // Public API diff --git a/AdvancedDockingSystem/include/ads/SectionContent.h b/AdvancedDockingSystem/include/ads/SectionContent.h index 95c9548..83193c9 100644 --- a/AdvancedDockingSystem/include/ads/SectionContent.h +++ b/AdvancedDockingSystem/include/ads/SectionContent.h @@ -25,11 +25,11 @@ class QWidget; #include "ads/API.h" ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; class ADS_EXPORT_API SectionContent { - friend class MainContainerWidget; + friend class CMainContainerWidget; private: SectionContent(); @@ -58,13 +58,13 @@ public: * \param content The widget to use as content. * \return May return a invalid ref-pointer in case of invalid parameters. */ - static RefPtr newSectionContent(const QString& uniqueName, MainContainerWidget* container, QWidget* title, QWidget* content); + static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content); virtual ~SectionContent(); int uid() const; QString uniqueName() const; - MainContainerWidget* containerWidget() const; - QWidget* titleWidget() const; + CMainContainerWidget* containerWidget() const; + QWidget* titleWidgetContent() const; QWidget* contentWidget() const; Flags flags() const; @@ -77,9 +77,9 @@ private: const int _uid; QString _uniqueName; - QPointer _containerWidget; - QPointer _titleWidget; - QPointer _contentWidget; + QPointer m_MainContainerWidget; + QPointer m_TitleWidgetContent; + QPointer m_ContentWidget; // Optional attributes QString _title; diff --git a/AdvancedDockingSystem/include/ads/SectionContentWidget.h b/AdvancedDockingSystem/include/ads/SectionContentWidget.h index caa5c22..718f653 100644 --- a/AdvancedDockingSystem/include/ads/SectionContentWidget.h +++ b/AdvancedDockingSystem/include/ads/SectionContentWidget.h @@ -22,23 +22,64 @@ #include "ads/API.h" #include "ads/SectionContent.h" -ADS_NAMESPACE_BEGIN -class MainContainerWidget; +namespace ads +{ +class CMainContainerWidget; class SectionWidget; +class SectionTitleWidget; -class SectionContentWidget : public QFrame + +struct SectionContentWidgetPrivate; + + +class CSectionContentWidget : public QFrame { Q_OBJECT - - friend class MainContainerWidget; +private: + SectionContentWidgetPrivate* d; + friend class SectionContentWidgetPrivate; + friend class CMainContainerWidget; public: - SectionContentWidget(SectionContent::RefPtr c, QWidget* parent = 0); - virtual ~SectionContentWidget(); + enum Flag + { + None = 0, + Closeable = 1, + Maximizable = 2, + AllFlags = Closeable | Maximizable + }; + Q_DECLARE_FLAGS(Flags, Flag) + + CSectionContentWidget(SectionContent::RefPtr c = SectionContent::RefPtr(), QWidget* parent = 0); + virtual ~CSectionContentWidget(); + + /*! + * Creates new content, associates it to container and takes ownership of + * title- and content- widgets. + * \param uniqueName An unique identifier across the entire process. + * \param container The parent ContainerWidget in which this content will be active. + * \param title The widget to use as title. + * \param content The widget to use as content. + * \return May return a invalid ref-pointer in case of invalid parameters. + */ + static CSectionContentWidget* newSectionContent(const QString& uniqueName, + CMainContainerWidget* container, QWidget* title, QWidget* content); + + int uid() const; + QString uniqueName() const; + CMainContainerWidget* containerWidget() const; + QWidget* titleWidgetContent() const; + QWidget* contentWidget() const; + Flags flags() const; + + QString visibleTitle() const; + QString title() const; + void setTitle(const QString& title); + void setFlags(const Flags f); private: SectionContent::RefPtr _content; }; -ADS_NAMESPACE_END +} // namespace ads #endif diff --git a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h b/AdvancedDockingSystem/include/ads/SectionTitleWidget.h index fe5b3c8..c4b1f35 100644 --- a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h +++ b/AdvancedDockingSystem/include/ads/SectionTitleWidget.h @@ -27,7 +27,7 @@ class QPushButton; ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; class SectionWidget; class FloatingWidget; @@ -36,7 +36,7 @@ class SectionTitleWidget : public QFrame Q_OBJECT Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged) - friend class MainContainerWidget; + friend class CMainContainerWidget; friend class SectionWidget; friend class CContainerWidget; @@ -66,7 +66,7 @@ protected: virtual void mouseMoveEvent(QMouseEvent* ev); private: - void startFloating(QMouseEvent* ev, MainContainerWidget* cw, SectionWidget* sectionwidget); + void startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget); void moveTab(QMouseEvent* ev); signals: diff --git a/AdvancedDockingSystem/include/ads/SectionWidget.h b/AdvancedDockingSystem/include/ads/SectionWidget.h index a049430..9729968 100644 --- a/AdvancedDockingSystem/include/ads/SectionWidget.h +++ b/AdvancedDockingSystem/include/ads/SectionWidget.h @@ -33,9 +33,9 @@ class QMenu; #include "ads/FloatingWidget.h" ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; class SectionTitleWidget; -class SectionContentWidget; +class CSectionContentWidget; // SectionWidget manages multiple instances of SectionContent. // It displays a title TAB, which is clickable and will switch to @@ -43,10 +43,10 @@ class SectionContentWidget; class ADS_EXPORT_API SectionWidget : public QFrame { Q_OBJECT - friend class MainContainerWidget; + friend class CMainContainerWidget; friend class CContainerWidget; - explicit SectionWidget(MainContainerWidget* MainContainer, CContainerWidget* parent); + explicit SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent); public: virtual ~SectionWidget(); @@ -88,10 +88,10 @@ private slots: private: const int _uid; - QPointer m_MainContainerWidget; + QPointer m_MainContainerWidget; QList m_Contents; QList m_TitleWidgets; - QList m_ContentWidgets; + QList m_ContentWidgets; QBoxLayout* _topLayout; QScrollArea* _tabsScrollArea; diff --git a/AdvancedDockingSystem/src/API.cpp b/AdvancedDockingSystem/src/API.cpp index 2b0593a..dbf654a 100644 --- a/AdvancedDockingSystem/src/API.cpp +++ b/AdvancedDockingSystem/src/API.cpp @@ -44,7 +44,7 @@ static bool splitterContainsSectionWidget(QSplitter* splitter) return false; } -void deleteEmptySplitter(MainContainerWidget* container) +void deleteEmptySplitter(CMainContainerWidget* container) { bool doAgain = false; do diff --git a/AdvancedDockingSystem/src/ContainerWidget.cpp b/AdvancedDockingSystem/src/ContainerWidget.cpp index c5d11ba..b6f2f0b 100644 --- a/AdvancedDockingSystem/src/ContainerWidget.cpp +++ b/AdvancedDockingSystem/src/ContainerWidget.cpp @@ -20,6 +20,8 @@ //============================================================================ // INCLUDES //============================================================================ +#include +#include #include "ads/ContainerWidget.h" #include @@ -39,17 +41,15 @@ #include "ads/Internal.h" #include "ads/SectionWidget.h" #include "ads/SectionTitleWidget.h" -#include "ads/SectionContentWidget.h" #include "ads/DropOverlay.h" #include "ads/Serialization.h" -#include "ads/MainContainerWidget.h" namespace ads { unsigned int CContainerWidget::zOrderCounter = 0; //============================================================================ -CContainerWidget::CContainerWidget(MainContainerWidget* MainContainer, QWidget *parent) +CContainerWidget::CContainerWidget(CMainContainerWidget* MainContainer, QWidget *parent) : QFrame(parent), m_MainContainerWidget(MainContainer) { @@ -185,7 +185,7 @@ void CContainerWidget::dropIntoContainer(FloatingWidget* FloatingWidget, DropAre { std::cout << "Create new splitter" << std::endl; // we have no splitter yet - let us create one - QSplitter* sp = MainContainerWidget::newSplitter(FloatingMainSplitter->orientation()); + QSplitter* sp = CMainContainerWidget::newSplitter(FloatingMainSplitter->orientation()); if (l->count() > 0) { qWarning() << "Still items in layout. This should never happen."; @@ -221,7 +221,7 @@ void CContainerWidget::dropIntoContainer(FloatingWidget* FloatingWidget, DropAre { std::cout << "Splitter with wrong orientation" << std::endl; // we have a splitter but with the wrong orientation - QSplitter* sp = MainContainerWidget::newSplitter(orientation); + QSplitter* sp = CMainContainerWidget::newSplitter(orientation); if (append) { QLayoutItem* li = l->replaceWidget(OldSplitter, sp); @@ -313,7 +313,7 @@ void CContainerWidget::dropIntoSection(FloatingWidget* FloatingWidget, else { std::cout << "targetSectionSplitter->orientation() != Orientation" << std::endl; - QSplitter* s = MainContainerWidget::newSplitter(Orientation); + QSplitter* s = CMainContainerWidget::newSplitter(Orientation); if (FloatingMainSplitter->orientation() == Orientation || FloatingMainSplitter->count() == 1) { std::cout << "FloatingMainSplitter->orientation() == Orientation || FloatingMainSplitter->count() == 1" << std::endl; @@ -431,7 +431,7 @@ void CContainerWidget::addSectionWidget(SectionWidget* section) // Create default splitter. if (!m_Splitter) { - m_Splitter = MainContainerWidget::newSplitter(m_Orientation); + m_Splitter = CMainContainerWidget::newSplitter(m_Orientation); m_MainLayout->addWidget(m_Splitter, 0, 0); } if (m_Splitter->indexOf(section) != -1) @@ -459,7 +459,7 @@ SectionWidget* CContainerWidget::dropContentOuterHelper(QLayout* l, const Intern QSplitter* oldsp = findImmediateSplitter(this); if (!oldsp) { - QSplitter* sp = MainContainerWidget::newSplitter(orientation); + QSplitter* sp = CMainContainerWidget::newSplitter(orientation); if (l->count() > 0) { qWarning() << "Still items in layout. This should never happen."; @@ -480,7 +480,7 @@ SectionWidget* CContainerWidget::dropContentOuterHelper(QLayout* l, const Intern } else { - QSplitter* sp = MainContainerWidget::newSplitter(orientation); + QSplitter* sp = CMainContainerWidget::newSplitter(orientation); if (append) { QLayoutItem* li = l->replaceWidget(oldsp, sp); @@ -514,7 +514,7 @@ SectionWidget* CContainerWidget::insertNewSectionWidget( else { const int index = targetSectionSplitter->indexOf(targetSection); - QSplitter* s = MainContainerWidget::newSplitter(Orientation); + QSplitter* s = CMainContainerWidget::newSplitter(Orientation); s->addWidget(sw); s->addWidget(targetSection); targetSectionSplitter->insertWidget(index, s); @@ -531,7 +531,7 @@ SectionWidget* CContainerWidget::addSectionContent(const SectionContent::RefPtr& InternalContentData data; data.content = sc; data.titleWidget = new SectionTitleWidget(sc, NULL); - data.contentWidget = new SectionContentWidget(sc, NULL); + data.contentWidget = new CSectionContentWidget(sc, NULL); connect(data.titleWidget, SIGNAL(activeTabChanged()), this, SLOT(onActiveTabChanged())); return dropContent(data, sw, area, false); diff --git a/AdvancedDockingSystem/src/FloatingWidget.cpp b/AdvancedDockingSystem/src/FloatingWidget.cpp index d1f9aea..a5436ed 100644 --- a/AdvancedDockingSystem/src/FloatingWidget.cpp +++ b/AdvancedDockingSystem/src/FloatingWidget.cpp @@ -17,6 +17,7 @@ ******************************************************************************/ #include +#include #include "ads/FloatingWidget.h" #include @@ -28,7 +29,6 @@ #include #include "ads/SectionTitleWidget.h" -#include "ads/SectionContentWidget.h" #include "ads/Internal.h" #include "ads/SectionWidget.h" #include "ads/ContainerWidget.h" @@ -92,7 +92,7 @@ FloatingWidget* CFloatingTitleWidget::floatingWidget() const return dynamic_cast(parentWidget()); } -MainContainerWidget* CFloatingTitleWidget::mainContainerWidget() const +CMainContainerWidget* CFloatingTitleWidget::mainContainerWidget() const { return floatingWidget()->mainContainerWidget(); } @@ -154,7 +154,7 @@ void CFloatingTitleWidget::onMaximizeButtonClicked() -FloatingWidget::FloatingWidget(MainContainerWidget* MainContainer, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, SectionContentWidget* contentWidget, QWidget* parent) : +FloatingWidget::FloatingWidget(CMainContainerWidget* MainContainer, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent) : QWidget(MainContainer, Qt::Window), m_MainContainerWidget(MainContainer) { @@ -178,7 +178,7 @@ FloatingWidget::FloatingWidget(MainContainerWidget* MainContainer, SectionConten } -FloatingWidget::FloatingWidget(MainContainerWidget* MainContainer, SectionWidget* sectionWidget) +FloatingWidget::FloatingWidget(CMainContainerWidget* MainContainer, SectionWidget* sectionWidget) : QWidget(MainContainer, Qt::Window), m_MainContainerWidget(MainContainer) { @@ -338,7 +338,7 @@ void FloatingWidget::titleMouseReleaseEvent() } std::cout << "Dropped" << std::endl; - MainContainerWidget* MainContainerWidget = mainContainerWidget(); + CMainContainerWidget* MainContainerWidget = mainContainerWidget(); m_DropContainer->dropFloatingWidget(this, QCursor::pos()); MainContainerWidget->dropOverlay()->hideDropOverlay(); MainContainerWidget->sectionDropOverlay()->hideDropOverlay(); @@ -357,7 +357,7 @@ void FloatingWidget::updateDropOverlays(const QPoint& GlobalPos) { return; } - MainContainerWidget* MainContainerWidget = mainContainerWidget(); + CMainContainerWidget* MainContainerWidget = mainContainerWidget(); auto Containers = MainContainerWidget->m_Containers; CContainerWidget* TopContainer = nullptr; for (auto ContainerWidget : Containers) diff --git a/AdvancedDockingSystem/src/MainContainerWidget.cpp b/AdvancedDockingSystem/src/MainContainerWidget.cpp index c363bb3..1941054 100644 --- a/AdvancedDockingSystem/src/MainContainerWidget.cpp +++ b/AdvancedDockingSystem/src/MainContainerWidget.cpp @@ -16,7 +16,7 @@ ** along with this program. If not, see . ******************************************************************************/ -#include +#include #include #include #include @@ -32,16 +32,16 @@ #include "ads/Internal.h" #include "ads/SectionWidget.h" #include "ads/SectionTitleWidget.h" -#include "ads/SectionContentWidget.h" #include "ads/DropOverlay.h" #include "ads/Serialization.h" #include +#include "../include/ads/MainContainerWidget.h" ADS_NAMESPACE_BEGIN -QSplitter* MainContainerWidget::newSplitter(Qt::Orientation orientation, QWidget* parent) +QSplitter* CMainContainerWidget::newSplitter(Qt::Orientation orientation, QWidget* parent) { QSplitter* s = new QSplitter(orientation, parent); s->setProperty("ads-splitter", QVariant(true)); @@ -51,7 +51,7 @@ QSplitter* MainContainerWidget::newSplitter(Qt::Orientation orientation, QWidget } -MainContainerWidget::MainContainerWidget(QWidget *parent) : +CMainContainerWidget::CMainContainerWidget(QWidget *parent) : CContainerWidget(this, parent) { m_SectionDropOverlay = new DropOverlay(this, DropOverlay::ModeSectionOverlay); @@ -61,7 +61,7 @@ MainContainerWidget::MainContainerWidget(QWidget *parent) : m_Containers.append(this); } -MainContainerWidget::~MainContainerWidget() +CMainContainerWidget::~CMainContainerWidget() { // Note: It's required to delete in 2 steps // Remove from list, and then delete. @@ -83,7 +83,7 @@ MainContainerWidget::~MainContainerWidget() } -bool MainContainerWidget::removeSectionContent(const SectionContent::RefPtr& sc) +bool CMainContainerWidget::removeSectionContent(const SectionContent::RefPtr& sc) { ADS_Expects(!sc.isNull()); @@ -128,7 +128,7 @@ bool MainContainerWidget::removeSectionContent(const SectionContent::RefPtr& sc) return true; } -bool MainContainerWidget::showSectionContent(const SectionContent::RefPtr& sc) +bool CMainContainerWidget::showSectionContent(const SectionContent::RefPtr& sc) { ADS_Expects(!sc.isNull()); @@ -183,7 +183,7 @@ bool MainContainerWidget::showSectionContent(const SectionContent::RefPtr& sc) return false; } -bool MainContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc) +bool CMainContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc) { ADS_Expects(!sc.isNull()); @@ -239,7 +239,7 @@ bool MainContainerWidget::hideSectionContent(const SectionContent::RefPtr& sc) return false; } -bool MainContainerWidget::raiseSectionContent(const SectionContent::RefPtr& sc) +bool CMainContainerWidget::raiseSectionContent(const SectionContent::RefPtr& sc) { ADS_Expects(!sc.isNull()); @@ -273,7 +273,7 @@ bool MainContainerWidget::raiseSectionContent(const SectionContent::RefPtr& sc) return false; } -bool MainContainerWidget::isSectionContentVisible(const SectionContent::RefPtr& sc) +bool CMainContainerWidget::isSectionContentVisible(const SectionContent::RefPtr& sc) { ADS_Expects(!sc.isNull()); @@ -304,7 +304,7 @@ bool MainContainerWidget::isSectionContentVisible(const SectionContent::RefPtr& return false; } -QMenu* MainContainerWidget::createContextMenu() const +QMenu* CMainContainerWidget::createContextMenu() const { // Fill map with actions (sorted by key!) QMap actions; @@ -367,7 +367,7 @@ QMenu* MainContainerWidget::createContextMenu() const return m; } -QByteArray MainContainerWidget::saveState() const +QByteArray CMainContainerWidget::saveState() const { ADS_NS_SER::InMemoryWriter writer; @@ -390,7 +390,7 @@ QByteArray MainContainerWidget::saveState() const return writer.toByteArray(); } -bool MainContainerWidget::restoreState(const QByteArray& data) +bool CMainContainerWidget::restoreState(const QByteArray& data) { if (data.isEmpty()) return false; @@ -409,7 +409,7 @@ bool MainContainerWidget::restoreState(const QByteArray& data) } -QList MainContainerWidget::contents() const +QList CMainContainerWidget::contents() const { QList wl = m_SectionContentIdMap.values(); QList sl; @@ -422,13 +422,13 @@ QList MainContainerWidget::contents() const return sl; } -QPointer MainContainerWidget::sectionDropOverlay() const +QPointer CMainContainerWidget::sectionDropOverlay() const { return m_SectionDropOverlay; } -QPointer MainContainerWidget::dropOverlay() const +QPointer CMainContainerWidget::dropOverlay() const { return m_ContainerDropOverlay; } @@ -437,7 +437,7 @@ QPointer MainContainerWidget::dropOverlay() const // PRIVATE API BEGINS HERE /////////////////////////////////////////////////////////////////////// -QByteArray MainContainerWidget::saveHierarchy() const +QByteArray CMainContainerWidget::saveHierarchy() const { /* # Data Format @@ -524,7 +524,7 @@ QByteArray MainContainerWidget::saveHierarchy() const return ba; } -void MainContainerWidget::saveFloatingWidgets(QDataStream& out) const +void CMainContainerWidget::saveFloatingWidgets(QDataStream& out) const { out << m_Floatings.count(); for (int i = 0; i < m_Floatings.count(); ++i) @@ -536,7 +536,7 @@ void MainContainerWidget::saveFloatingWidgets(QDataStream& out) const } } -void MainContainerWidget::saveSectionWidgets(QDataStream& out, QWidget* widget) const +void CMainContainerWidget::saveSectionWidgets(QDataStream& out, QWidget* widget) const { QSplitter* sp = NULL; SectionWidget* sw = NULL; @@ -599,7 +599,7 @@ void MainContainerWidget::saveSectionWidgets(QDataStream& out, QWidget* widget) } } -bool MainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) const +bool CMainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) const { if (m_Sections.count() <= 0) return false; @@ -627,7 +627,7 @@ bool MainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) co return true; } -bool MainContainerWidget::restoreHierarchy(const QByteArray& data) +bool CMainContainerWidget::restoreHierarchy(const QByteArray& data) { QDataStream in(data); in.setVersion(QDataStream::Qt_4_5); @@ -795,7 +795,7 @@ bool MainContainerWidget::restoreHierarchy(const QByteArray& data) return success; } -bool MainContainerWidget::restoreFloatingWidgets(QDataStream& in, int version, QList& floatings) +bool CMainContainerWidget::restoreFloatingWidgets(QDataStream& in, int version, QList& floatings) { Q_UNUSED(version) @@ -838,7 +838,7 @@ bool MainContainerWidget::restoreFloatingWidgets(QDataStream& in, int version, Q return true; } -bool MainContainerWidget::restoreSectionWidgets(QDataStream& in, int version, QSplitter* currentSplitter, QList& sections, QList& contentsToHide) +bool CMainContainerWidget::restoreSectionWidgets(QDataStream& in, int version, QSplitter* currentSplitter, QList& sections, QList& contentsToHide) { if (in.atEnd()) return true; @@ -936,7 +936,7 @@ bool MainContainerWidget::restoreSectionWidgets(QDataStream& in, int version, QS return true; } -bool MainContainerWidget::takeContent(const SectionContent::RefPtr& sc, InternalContentData& data) +bool CMainContainerWidget::takeContent(const SectionContent::RefPtr& sc, InternalContentData& data) { ADS_Expects(!sc.isNull()); @@ -967,7 +967,7 @@ bool MainContainerWidget::takeContent(const SectionContent::RefPtr& sc, Internal } -void MainContainerWidget::onActionToggleSectionContentVisibility(bool visible) +void CMainContainerWidget::onActionToggleSectionContentVisibility(bool visible) { QAction* a = qobject_cast(sender()); if (!a) @@ -986,13 +986,13 @@ void MainContainerWidget::onActionToggleSectionContentVisibility(bool visible) } -void MainContainerWidget::hideContainerOverlay() +void CMainContainerWidget::hideContainerOverlay() { m_ContainerDropOverlay->hideDropOverlay(); } -void MainContainerWidget::moveFloatingWidget(const QPoint& TargetPos) +void CMainContainerWidget::moveFloatingWidget(const QPoint& TargetPos) { QPoint MousePos = mapFromGlobal(QCursor::pos()); diff --git a/AdvancedDockingSystem/src/SectionContent.cpp b/AdvancedDockingSystem/src/SectionContent.cpp index 33d4ff4..a42b211 100644 --- a/AdvancedDockingSystem/src/SectionContent.cpp +++ b/AdvancedDockingSystem/src/SectionContent.cpp @@ -32,7 +32,7 @@ SectionContent::SectionContent() : { } -SectionContent::RefPtr SectionContent::newSectionContent(const QString& uniqueName, MainContainerWidget* container, QWidget* title, QWidget* content) +SectionContent::RefPtr SectionContent::newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content) { auto SectionContentNameMap = container->m_SectionContentNameMap; auto SectionContentIdMap = container->m_SectionContentIdMap; @@ -55,9 +55,9 @@ SectionContent::RefPtr SectionContent::newSectionContent(const QString& uniqueNa QSharedPointer sc(new SectionContent()); sc->_uniqueName = uniqueName; - sc->_containerWidget = container; - sc->_titleWidget = title; - sc->_contentWidget = content; + sc->m_MainContainerWidget = container; + sc->m_TitleWidgetContent = title; + sc->m_ContentWidget = content; SectionContentIdMap.insert(sc->uid(), sc); SectionContentNameMap.insert(sc->uniqueName(), sc); @@ -66,16 +66,16 @@ SectionContent::RefPtr SectionContent::newSectionContent(const QString& uniqueNa SectionContent::~SectionContent() { - auto SectionContentNameMap = _containerWidget->m_SectionContentNameMap; - auto SectionContentIdMap = _containerWidget->m_SectionContentIdMap; + auto SectionContentNameMap = m_MainContainerWidget->m_SectionContentNameMap; + auto SectionContentIdMap = m_MainContainerWidget->m_SectionContentIdMap; - if (_containerWidget) + if (m_MainContainerWidget) { SectionContentIdMap.remove(_uid); SectionContentNameMap.remove(_uniqueName); } - delete _titleWidget; - delete _contentWidget; + delete m_TitleWidgetContent; + delete m_ContentWidget; } int SectionContent::uid() const @@ -88,19 +88,19 @@ QString SectionContent::uniqueName() const return _uniqueName; } -MainContainerWidget* SectionContent::containerWidget() const +CMainContainerWidget* SectionContent::containerWidget() const { - return _containerWidget; + return m_MainContainerWidget; } -QWidget* SectionContent::titleWidget() const +QWidget* SectionContent::titleWidgetContent() const { - return _titleWidget; + return m_TitleWidgetContent; } QWidget* SectionContent::contentWidget() const { - return _contentWidget; + return m_ContentWidget; } SectionContent::Flags SectionContent::flags() const diff --git a/AdvancedDockingSystem/src/SectionContentWidget.cpp b/AdvancedDockingSystem/src/SectionContentWidget.cpp index 8d3e9ad..4cb0b0e 100644 --- a/AdvancedDockingSystem/src/SectionContentWidget.cpp +++ b/AdvancedDockingSystem/src/SectionContentWidget.cpp @@ -16,14 +16,49 @@ ** along with this program. If not, see . ******************************************************************************/ -#include "ads/SectionContentWidget.h" - +#include #include +#include "../include/ads/SectionContentWidget.h" +#include "../include/ads/SectionTitleWidget.h" -ADS_NAMESPACE_BEGIN +namespace ads +{ +struct SectionContentWidgetPrivate +{ + CSectionContentWidget* _this; + int Uid; + QString UniqueName; + QPointer MainContainerWidget; + QPointer TitleWidgetContent; + QPointer ContentWidget; + // Optional attributes + QString Title; + CSectionContentWidget::Flags Flags = CSectionContentWidget::AllFlags; -SectionContentWidget::SectionContentWidget(SectionContent::RefPtr c, QWidget* parent) : + + + /* Note: This method could be a problem in static build environment + * since it may begin with 0 for every module which uses ADS. + */ + static int GetNextUid() + { + static int NextUid = 0; + return ++NextUid; + } + + + SectionContentWidgetPrivate(CSectionContentWidget* _public) + : _this(_public), + Uid(GetNextUid()) + { + + } +}; + + +CSectionContentWidget::CSectionContentWidget(SectionContent::RefPtr c, QWidget* parent) : QFrame(parent), + d(new SectionContentWidgetPrivate(this)), _content(c) { QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom); @@ -33,9 +68,100 @@ SectionContentWidget::SectionContentWidget(SectionContent::RefPtr c, QWidget* pa setLayout(l); } -SectionContentWidget::~SectionContentWidget() + +CSectionContentWidget* CSectionContentWidget::newSectionContent(const QString& uniqueName, + CMainContainerWidget* container, QWidget* title, QWidget* content) { - layout()->removeWidget(_content->contentWidget()); + auto SectionContentNameMap = container->m_SectionContentNameMap; + auto SectionContentIdMap = container->m_SectionContentIdMap; + + if (uniqueName.isEmpty()) + { + qFatal("Can not create SectionContent with empty uniqueName"); + return nullptr; + } + else if (SectionContentNameMap.contains(uniqueName)) + { + qFatal("Can not create SectionContent with already used uniqueName"); + return nullptr; + } + else if (!container || !title || !content) + { + qFatal("Can not create SectionContent with NULL values"); + return nullptr; + } + + CSectionContentWidget* sc(new CSectionContentWidget()); + sc->d->UniqueName = uniqueName; + sc->d->MainContainerWidget = container; + sc->d->TitleWidgetContent = title; + sc->d->ContentWidget = content; + + //SectionContentIdMap.insert(sc->uid(), sc); + //SectionContentNameMap.insert(sc->uniqueName(), sc); + return sc; } -ADS_NAMESPACE_END +CSectionContentWidget::~CSectionContentWidget() +{ + layout()->removeWidget(_content->contentWidget()); + delete d; +} + + +int CSectionContentWidget::uid() const +{ + return d->Uid; +} + + +QString CSectionContentWidget::uniqueName() const +{ + return d->UniqueName; +} + + +CMainContainerWidget* CSectionContentWidget::containerWidget() const +{ + return d->MainContainerWidget; +} + +QWidget* CSectionContentWidget::titleWidgetContent() const +{ + return d->TitleWidgetContent.data(); +} + + +QWidget* CSectionContentWidget::contentWidget() const +{ + return d->ContentWidget; +} + +CSectionContentWidget::Flags CSectionContentWidget::flags() const +{ + return d->Flags; +} + + +QString CSectionContentWidget::visibleTitle() const +{ + return d->Title.isEmpty() ? d->UniqueName : d->Title; +} + + +QString CSectionContentWidget::title() const +{ + return d->Title; +} + +void CSectionContentWidget::setTitle(const QString& title) +{ + d->Title = title; +} + +void CSectionContentWidget::setFlags(const Flags f) +{ + d->Flags = f; +} + +} // namespace ads diff --git a/AdvancedDockingSystem/src/SectionTitleWidget.cpp b/AdvancedDockingSystem/src/SectionTitleWidget.cpp index d29f7e3..0479241 100644 --- a/AdvancedDockingSystem/src/SectionTitleWidget.cpp +++ b/AdvancedDockingSystem/src/SectionTitleWidget.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . ******************************************************************************/ +#include #include "ads/SectionTitleWidget.h" #include @@ -36,8 +37,6 @@ #include "ads/SectionContent.h" #include "ads/SectionWidget.h" #include "ads/FloatingWidget.h" -#include - #include ADS_NAMESPACE_BEGIN @@ -51,14 +50,14 @@ SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget* QBoxLayout* l = new QBoxLayout(QBoxLayout::LeftToRight); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - l->addWidget(content->titleWidget()); + l->addWidget(content->titleWidgetContent()); setLayout(l); } SectionTitleWidget::~SectionTitleWidget() { - layout()->removeWidget(m_Content->titleWidget()); + layout()->removeWidget(m_Content->titleWidgetContent()); } bool SectionTitleWidget::isActiveTab() const @@ -130,7 +129,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev) { SectionWidget* section = nullptr; CContainerWidget* cw = findParentContainerWidget(this); - MainContainerWidget* mcw = cw->mainContainerWidget(); + CMainContainerWidget* mcw = cw->mainContainerWidget(); std::cout << "SectionTitleWidget::mouseReleaseEvent" << std::endl; //m_FloatingWidget.clear(); @@ -164,7 +163,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev) } -void SectionTitleWidget::startFloating(QMouseEvent* ev, MainContainerWidget* cw, SectionWidget* sectionwidget) +void SectionTitleWidget::startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget) { std::cout << "SectionTitleWidget::startFloating" << std::endl; @@ -246,7 +245,7 @@ void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev) // TODO make a member with the main container widget and assign it on // creation - MainContainerWidget* MainContainerWidget = findParentContainerWidget(this)->mainContainerWidget(); + CMainContainerWidget* MainContainerWidget = findParentContainerWidget(this)->mainContainerWidget(); ev->accept(); diff --git a/AdvancedDockingSystem/src/SectionWidget.cpp b/AdvancedDockingSystem/src/SectionWidget.cpp index 5ff3548..b000bd8 100644 --- a/AdvancedDockingSystem/src/SectionWidget.cpp +++ b/AdvancedDockingSystem/src/SectionWidget.cpp @@ -44,13 +44,13 @@ #include "ads/DropOverlay.h" #include "ads/SectionContent.h" #include "ads/SectionTitleWidget.h" -#include "ads/SectionContentWidget.h" +#include #include "ads/FloatingWidget.h" #include ADS_NAMESPACE_BEGIN -SectionWidget::SectionWidget(MainContainerWidget* MainContainer, CContainerWidget* parent) : +SectionWidget::SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent) : QFrame(parent), _uid(GetNextUid()), m_MainContainerWidget(MainContainer), @@ -174,7 +174,7 @@ void SectionWidget::addContent(const SectionContent::RefPtr& c) _tabsLayout->insertWidget(_tabsLayout->count() - _tabsLayoutInitCount, title); QObject::connect(title, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked())); - SectionContentWidget* content = new SectionContentWidget(c, NULL); + CSectionContentWidget* content = new CSectionContentWidget(c, NULL); m_ContentWidgets.append(content); _contentsLayout->addWidget(content); @@ -247,7 +247,7 @@ bool SectionWidget::takeContentAt(int index, InternalContentData& data) } // Content wrapper widget (CONTENT) - SectionContentWidget* content = m_ContentWidgets.takeAt(index); + CSectionContentWidget* content = m_ContentWidgets.takeAt(index); if (content) { _contentsLayout->removeWidget(content); diff --git a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.cpp b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.cpp index e1177f0..b0b6a48 100644 --- a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.cpp +++ b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.cpp @@ -13,18 +13,12 @@ SectionContentListModel::~SectionContentListModel() { } -void SectionContentListModel::init(ADS_NS::MainContainerWidget* cw) +void SectionContentListModel::init(ADS_NS::CMainContainerWidget* cw) { -#if QT_VERSION >= 0x050000 beginResetModel(); _cw = cw; _contents = _cw->contents(); endResetModel(); -#else - _cw = cw; - _contents = _cw->contents(); - reset(); -#endif } int SectionContentListModel::columnCount(const QModelIndex& parent) const diff --git a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.h b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.h index 92034ed..79502e3 100644 --- a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.h +++ b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListModel.h @@ -9,7 +9,7 @@ #include "ads/API.h" #include "ads/SectionContent.h" ADS_NAMESPACE_BEGIN -class MainContainerWidget; +class CMainContainerWidget; ADS_NAMESPACE_END class SectionContentListModel : public QAbstractTableModel @@ -27,7 +27,7 @@ public: SectionContentListModel(QObject* parent); virtual ~SectionContentListModel(); - void init(ADS_NS::MainContainerWidget* cw); + void init(ADS_NS::CMainContainerWidget* cw); virtual int columnCount(const QModelIndex &parent) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; @@ -40,7 +40,7 @@ public: private: QHash _headers; - ADS_NS::MainContainerWidget* _cw; + ADS_NS::CMainContainerWidget* _cw; QList _contents; }; diff --git a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListWidget.h b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListWidget.h index 7899a08..eaf4866 100644 --- a/AdvancedDockingSystemDemo/src/dialogs/SectionContentListWidget.h +++ b/AdvancedDockingSystemDemo/src/dialogs/SectionContentListWidget.h @@ -16,7 +16,7 @@ public: class Values { public: - ADS_NS::MainContainerWidget* cw; + ADS_NS::CMainContainerWidget* cw; }; SectionContentListWidget(QWidget* parent); diff --git a/AdvancedDockingSystemDemo/src/mainwindow.cpp b/AdvancedDockingSystemDemo/src/mainwindow.cpp index 1a0ec44..4f6aa8e 100644 --- a/AdvancedDockingSystemDemo/src/mainwindow.cpp +++ b/AdvancedDockingSystemDemo/src/mainwindow.cpp @@ -21,7 +21,7 @@ static int CONTENT_COUNT = 0; -static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::MainContainerWidget* container) +static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::CMainContainerWidget* container) { QWidget* w = new QWidget(); QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom); @@ -39,7 +39,7 @@ static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::MainContaine return sc; } -static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::MainContainerWidget* container) +static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::CMainContainerWidget* container) { QCalendarWidget* w = new QCalendarWidget(); @@ -47,7 +47,7 @@ static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::MainContainerWidg return ADS_NS::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Calendar %1").arg(index)), w); } -static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC(ADS_NS::MainContainerWidget* container) +static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC(ADS_NS::CMainContainerWidget* container) { QTreeView* w = new QTreeView(); w->setFrameShape(QFrame::NoFrame); @@ -93,7 +93,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->actionContentList, SIGNAL(triggered()), this, SLOT(showSectionContentListDialog())); // ADS - Create main container (ContainerWidget). - _container = new ADS_NS::MainContainerWidget(); + _container = new ADS_NS::CMainContainerWidget(); connect(_container, SIGNAL(activeTabChanged(const SectionContent::RefPtr&, bool)), this, SLOT(onActiveTabChanged(const SectionContent::RefPtr&, bool))); connect(_container, SIGNAL(sectionContentVisibilityChanged(SectionContent::RefPtr,bool)), this, SLOT(onSectionContentVisibilityChanged(SectionContent::RefPtr,bool))); setCentralWidget(_container); @@ -117,7 +117,7 @@ void MainWindow::createContent() { // ADS - Adding some contents. // Test #1: Use high-level public API - ADS_NS::MainContainerWidget* cw = _container; + ADS_NS::CMainContainerWidget* cw = _container; ADS_NS::SectionWidget* sw = nullptr; sw = _container->addSectionContent(createLongTextLabelSC(cw), nullptr, ADS_NS::CenterDropArea); @@ -136,7 +136,7 @@ void MainWindow::createContent() #if 0 // Issue #2: If the first drop is not into CenterDropArea, the application crashes. - ADS_NS::MainContainerWidget* cw = _container; + ADS_NS::CMainContainerWidget* cw = _container; ADS_NS::SectionWidget* sw = NULL; sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::LeftDropArea); @@ -162,7 +162,7 @@ void MainWindow::showSectionContentListDialog() void MainWindow::onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bool active) { Q_UNUSED(active); - IconTitleWidget* itw = dynamic_cast(sc->titleWidget()); + IconTitleWidget* itw = dynamic_cast(sc->titleWidgetContent()); if (itw) { itw->polishUpdate(); diff --git a/AdvancedDockingSystemDemo/src/mainwindow.h b/AdvancedDockingSystemDemo/src/mainwindow.h index fee15d8..4eeb4fa 100644 --- a/AdvancedDockingSystemDemo/src/mainwindow.h +++ b/AdvancedDockingSystemDemo/src/mainwindow.h @@ -37,7 +37,7 @@ protected: private: Ui::MainWindow *ui; - ADS_NS::MainContainerWidget* _container; + ADS_NS::CMainContainerWidget* _container; void createContent(); };