C++ GUI QT4 一书中的例子 gotocell2
private slots:
void on_lineEdit_textChanged();
并没有看到有connect语句连接该槽和其它信号,但该槽确实被调用了。
原来QT中如果槽的命名是:on_ObjectName_signal ,则会自动关联该槽和对应的信号。
该例中,lineEdit 是 QLineEdit 对象,textChanged 是QLineEdit 的一个信号,on_lineEdit_textChanged() 被自动关联,当有 textChanged 信号时,该槽被调用。
另外自己编写的时候出现了一系列错误:
‘staticMetaObject’ is not a member of ‘Ui_Dialog’ 等等... ...
原因是多继承的顺序不对(具体为什么尚未深究)
class CPPPDialog: public Ui::gotoceldialog, public QDialog
class CPPPDialog: public QDialog, public Ui::gotoceldialog