mirror-chatterino2/widgets/textinputdialog.cpp

47 lines
1.1 KiB
C++
Raw Normal View History

2017-01-18 21:30:23 +01:00
#include "widgets/textinputdialog.h"
2017-01-17 00:15:44 +01:00
#include <QSizePolicy>
2017-01-18 21:30:23 +01:00
namespace chatterino {
namespace widgets {
2017-01-17 00:15:44 +01:00
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
2017-01-18 04:33:30 +01:00
, vbox(this)
, lineEdit()
, buttonBox()
, okButton("OK")
, cancelButton("Cancel")
2017-01-17 00:15:44 +01:00
{
2017-01-18 04:33:30 +01:00
this->vbox.addWidget(&this->lineEdit);
this->vbox.addLayout(&this->buttonBox);
this->buttonBox.addStretch(1);
this->buttonBox.addWidget(&this->okButton);
this->buttonBox.addWidget(&this->cancelButton);
2017-01-17 00:15:44 +01:00
2017-01-18 04:33:30 +01:00
QObject::connect(&this->okButton, SIGNAL(clicked()), this,
SLOT(okButtonClicked()));
QObject::connect(&this->cancelButton, SIGNAL(clicked()), this,
SLOT(cancelButtonClicked()));
2017-01-17 00:15:44 +01:00
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) |
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
}
void
TextInputDialog::okButtonClicked()
{
accept();
2017-01-17 00:42:32 +01:00
close();
2017-01-17 00:15:44 +01:00
}
void
TextInputDialog::cancelButtonClicked()
{
reject();
2017-01-17 00:42:32 +01:00
close();
2017-01-17 00:15:44 +01:00
}
2017-01-18 21:30:23 +01:00
}
}