checkInForm::checkInForm(QWidget *parent) : QDialog(parent), ui(new Ui::checkInForm) { ui->setupUi(this); QRegExp regExp1("[A-Za-z][A-Za-z ]*[A-Za-z0-9]*"); ui->nameText->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*[0-9]*"); ui->phone->setValidator(new QRegExpValidator(regExp2, this)); QRegExp regExp3("[A-Za-z0-9][A-Za-z0-9, ]*[A-Za-z0-9 ]*"); ui->addText->setValidator(new QRegExpValidator(regExp3, this)); QRegExp regExp4("[0-9]{8,8}"); ui->LinCIN->setValidator(new QRegExpValidator(regExp4, this)); QDate QDTime = QDate::currentDate(); QDTime.addDays(1); ui->datedepart2->setDate(QDTime); ui->datedepart2->setShown(1); ui->dated2->setShown(1); ui->dated->setShown(0); ui->datedepart->setShown(0); setupview(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), bin(new binary) { setupUi(this); //setGeometry(400, 250, 542, 390); // define theta double dth = PI / (Ntheta); for(int i=0; i<Ntheta; i++) theta[i] = i*dth; // set up regexp validator so numerical inputs can only be numbers QRegExp regExp1("[1-9][0-9.]{0,3}"); mass1Edit->setValidator(new QRegExpValidator(regExp1, this)); mass2Edit->setValidator(new QRegExpValidator(regExp1, this)); smaEdit->setValidator(new QRegExpValidator(regExp1, this)); // set up more restrictive input for eccentricity QRegExp regExp2("[0][.][0-9 ]{0,3}"); eccEdit->setValidator(new QRegExpValidator(regExp2, this)); eccEdit->setInputMask("\\0\\.999"); // input mask for eccEdit to force input of the from 0.xxx, where the //0//. means 0 and . cannot be deleted // connections connect(eccEdit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(mass1Edit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(mass2Edit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(smaEdit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); // get initial binary values getParams(); plotTwoBodyOrbits(); }
editAddRestaurant::editAddRestaurant(QWidget *parent) : QDialog(parent), ui(new Ui::editAddRestaurant) { ui->setupUi(this); QRegExp regExp1("[A-Za-z0-9][A-Za-z0-9 ].[A-Za-z0-9 ]*"); ui->name->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*"); ui->price->setValidator(new QRegExpValidator(regExp2, this)); }
PwduiDialog::PwduiDialog(QWidget *parent, int u, int p) : QDialog(parent) { setupUi(this); lineEdit_2->setEchoMode(QLineEdit::Password); if(u<999 || p<999) buttonBox->setEnabled(false); else { buttonBox->setEnabled(true) ; lineEdit->setText(QString::number(u)); lineEdit_2->setText(QString::number(p)); } lineEdit->setMaxLength(4); lineEdit_2->setMaxLength(4); QRegExp regExp("[1-9][0-9]{3}"); lineEdit->setValidator(new QRegExpValidator(regExp, this)); QRegExp regExp2("[1-9][0-9]{3}"); lineEdit_2->setValidator(new QRegExpValidator(regExp2,this)); }
addOtherOrders::addOtherOrders(QWidget *parent) : QDialog(parent), ui(new Ui::addOtherOrders) { ui->setupUi(this); QRegExp regExp1("[A-Za-z0-9][A-Za-z0-9 ].[A-Za-z0-9 ]*"); ui->name->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*"); ui->price->setValidator(new QRegExpValidator(regExp2, this)); ui->roomNo->addItem(":: select one ::"); QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE" ); db.setDatabaseName( "./innovativedb.db" ); if( !db.open() ) { qDebug() << db.lastError(); qFatal( "Failed to connect." ); } qDebug( "Connected!" ); QSqlQuery qry; qry.prepare("CREATE TABLE IF NOT EXISTS roomlist (id INTEGET PRIMARY KEY, roomno VARCHAR(5), cat INTEGER, occupied INTEGER)"); if(!qry.exec()) qDebug() << qry.lastError(); else qDebug( "Room Table Validated..." ); qry.prepare("SELECT roomno FROM roomlist WHERE occupied <> 0"); if(!qry.exec()) qDebug() << qry.lastError(); else qDebug( "Room Table Validated..." ); while (qry.next()) { QString roomno = qry.value(0).toString(); ui->roomNo->addItem(roomno); } }