我是根据QT的那么书上例程来的, 但是按键盘输入数据的时候, 文本框没反应.
如图, 程序如下:
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));
// lineEdit->keyboardGrabber();
// lineEdit->activateWindow();
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
void GoToCellDialog::on_lineEdit_textChanged()
{
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
lineEdit->hasAcceptableInput());
}
------解决思路----------------------
方便的话你把工程发到我邮箱看看,我的邮箱1179678986@qq.com