Core: Add suppression call back for info bar

Change-Id: I56bc10adcd101ed38c463096f1cf9396f0ff8b1e
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-11 13:08:00 +02:00
parent 1cece95f9a
commit b5023bda5a
2 changed files with 10 additions and 1 deletions

View File

@@ -68,6 +68,11 @@ void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBac
m_cancelButtonCallBack = callBack;
}
void InfoBarEntry::setSuppressionButtonInfo(InfoBarEntry::CallBack callback)
{
m_suppressionButtonCallBack = callback;
}
void InfoBarEntry::setShowDefaultCancelButton(bool yesno)
{
m_showDefaultCancelButton = yesno;
@@ -266,7 +271,9 @@ void InfoBarDisplay::update()
if (info.globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
infoWidgetSuppressButton = new QToolButton;
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, info, id] {
if (info.m_suppressionButtonCallBack)
info.m_suppressionButtonCallBack();
m_infoBar->removeInfo(id);
InfoBar::globallySuppressInfo(id);
});