在C++ GUI Programming with Qt 4中,第二章那个gotocell3 有如下代码
GoToCellDialog::GoToCellDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp, this));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
用Qt 5.3.1编译错误:
G:\Qt\02\GoToCell3\gotocelldialog.cpp:7: error: invalid use of incomplete type 'class QPushButton'
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
G:\Qt\02\GoToCell3\gotocelldialog.cpp:18: error: invalid use of incomplete type 'class QPushButton'
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(lineEdit->hasAcceptableInput());
这是为什么啊?