gpt4 book ai didi

c++ - 使用 on__ where widget it own class

转载 作者:太空宇宙 更新时间:2023-11-04 14:23:26 27 4
gpt4 key购买 nike

有没有办法使用标题中描述的命名约定来连接来自您自己的类的信号。

例如:

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com