[Development] Applications using -fno-rtti

Alberto Mardegan mardy at users.sourceforge.net
Sat Jun 20 21:45:50 CEST 2020

On 20/06/20 21:42, Konstantin Tokarev wrote:
> Comparing metaObject() with staticMetaObject() is wrong because it would fail
> even for QProcess.

No, I tried, it seems to work as expected:

#include <QObject>

#include <QTest>

class BaseClass: public QObject {



class DerivedClass: public BaseClass {



class TypeCompare: public QObject {


private Q_SLOTS:

    void testType() {

        BaseClass base;

        DerivedClass derived;

        QCOMPARE(base.metaObject(), &BaseClass::staticMetaObject);

        QCOMPARE(derived.metaObject(), &DerivedClass::staticMetaObject);

        // this fails
        QCOMPARE(derived.metaObject(), &BaseClass::staticMetaObject);



#include "tst_type_compare.moc"


http://www.mardy.it - Geek in un lingua international

More information about the Development mailing list