Fix Message Box button size on macOS and Linux

* Fixes #10381
This commit is contained in:
Jonathan White 2024-03-30 08:01:44 -04:00
parent deb0926497
commit ff6c3d7d9a
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
5 changed files with 6 additions and 4 deletions

View File

@ -328,6 +328,7 @@ void DatabaseOpenWidget::openDatabase()
auto btn = msgBox->addButton(tr("Open database anyway"), QMessageBox::ButtonRole::AcceptRole);
msgBox->setDefaultButton(btn);
msgBox->addButton(QMessageBox::Cancel);
msgBox->layout()->setSizeConstraint(QLayout::SetMinimumSize);
msgBox->exec();
if (msgBox->clickedButton() != btn) {
m_db.reset(new Database());

View File

@ -19,6 +19,7 @@
#include "MessageBox.h"
#include <QCheckBox>
#include <QLayout>
#include <QMap>
#include <QPushButton>
#include <QWindow>
@ -125,6 +126,7 @@ MessageBox::Button MessageBox::messageBox(QWidget* parent,
msgBox.activateWindow();
msgBox.raise();
}
msgBox.layout()->setSizeConstraint(QLayout::SetMinimumSize);
msgBox.exec();
Button returnButton = m_addedButtonLookup[msgBox.clickedButton()];

View File

@ -173,6 +173,7 @@ bool DatabaseSettingsWidgetDatabaseKey::save()
auto btn = msgBox->addButton(tr("Continue without password"), QMessageBox::ButtonRole::AcceptRole);
msgBox->addButton(QMessageBox::Cancel);
msgBox->setDefaultButton(QMessageBox::Cancel);
msgBox->layout()->setSizeConstraint(QLayout::SetMinimumSize);
msgBox->exec();
if (msgBox->clickedButton() != btn) {
return false;

View File

@ -269,6 +269,7 @@ bool DatabaseSettingsWidgetEncryption::save()
auto ok = warning.addButton(tr("Understood, keep number"), QMessageBox::ButtonRole::AcceptRole);
auto cancel = warning.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole);
warning.setDefaultButton(cancel);
warning.layout()->setSizeConstraint(QLayout::SetMinimumSize);
warning.exec();
if (warning.clickedButton() != ok) {
return false;
@ -282,6 +283,7 @@ bool DatabaseSettingsWidgetEncryption::save()
auto ok = warning.addButton(tr("Understood, keep number"), QMessageBox::ButtonRole::AcceptRole);
auto cancel = warning.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole);
warning.setDefaultButton(cancel);
warning.layout()->setSizeConstraint(QLayout::SetMinimumSize);
warning.exec();
if (warning.clickedButton() != ok) {
return false;

View File

@ -17,10 +17,6 @@ QSpinBox {
min-width: 90px;
}
QDialogButtonBox QPushButton {
min-width: 55px;
}
QCheckBox, QRadioButton {
spacing: 10px;
}