[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 {
Q_OBJECT
};
class DerivedClass: public BaseClass {
Q_OBJECT
};
class TypeCompare: public QObject {
Q_OBJECT
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);
}
};
QTEST_GUILESS_MAIN(TypeCompare)
#include "tst_type_compare.moc"
==================
--
http://www.mardy.it - Geek in un lingua international
More information about the Development
mailing list