forked from qt-creator/qt-creator
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:
@@ -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,11 +282,16 @@ void InfoBarDisplay::update()
|
||||
});
|
||||
|
||||
if (info.cancelButtonText.isEmpty()) {
|
||||
if (info.m_showDefaultCancelButton) {
|
||||
infoWidgetCloseButton->setAutoRaise(true);
|
||||
infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
|
||||
infoWidgetCloseButton->setToolTip(tr("Close"));
|
||||
}
|
||||
|
||||
if (infoWidgetSuppressButton)
|
||||
hbox->addWidget(infoWidgetSuppressButton);
|
||||
|
||||
if (info.m_showDefaultCancelButton)
|
||||
hbox->addWidget(infoWidgetCloseButton);
|
||||
} else {
|
||||
infoWidgetCloseButton->setText(info.cancelButtonText);
|
||||
|
@@ -58,6 +58,7 @@ public:
|
||||
void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);
|
||||
void setCancelButtonInfo(CallBack callBack);
|
||||
void setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack);
|
||||
void setShowDefaultCancelButton(bool yesno);
|
||||
|
||||
using DetailsWidgetCreator = std::function<QWidget*()>;
|
||||
void setDetailsWidgetCreator(const DetailsWidgetCreator &creator);
|
||||
@@ -71,6 +72,7 @@ private:
|
||||
CallBack m_cancelButtonCallBack;
|
||||
GlobalSuppressionMode globalSuppression;
|
||||
DetailsWidgetCreator m_detailsWidgetCreator;
|
||||
bool m_showDefaultCancelButton = true;
|
||||
friend class InfoBar;
|
||||
friend class InfoBarDisplay;
|
||||
};
|
||||
|
Reference in New Issue
Block a user