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