开发者

Using on_<widget>_<signal> where widget it own class

开发者 https://www.devze.com 2023-03-03 06:14 出处:网络
Is there a way to use the naming convention described in the title to connect a signal from your 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消