fix: FloatingWidget calls ContainerWidget::hideSectionContent(...) instead

of it's own close() method to be consistent in the way of hiding and
showing contents.
This commit is contained in:
mfreiholz 2016-04-11 07:15:42 +02:00
parent 932ec71ad8
commit 14a80f1753
2 changed files with 13 additions and 2 deletions

View File

@ -30,6 +30,9 @@ public:
public://private: public://private:
bool takeContent(InternalContentData& data); bool takeContent(InternalContentData& data);
private slots:
void onCloseButtonClicked();
private: private:
ContainerWidget* _container; ContainerWidget* _container;
SectionContent::RefPtr _content; SectionContent::RefPtr _content;

View File

@ -38,8 +38,11 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt
closeButton->setToolTip(tr("Close")); closeButton->setToolTip(tr("Close"));
closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
_titleLayout->addWidget(closeButton); _titleLayout->addWidget(closeButton);
//QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::close); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(closeButton, &QPushButton::clicked, this, &FloatingWidget::onCloseButtonClicked);
#else
QObject::connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(onCloseButtonClicked()));
#endif
// Content // Content
l->addWidget(contentWidget, 1); l->addWidget(contentWidget, 1);
@ -70,4 +73,9 @@ bool FloatingWidget::takeContent(InternalContentData& data)
return true; return true;
} }
void FloatingWidget::onCloseButtonClicked()
{
_container->hideSectionContent(_content);
}
ADS_NAMESPACE_END ADS_NAMESPACE_END