Using on_<widget>_<signal> where widget it own class
Is there a way to use the naming convention described in the title to connect a signal from your own class.
E.g:
class MyTree : public QTreeWidget
{
Q_OBJECT
private slots:
void on_this_itemClicked(QTreeWidgetItem* item, int column);
};
i understand i could use connect 开发者_开发技巧like this...
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(myItemClicked(QTreeWidgetItem*, int)));
...but i was just curious as to if it works.
I am quite sure Qt auto connection use the objectName
(QObject::setObjectName()
), so there is no chance it can resolve this
.
精彩评论