有没有办法使用标题中描述的命名约定来连接来自您自己的类的信号。
例如:
class MyTree : public QTreeWidget
{
Q_OBJECT
private slots:
void on_this_itemClicked(QTreeWidgetItem* item, int column);
};
我知道我可以像这样使用连接...
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(myItemClicked(QTreeWidgetItem*, int)));
...但我只是好奇它是否有效。
最佳答案
我很确定 Qt 自动连接使用 objectName
(QObject::setObjectName()
),所以它不可能解决 this
.
关于c++ - 使用 on_<widget>_<signal> where widget it own class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5897249/