mirror-chatterino2/src/widgets/textinputdialog.cpp

44 lines
1 KiB
C++
Raw Normal View History

2017-06-11 09:31:45 +02:00
#include "widgets/textinputdialog.hpp"
2017-01-17 00:15:44 +01:00
#include <QSizePolicy>
2017-04-14 17:52:22 +02:00
namespace chatterino {
namespace widgets {
2017-01-18 21:30:23 +01:00
2017-01-17 00:15:44 +01:00
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
2017-04-12 17:46:44 +02:00
, _vbox(this)
, _lineEdit()
, _buttonBox()
, _okButton("OK")
, _cancelButton("Cancel")
2017-01-17 00:15:44 +01:00
{
2017-04-12 17:46:44 +02:00
_vbox.addWidget(&_lineEdit);
_vbox.addLayout(&_buttonBox);
_buttonBox.addStretch(1);
_buttonBox.addWidget(&_okButton);
_buttonBox.addWidget(&_cancelButton);
2017-01-17 00:15:44 +01:00
2017-04-12 17:46:44 +02:00
QObject::connect(&_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
QObject::connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
2017-01-17 00:15:44 +01:00
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
2017-04-12 17:46:44 +02:00
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
Qt::MSWindowsFixedSizeDialogHint);
2017-01-17 00:15:44 +01:00
}
2017-04-12 17:46:44 +02:00
void TextInputDialog::okButtonClicked()
2017-01-17 00:15:44 +01:00
{
accept();
2017-01-17 00:42:32 +01:00
close();
2017-01-17 00:15:44 +01:00
}
2017-04-12 17:46:44 +02:00
void TextInputDialog::cancelButtonClicked()
2017-01-17 00:15:44 +01:00
{
reject();
2017-01-17 00:42:32 +01:00
close();
2017-01-17 00:15:44 +01:00
}
} // namespace widgets
} // namespace chatterino