setValidator(验证程序); 连接(确定按钮、信号(单击())、此、插槽(接受()); 连接(取消按钮、信号(单击())、此、插槽(拒绝()); } void GoToCellDialog::on_lineEdit_textChanged() { OK按钮->设置启用(lineEdit->hasAcceptableInput()); },c++,qt,function,C++,Qt,Function" /> setValidator(验证程序); 连接(确定按钮、信号(单击())、此、插槽(接受()); 连接(取消按钮、信号(单击())、此、插槽(拒绝()); } void GoToCellDialog::on_lineEdit_textChanged() { OK按钮->设置启用(lineEdit->hasAcceptableInput()); },c++,qt,function,C++,Qt,Function" />

函数调用发生在哪里? < C++ >下面的代码中,从Q+GUI编程到Qt 4,调用代码为 OnLeNeEntTyTeXeDeD()/Cuth>函数,因为它在代码中没有明确显示? #include <QtGui> #include "gotocelldialog.h" GoToCellDialog::GoToCellDialog(QWidget *parent): QDialog(parent) { setupUi(this); QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}"); QValidator *validator = new QRegExpValidator(regExp, this); lineEdit->setValidator(validator); connect(okButton, SIGNAL(clicked()),this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); } void GoToCellDialog::on_lineEdit_textChanged() { okButton->setEnabled(lineEdit->hasAcceptableInput()); } #包括 #包括“gotocelldialog.h” GoToCellDialog::GoToCellDialog(QWidget*parent):QDialog(parent) { setupUi(本); QRegExp regExp(“[A-Za-z][1-9][0-9]{0,2}”); QValidator*validator=新的QRegExpValidator(regExp,this); lineEdit->setValidator(验证程序); 连接(确定按钮、信号(单击())、此、插槽(接受()); 连接(取消按钮、信号(单击())、此、插槽(拒绝()); } void GoToCellDialog::on_lineEdit_textChanged() { OK按钮->设置启用(lineEdit->hasAcceptableInput()); }

函数调用发生在哪里? < C++ >下面的代码中,从Q+GUI编程到Qt 4,调用代码为 OnLeNeEntTyTeXeDeD()/Cuth>函数,因为它在代码中没有明确显示? #include <QtGui> #include "gotocelldialog.h" GoToCellDialog::GoToCellDialog(QWidget *parent): QDialog(parent) { setupUi(this); QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}"); QValidator *validator = new QRegExpValidator(regExp, this); lineEdit->setValidator(validator); connect(okButton, SIGNAL(clicked()),this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); } void GoToCellDialog::on_lineEdit_textChanged() { okButton->setEnabled(lineEdit->hasAcceptableInput()); } #包括 #包括“gotocelldialog.h” GoToCellDialog::GoToCellDialog(QWidget*parent):QDialog(parent) { setupUi(本); QRegExp regExp(“[A-Za-z][1-9][0-9]{0,2}”); QValidator*validator=新的QRegExpValidator(regExp,this); lineEdit->setValidator(验证程序); 连接(确定按钮、信号(单击())、此、插槽(接受()); 连接(取消按钮、信号(单击())、此、插槽(拒绝()); } void GoToCellDialog::on_lineEdit_textChanged() { OK按钮->设置启用(lineEdit->hasAcceptableInput()); },c++,qt,function,C++,Qt,Function,谢谢。如果通过IDE将on\u lineEdit\u textChanged()上的分配给一个组件,例如QLineEdit,当用户更改组件的内容时,框架本身将调用该方法 换句话说,它是一个回调函数。Qt知道如何自动连接某些信号和端口,这些信号和端口是根据_ObjectName_SignalName()的约定命名的。有关示例,请参见。Qt API在中描述了该功能。请阅读您正在阅读的书。这是解释后,不是半页的样本!

谢谢。

如果通过IDE将
on\u lineEdit\u textChanged()
上的
分配给一个组件,例如
QLineEdit
,当用户更改组件的内容时,框架本身将调用该方法


换句话说,它是一个回调函数。

Qt知道如何自动连接某些信号和端口,这些信号和端口是根据_ObjectName_SignalName()的约定命名的。有关示例,请参见。Qt API在中描述了该功能。

请阅读您正在阅读的书。这是解释后,不是半页的样本!