From 14a80f1753301ecf94e627d88865ce77d3886a65 Mon Sep 17 00:00:00 2001 From: mfreiholz Date: Mon, 11 Apr 2016 07:15:42 +0200 Subject: [PATCH] fix: FloatingWidget calls ContainerWidget::hideSectionContent(...) instead of it's own close() method to be consistent in the way of hiding and showing contents. --- AdvancedDockingSystem/include/ads/FloatingWidget.h | 3 +++ AdvancedDockingSystem/src/FloatingWidget.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AdvancedDockingSystem/include/ads/FloatingWidget.h b/AdvancedDockingSystem/include/ads/FloatingWidget.h index 7dce5c0..c67a3e2 100644 --- a/AdvancedDockingSystem/include/ads/FloatingWidget.h +++ b/AdvancedDockingSystem/include/ads/FloatingWidget.h @@ -30,6 +30,9 @@ public: public://private: bool takeContent(InternalContentData& data); +private slots: + void onCloseButtonClicked(); + private: ContainerWidget* _container; SectionContent::RefPtr _content; diff --git a/AdvancedDockingSystem/src/FloatingWidget.cpp b/AdvancedDockingSystem/src/FloatingWidget.cpp index 8411526..1652583 100644 --- a/AdvancedDockingSystem/src/FloatingWidget.cpp +++ b/AdvancedDockingSystem/src/FloatingWidget.cpp @@ -38,8 +38,11 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt closeButton->setToolTip(tr("Close")); closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); _titleLayout->addWidget(closeButton); - //QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::close); - QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::onCloseButtonClicked); +#else + QObject::connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(onCloseButtonClicked())); +#endif // Content l->addWidget(contentWidget, 1); @@ -70,4 +73,9 @@ bool FloatingWidget::takeContent(InternalContentData& data) return true; } +void FloatingWidget::onCloseButtonClicked() +{ + _container->hideSectionContent(_content); +} + ADS_NAMESPACE_END