Starting /home/torrao/Desktop/v7/automovel_sem_designer/automovel_sem_designer
QWidget::setTabOrder: 'first' and
'second' must be in the same window
QWidget::setTabOrder: 'first' and
'second' must be in the same window
/home/torrao/Desktop/v7/automovel_sem_designer/automovel_sem_designer exited with code 0
Starting /home/torrao/Desktop/v7/automovel_sem_designer/automovel_sem_designer
QWidget::setTabOrder: 'first' and 'second' must be in the same window
QWidget::setTabOrder: 'first' and 'second' must be in the same window
/home/torrao/Desktop/v7/automovel_sem_designer/automovel_sem_designer exited with code 0
To copy to clipboard, switch view to plain text mode
#ifndef IDDOAUTOMOVELDIALOG_H
#define IDDOAUTOMOVELDIALOG_H
#include <QDialog>
class IdDoAutomovelDialog
: public QDialog{
Q_OBJECT
public:
IdDoAutomovelDialog
(QWidget *parent
= 0);
private slots:
void on_lineEdit_textChanged();
private:
};
#endif // IDDOAUTOMOVELDIALOG_H
#ifndef IDDOAUTOMOVELDIALOG_H
#define IDDOAUTOMOVELDIALOG_H
#include <QDialog>
class QLabel;
class QLineEdit;
class QSpacerItem;
class QPushButton;
class QHBoxLayout;
class QVBoxLayout;
class QString;
class QRegExp;
class IdDoAutomovelDialog : public QDialog
{
Q_OBJECT
public:
IdDoAutomovelDialog(QWidget *parent = 0);
private slots:
void on_lineEdit_textChanged();
private:
QLabel *label;
QLineEdit *lineEdit;
QSpacerItem *horizontalSpacer;
QPushButton *okButton;
QPushButton *cancelButton;
QStringList *listaMatriculasValidas;
QVBoxLayout *verticalLayout;
QHBoxLayout *horizontalLayout;
QHBoxLayout *horizontalLayout_2;
};
#endif // IDDOAUTOMOVELDIALOG_H
To copy to clipboard, switch view to plain text mode
#include <QtGui>
#include "IdDoAutomovelDialog.h"
IdDoAutomovelDialog
::IdDoAutomovelDialog(QWidget *parent
):QDialog(parent
){ //Label
label
= new QLabel("&MatrÃ*cula:");
//Line Edit
//Buddyes
label->setBuddy(lineEdit);
//Spacer
//OK Button
okButton->setEnabled(false);
//CANCEL Button
cancelButton
->setObjectName
(QString::fromUtf8("cancelButton"));
//Validar a matrÃ*cula introduzida ( http://pt.wikipedia.org/wiki/Matr%C3%ADculas_autom%C3%B3veis_em_Portugal )
listaMatriculasValidas->append("[A-Za-z]{2,2}[-][0-9]{2,2}[-][0-9]{2,2}");
listaMatriculasValidas->append("[0-9]{2,2}[-][0-9]{2,2}[-][A-Za-z]{2,2}"); //or
listaMatriculasValidas->operator <<("[0-9]{2,2}[-][A-Za-z]{2,2}[-][0-9]{2,2}");
QRegExp regExp
(listaMatriculasValidas
->join
("|"));
//Definir acções
connect(lineEdit,
SIGNAL(textChanged
(const QString &)),
this, SLOT(on_lineEdit_textChanged()));
connect(okButton, SIGNAL(clicked()),
this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()),
this, SLOT(close()));
//layout Dialog
horizontalLayout->addWidget(label);
horizontalLayout->addWidget(lineEdit);
horizontalLayout_2->addItem(horizontalSpacer);
horizontalLayout_2->addWidget(okButton);
horizontalLayout_2->addWidget(cancelButton);
verticalLayout->addLayout(horizontalLayout);
verticalLayout->addLayout(horizontalLayout_2);
//Tab order
QWidget::setTabOrder(lineEdit, okButton
);
QWidget::setTabOrder(okButton, cancelButton
);
setWindowTitle("MatrÃ*cula");
setLayout(verticalLayout);
}
void IdDoAutomovelDialog::on_lineEdit_textChanged(){
okButton->setEnabled(lineEdit->hasAcceptableInput());
}
#include <QtGui>
#include "IdDoAutomovelDialog.h"
IdDoAutomovelDialog::IdDoAutomovelDialog(QWidget *parent):QDialog(parent){
//Label
label = new QLabel("&MatrÃ*cula:");
//Line Edit
lineEdit = new QLineEdit;
//Buddyes
label->setBuddy(lineEdit);
//Spacer
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
//OK Button
okButton = new QPushButton("Ok");
okButton->setEnabled(false);
//CANCEL Button
cancelButton = new QPushButton("Cancel");
cancelButton->setObjectName(QString::fromUtf8("cancelButton"));
//Validar a matrÃ*cula introduzida ( http://pt.wikipedia.org/wiki/Matr%C3%ADculas_autom%C3%B3veis_em_Portugal )
listaMatriculasValidas = new QStringList;
listaMatriculasValidas->append("[A-Za-z]{2,2}[-][0-9]{2,2}[-][0-9]{2,2}");
listaMatriculasValidas->append("[0-9]{2,2}[-][0-9]{2,2}[-][A-Za-z]{2,2}"); //or
listaMatriculasValidas->operator <<("[0-9]{2,2}[-][A-Za-z]{2,2}[-][0-9]{2,2}");
QRegExp regExp(listaMatriculasValidas->join("|"));
lineEdit->setValidator(new QRegExpValidator(regExp, this));
//Definir acções
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(on_lineEdit_textChanged()));
connect(okButton, SIGNAL(clicked()),
this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()),
this, SLOT(close()));
//layout Dialog
horizontalLayout = new QHBoxLayout;
horizontalLayout_2 = new QHBoxLayout;
verticalLayout = new QVBoxLayout;
horizontalLayout->addWidget(label);
horizontalLayout->addWidget(lineEdit);
horizontalLayout_2->addItem(horizontalSpacer);
horizontalLayout_2->addWidget(okButton);
horizontalLayout_2->addWidget(cancelButton);
verticalLayout->addLayout(horizontalLayout);
verticalLayout->addLayout(horizontalLayout_2);
//Tab order
QWidget::setTabOrder(lineEdit, okButton);
QWidget::setTabOrder(okButton, cancelButton);
setWindowTitle("MatrÃ*cula");
setLayout(verticalLayout);
}
void IdDoAutomovelDialog::on_lineEdit_textChanged(){
okButton->setEnabled(lineEdit->hasAcceptableInput());
}
To copy to clipboard, switch view to plain text mode
Bookmarks