• 1159阅读
  • 2回复

constructorCount()为什么没有呢 [复制链接]

上一主题 下一主题
离线djm488
 

只看楼主 倒序阅读 楼主  发表于: 2021-01-16
MainWindow::MainWindow(QWidget *parent)    : QMainWindow(parent)    , ui(new Ui::MainWindow){  
ui->setupUi(this);    
qDebug()<<this->metaObject()->constructorCount();      //l输出0
qDebug()<<MainWindow::staticMetaObject.constructorCount();   //l输出0
//getQMetaObject();
}
为什么构造方法是0呢

离线gnibuoz

只看该作者 1楼 发表于: 2021-01-17
看网上说法应该是这个【构造函数个数】仅统计 被标记为【Q_INVOKABLE or Q_SCRIPTABLE】的构造函数,原文如下:

Not a bug. As you've discovered, constructors are only extracted if they are marked Q_INVOKABLE or Q_SCRIPTABLE. The same applies to rergular methods, except that slots and signals are automatically invocable.
链接是这个: https://bugreports.qt.io/browse/QTBUG-76348


我就是我,颜色不一样的烟火...
离线djm488

只看该作者 2楼 发表于: 2021-01-18
回 gnibuoz 的帖子
gnibuoz:看网上说法应该是这个【构造函数个数】仅统计 被标记为【Q_INVOKABLE or Q_SCRIPTABLE】的构造函数,原文如下:
Not a bug. As you've discovered, constructors are only extracted if they are marked Q_INVOKABLE or Q_SCRIPTABLE. The same applies to rergular methods, .. (2021-01-17 16:00) 

了解了,谢谢
快速回复
限100 字节
 
上一个 下一个