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,27 +361,22 @@ 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 {
if (infoWidgetSuppressButton)
hbox->addWidget(infoWidgetSuppressButton);
if (infoWidgetCloseButton)
hbox->addWidget(infoWidgetCloseButton);
} else {
if (infoWidgetCloseButton) {
infoWidgetCloseButton->setText(info.m_cancelButtonText); infoWidgetCloseButton->setText(info.m_cancelButtonText);
hbox->addWidget(infoWidgetCloseButton);
} }
if (infoWidgetSuppressButton)
hbox->addWidget(infoWidgetSuppressButton);
} }
if (infoWidgetSuppressButton)
hbox->addWidget(infoWidgetSuppressButton);
if (infoWidgetCloseButton)
hbox->addWidget(infoWidgetCloseButton);
connect(infoWidget, &QObject::destroyed, this, [this, infoWidget] { connect(infoWidget, &QObject::destroyed, this, [this, infoWidget] {
m_infoWidgets.removeOne(infoWidget); m_infoWidgets.removeOne(infoWidget);
}); });