Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################################################
- header file:
- ######################################################################
- #ifndef GOTOCELLDIALOG_H
- #define GOTOCELLDIALOG_H
- #include <QDialog>
- #include <QLineEdit>
- class GoToCellDialog : public QDialog
- {
- Q_OBJECT
- private:
- QLineEdit * lineEdit;
- QPushButton * okButton ;
- QPushButton * cancelButton ;
- public:
- GoToCellDialog(QWidget *parent = 0);
- private slots:
- void on_lineEdit_textChanged();
- };
- #endif // GOTOCELLDIALOG_H
- ######################################################################
- cpp file
- ######################################################################
- #include <QtGui>
- #include "gotocelldialog.h"
- #include <QtUiTools>
- GoToCellDialog::GoToCellDialog(QWidget *parent)
- : QDialog(parent)
- {
- //setupUi(this);
- QUiLoader loader;
- QFile file("gotocelldialog.ui");
- file.open(QFile::ReadOnly);
- QWidget *formWidget = loader.load(&file, this);
- file.close();
- /*
- QLineEdit *lineEdit=formWidget->findChild<QLineEdit *>("lineEdit");
- QPushButton *okButton = formWidget->findChild<QPushButton *>("okButton");
- QPushButton *cancelButton = formWidget->findChild<QPushButton *>("cancelButton");
- */
- this->LineEdit=formWidget->findChild<QLineEdit *>("lineEdit");
- this->okButton=formWidget->findChild<QPushButton *>("okButton");
- this->cancelButton=formWidget->findChild<QPushButton *>("cancelButton");
- QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
- lineEdit->setValidator(new QRegExpValidator(regExp, this));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
- }
- void GoToCellDialog::on_lineEdit_textChanged()
- {
- this->okButton->setEnabled(this->lineEdit->hasAcceptableInput());
- }
- ###########################
- compilation:
- ###########################
- /home/melmoth/dev/qt/testgit/home-melmoth-dev-qt-book-chapter2-dynamic/gotocelldialog.cpp:21: error: ‘class GoToCellDialog’ has no member named ‘LineEdit’
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement