Commit c36de642 authored by JanKusanagi's avatar JanKusanagi

Switch AccountDialog to QDialogButtonBox

parent 0ee8f39b
......@@ -178,6 +178,10 @@ AccountDialog::AccountDialog(PumpController *pumpController, QWidget *parent) :
connect(m_cancelButton, &QAbstractButton::clicked,
this, &QWidget::hide);
m_bottomButtonBox = new QDialogButtonBox(this);
m_bottomButtonBox->addButton(m_saveButton, QDialogButtonBox::AcceptRole);
m_bottomButtonBox->addButton(m_cancelButton, QDialogButtonBox::RejectRole);
// Unlock button, visible when the account is already authorized, + info
m_unlockExplanationLabel = new QLabel("<b>"
......@@ -215,11 +219,6 @@ AccountDialog::AccountDialog(PumpController *pumpController, QWidget *parent) :
m_verifierLayout->addWidget(m_authorizeButton);
m_buttonsLayout = new QHBoxLayout();
m_buttonsLayout->setAlignment(Qt::AlignRight);
m_buttonsLayout->addWidget(m_saveButton);
m_buttonsLayout->addWidget(m_cancelButton);
m_mainLayout = new QVBoxLayout();
m_mainLayout->addWidget(m_unlockExplanationLabel, 6);
......@@ -243,7 +242,7 @@ AccountDialog::AccountDialog(PumpController *pumpController, QWidget *parent) :
m_mainLayout->addWidget(m_authorizationStatusLabel, 1, Qt::AlignCenter);
m_mainLayout->addStretch(2);
m_mainLayout->addSpacing(8);
m_mainLayout->addLayout(m_buttonsLayout, 1);
m_mainLayout->addWidget(m_bottomButtonBox, 1);
this->setLayout(m_mainLayout);
......
......@@ -29,6 +29,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QDialogButtonBox>
#include <QByteArray>
#include <QHideEvent>
......@@ -63,9 +64,11 @@ public slots:
void unlockDialog();
protected:
virtual void hideEvent(QHideEvent *event);
private:
QVBoxLayout *m_mainLayout;
......@@ -94,7 +97,7 @@ private:
QLabel *m_unlockExplanationLabel;
QPushButton *m_unlockButton;
QHBoxLayout *m_buttonsLayout;
QDialogButtonBox *m_bottomButtonBox;
QPushButton *m_saveButton;
QPushButton *m_cancelButton;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment