QT中inherits()函数可 判断一个对象的类是不是从另外一个类继承而来
作者:互联网
函数原型 bool QObject::inherits ( const char * lname ) const
//来自官方文档
QTimer *timer = new QTimer; // QTimer inherits QObject
timer->inherits("QTimer"); // returns true
timer->inherits("QObject"); // returns true
timer->inherits("QAbstractButton"); // returns false
// QVBoxLayout inherits QObject and QLayoutItem
QVBoxLayout *layout = new QVBoxLayout;
layout->inherits("QObject"); // returns true
layout->inherits("QLayoutItem"); // returns true (even though QLayoutItem is not a QObject)
标签:inherits,QT,timer,QObject,returns,true,QTimer,函数 来源: https://www.cnblogs.com/lllion/p/15018326.html