mirror-chatterino2/widgets/textinputdialog.cpp
2017-04-14 17:52:22 +02:00

43 lines
996 B
C++

#include "widgets/textinputdialog.h"
#include <QSizePolicy>
namespace chatterino {
namespace widgets {
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
, _vbox(this)
, _lineEdit()
, _buttonBox()
, _okButton("OK")
, _cancelButton("Cancel")
{
_vbox.addWidget(&_lineEdit);
_vbox.addLayout(&_buttonBox);
_buttonBox.addStretch(1);
_buttonBox.addWidget(&_okButton);
_buttonBox.addWidget(&_cancelButton);
QObject::connect(&_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
QObject::connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
Qt::MSWindowsFixedSizeDialogHint);
}
void TextInputDialog::okButtonClicked()
{
accept();
close();
}
void TextInputDialog::cancelButtonClicked()
{
reject();
close();
}
}
}