Skip to content

Commit

Permalink
Fix Message Box button size on macOS and Linux
Browse files Browse the repository at this point in the history
* Fixes #10381
  • Loading branch information
droidmonkey committed Mar 31, 2024
1 parent 9521f63 commit db0b659
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/gui/DatabaseOpenWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,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());
Expand Down
2 changes: 2 additions & 0 deletions src/gui/MessageBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "MessageBox.h"

#include <QCheckBox>
#include <QLayout>
#include <QMap>
#include <QPushButton>
#include <QWindow>
Expand Down Expand Up @@ -126,6 +127,7 @@ MessageBox::Button MessageBox::messageBox(QWidget* parent,
msgBox.activateWindow();
msgBox.raise();
}
msgBox.layout()->setSizeConstraint(QLayout::SetMinimumSize);
msgBox.exec();

Button returnButton = m_addedButtonLookup[msgBox.clickedButton()];
Expand Down
1 change: 1 addition & 0 deletions src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,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;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,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;
Expand All @@ -300,6 +301,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;
Expand Down
4 changes: 0 additions & 4 deletions src/gui/styles/base/basestyle.qss
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ QSpinBox {
min-width: 90px;
}

QDialogButtonBox QPushButton {
min-width: 55px;
}

QCheckBox, QRadioButton {
spacing: 10px;
}
Expand Down

0 comments on commit db0b659

Please sign in to comment.