mirror-chatterino2/widgets/textinputdialog.cpp
2017-01-18 21:30:23 +01:00

46 lines
1.1 KiB
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")
{
this->vbox.addWidget(&this->lineEdit);
this->vbox.addLayout(&this->buttonBox);
this->buttonBox.addStretch(1);
this->buttonBox.addWidget(&this->okButton);
this->buttonBox.addWidget(&this->cancelButton);
QObject::connect(&this->okButton, SIGNAL(clicked()), this,
SLOT(okButtonClicked()));
QObject::connect(&this->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();
}
}
}