Qt - QRegExp preventing text entry in QLineEdit

I am a beginner with Qt.  I am working through examples in the C++ GUI Programming with Qt4 book.  In the Chapter 2 GoToCellDialog example I have used Designer to create a small dialog with a QLineEdit (lineEdit) and am adding a regular expression for validation.  Here is the dialog's source code:

#include "gotocelldialog.h"
#include "ui_gotocelldialog.h"

GoToCellDialog::GoToCellDialog(QWidget *parent) :
    ui(new Ui::GoToCellDialog)

    QRegExp regExp("[A-Za-z][1-9][0-9]{0-2}");
    ui->lineEdit->setValidator(new QRegExpValidator (regExp, this));

    connect (ui->okButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect (ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

void GoToCellDialog::on_lineEdit_textChanged()
//  Destructor omitted

When running this in Debug mode I am unable to enter any text in the QLineEdit window.  If I comment out the setValidator call, I am then able to enter text in the window.  I am using QtCreator 2.0.0 which says it is based on Qt 4.7.0.  Thanks for your help.

Who is Participating?
dcoggin1Connect With a Mentor Author Commented:
My error was in the QRegExp.  I had a dash where I should have had a comma -- {0-2} should have been {0,2}.  I don't think {0-2} is a legal syntax, so I'm surprised it compiled.
All Courses

From novice to tech pro — start learning today.