Core: Allow disabling default cancel button in info bar

Change-Id: I83f7903854823bb156f57f0fe45eb041a5f35044
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-11 10:49:25 +02:00
parent a9e0c9e57d
commit 1cece95f9a
2 changed files with 16 additions and 4 deletions

View File

@@ -68,6 +68,11 @@ void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBac
m_cancelButtonCallBack = callBack;
}
void InfoBarEntry::setShowDefaultCancelButton(bool yesno)
{
m_showDefaultCancelButton = yesno;
}
void InfoBarEntry::setDetailsWidgetCreator(const InfoBarEntry::DetailsWidgetCreator &creator)
{
m_detailsWidgetCreator = creator;
@@ -277,12 +282,17 @@ void InfoBarDisplay::update()
});
if (info.cancelButtonText.isEmpty()) {
infoWidgetCloseButton->setAutoRaise(true);
infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
infoWidgetCloseButton->setToolTip(tr("Close"));
if (info.m_showDefaultCancelButton) {
infoWidgetCloseButton->setAutoRaise(true);
infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
infoWidgetCloseButton->setToolTip(tr("Close"));
}
if (infoWidgetSuppressButton)
hbox->addWidget(infoWidgetSuppressButton);
hbox->addWidget(infoWidgetCloseButton);
if (info.m_showDefaultCancelButton)
hbox->addWidget(infoWidgetCloseButton);
} else {
infoWidgetCloseButton->setText(info.cancelButtonText);
hbox->addWidget(infoWidgetCloseButton);