You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
788 B
C++
35 lines
788 B
C++
#include "QAddModeUI.h"
|
|
#include <QRegExp>
|
|
|
|
QAddModeUI::QAddModeUI(QWidget *parent)
|
|
: QDialog(parent)
|
|
{
|
|
ui.setupUi(this);
|
|
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
|
connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
|
|
|
QRegExp regx("[a-zA-Z0-9]+$");
|
|
QSharedPointer<QValidator> validator = QSharedPointer<QValidator>(new QRegExpValidator(regx));
|
|
ui.lineEdit->setValidator(validator.data());
|
|
}
|
|
|
|
QAddModeUI::~QAddModeUI()
|
|
{
|
|
}
|
|
|
|
Q_SLOT void QAddModeUI::onButtonClicked()
|
|
{
|
|
QString strObj = sender()->objectName();
|
|
if (strObj == "pushButton")
|
|
{
|
|
QDialog::accept();
|
|
}
|
|
else if (strObj == "pushButton_2") {
|
|
QDialog::reject();
|
|
}
|
|
}
|
|
|
|
QString QAddModeUI::getInputName() {
|
|
QString strName = ui.lineEdit->text();
|
|
return strName;
|
|
} |