mirror-chatterino2/textinputdialog.cpp

39 lines
945 B
C++
Raw Normal View History

2017-01-17 00:15:44 +01:00
#include "textinputdialog.h"
#include <QSizePolicy>
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
, m_vbox(this)
, m_lineEdit()
, m_buttonBox()
, m_okButton("OK")
, m_cancelButton("Cancel")
{
m_vbox.addWidget(&m_lineEdit);
m_vbox.addLayout(&m_buttonBox);
m_buttonBox.addStretch(1);
m_buttonBox.addWidget(&m_okButton);
m_buttonBox.addWidget(&m_cancelButton);
QObject::connect(&m_okButton, &m_okButton.clicked, this, &okButtonClicked);
QObject::connect(&m_cancelButton, &m_cancelButton.clicked, this,
&cancelButtonClicked);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) |
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
}
void
TextInputDialog::okButtonClicked()
{
accept();
}
void
TextInputDialog::cancelButtonClicked()
{
reject();
}