InfoBar: Always order buttons in the same order

Change-Id: Ic95aa15ba770b6c75eb3a48bdfabdb7420f8d6ae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-02 15:14:20 +01:00
parent 8c8f3e30b5
commit c5a27770f4

View File

@@ -361,11 +361,14 @@ void InfoBarDisplay::update()
}); });
} }
if (info.m_cancelButtonText.isEmpty()) {
if (infoWidgetCloseButton) { if (infoWidgetCloseButton) {
if (info.m_cancelButtonText.isEmpty()) {
infoWidgetCloseButton->setAutoRaise(true); infoWidgetCloseButton->setAutoRaise(true);
infoWidgetCloseButton->setIcon(Icons::CLOSE_FOREGROUND.icon()); infoWidgetCloseButton->setIcon(Icons::CLOSE_FOREGROUND.icon());
infoWidgetCloseButton->setToolTip(tr("Close")); infoWidgetCloseButton->setToolTip(tr("Close"));
} else {
infoWidgetCloseButton->setText(info.m_cancelButtonText);
}
} }
if (infoWidgetSuppressButton) if (infoWidgetSuppressButton)
@@ -373,14 +376,6 @@ void InfoBarDisplay::update()
if (infoWidgetCloseButton) if (infoWidgetCloseButton)
hbox->addWidget(infoWidgetCloseButton); hbox->addWidget(infoWidgetCloseButton);
} else {
if (infoWidgetCloseButton) {
infoWidgetCloseButton->setText(info.m_cancelButtonText);
hbox->addWidget(infoWidgetCloseButton);
}
if (infoWidgetSuppressButton)
hbox->addWidget(infoWidgetSuppressButton);
}
connect(infoWidget, &QObject::destroyed, this, [this, infoWidget] { connect(infoWidget, &QObject::destroyed, this, [this, infoWidget] {
m_infoWidgets.removeOne(infoWidget); m_infoWidgets.removeOne(infoWidget);