HamedMasafi / Nut

Advanced, Powerful and easy to use ORM for Qt
GNU Lesser General Public License v3.0
294 stars 75 forks source link

class not registered with qt meta object #85

Closed yangxingpping closed 4 years ago

yangxingpping commented 4 years ago

when I cop unittest tst_datetime's db and sampletable class to an simple demo, it cause fatal for sampletable qFatal("The class %s is not registered with qt meta object", qPrintable(name));

code snippet : DB db; db.setDriver("QSQLITE"); db.setDatabaseName("hello.db"); auto bOpen = db.open();

Can add some additional demos for how to use it?

HamedMasafi commented 4 years ago

Hi @yangxingpping You need to register the all classes used in Nut (Database and tables) with qRegisterMetaType function. For more information please take a look at tests.

yangxingpping commented 4 years ago

Thank you!