diff options
author | hjk <hjk@theqtcompany.com> | 2015-06-19 14:31:13 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-06-22 06:55:39 +0000 |
commit | 7e08cca3117a1e12383b968b1a4d7224df623967 (patch) | |
tree | d3b4db7a20163c6c35c6eda99226b213d8ed5110 | |
parent | fc6480866c44b734747c3e5e944341bf90e247b9 (diff) | |
download | qt-creator-7e08cca3117a1e12383b968b1a4d7224df623967.tar.gz |
Core: Reduce use of Id::fromUniqueIdentifier in the Infobar
Should be the exception in general and is with Qt5/C++11 in this
particular case not needed anymore.
Change-Id: Ida3f1fb534a6c7c1c6a84f8d4bc62e1636964f44
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r-- | src/plugins/coreplugin/infobar.cpp | 25 | ||||
-rw-r--r-- | src/plugins/coreplugin/infobar.h | 2 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp index 1b4fdc9c58..2598d89718 100644 --- a/src/plugins/coreplugin/infobar.cpp +++ b/src/plugins/coreplugin/infobar.cpp @@ -229,22 +229,25 @@ void InfoBarDisplay::update() hbox->addWidget(infoWidgetButton); } + const Id id = info.id; QToolButton *infoWidgetSuppressButton = 0; if (info.globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) { infoWidgetSuppressButton = new QToolButton; - infoWidgetSuppressButton->setProperty("infoId", info.id.uniqueIdentifier()); infoWidgetSuppressButton->setText(tr("Do Not Show Again")); - connect(infoWidgetSuppressButton, SIGNAL(clicked()), SLOT(suppressButtonClicked())); + connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] { + m_infoBar->removeInfo(id); + InfoBar::globallySuppressInfo(id); + }); } QToolButton *infoWidgetCloseButton = new QToolButton; - infoWidgetCloseButton->setProperty("infoId", info.id.uniqueIdentifier()); - // need to connect to cancelObjectbefore connecting to cancelButtonClicked, // because the latter removes the button and with it any connect if (info.m_cancelButtonCallBack) connect(infoWidgetCloseButton, &QAbstractButton::clicked, info.m_cancelButtonCallBack); - connect(infoWidgetCloseButton, SIGNAL(clicked()), SLOT(cancelButtonClicked())); + connect(infoWidgetCloseButton, &QAbstractButton::clicked, this, [this, id] { + m_infoBar->suppressInfo(id); + }); if (info.cancelButtonText.isEmpty()) { infoWidgetCloseButton->setAutoRaise(true); @@ -271,16 +274,4 @@ void InfoBarDisplay::widgetDestroyed() m_infoWidgets.removeOne(static_cast<QWidget *>(sender())); } -void InfoBarDisplay::cancelButtonClicked() -{ - m_infoBar->suppressInfo(Id::fromUniqueIdentifier(sender()->property("infoId").toInt())); -} - -void InfoBarDisplay::suppressButtonClicked() -{ - Id id = Id::fromUniqueIdentifier(sender()->property("infoId").toInt()); - m_infoBar->removeInfo(id); - InfoBar::globallySuppressInfo(id); -} - } // namespace Core diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h index 29201682ee..1a921147c3 100644 --- a/src/plugins/coreplugin/infobar.h +++ b/src/plugins/coreplugin/infobar.h @@ -114,8 +114,6 @@ public: void setInfoBar(InfoBar *infoBar); private slots: - void cancelButtonClicked(); - void suppressButtonClicked(); void update(); void infoBarDestroyed(); void widgetDestroyed(); |