mirror-chatterino2/textinputdialog.cpp

41 lines
978 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);
2017-01-17 00:42:32 +01:00
QObject::connect(&m_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
QObject::connect(&m_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
}