Op 03/02/2017 om 10:18 schreef Jesus Fernandez:
On Thursday, February 02, 2017 07:38:00 PM Hamed Masafi wrote:
Declaring persistant objects in ORM is straightforward:

     class Comment : public Table
     {
         Q_OBJECT

         NUT_PRIMARY_AUTO_INCREMENT(id)
         NUT_DECLARE_FIELD(int, id, id, setId)
         NUT_DECLARE_FIELD(QString, message, message, setMessage)
         NUT_DECLARE_FIELD(QDateTime, saveDate, saveDate, setSaveDate)
         NUT_DECLARE_FIELD(qreal, point, point, setPoint)

         NUT_FOREGION_KEY(Post, int, post, post, setPost)

     public:
         Q_INVOKABLE explicit Comment(QObject *tableSet = 0);
     };
Why not using Q_PROPERTY instead of NUT_DECLARE_FIELD?

And what's the reason to have a constructor as Q_INVOKABLE?
That would be to have instances of the type be creatable by the ORM machinery, I'd guess.

André
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to