QLineEdit 的 文本框无法输入指定数据?

咕噜咕噜斯基 咕噜咕噜斯基 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我是根据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());
}
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
咕噜咕噜斯基
Qt 21,504 成员 26,693 内容