Q_PROPERTY decls where?

Forum for posting problems using QxOrm library

Re: Q_PROPERTY decls where?

Postby doulos » Thu Aug 28, 2014 8:26 am

I understand that your are working on a commercial product : if your product is based on QxOrm library, then your product must be GPL.
Please remember that you have to purchase a QXPL QxOrm license to sell your product without the restrictions of the GPL license.

I said we're on a tight schedule, not that we are commercial ;). But seriously (we ARE indeed comnmercial), we have no issue at all with paying you what is due. You and your product have been very helpful so far. You'll be hearing from us.

Christian Sell
http://www.gsvitec.com
doulos
 
Posts: 15
Joined: Mon Aug 11, 2014 1:24 pm

Re: Q_PROPERTY decls where?

Postby qxorm » Tue Oct 28, 2014 9:34 am

the question about property setters directly accessing the database (i.e., no "save" button)

To do this kind of things, I would recommend to create your own template class wich inherits from qx::QxModel<T>.
Then, in your template class, you just have to override the "virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole)" method.

I write it quickly but your template class could be something like this :
Code: Select all
    template <class T>
    class MyModelSaveOnSetter : public qx::QxModel<T>
    {
       virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole)
       {
          bool bSetDataOk = qx::QxModel<T>::setData(index, value, role); // call base class setter
          if (bSetDataOk) { this->qxSave(); }
          return bSetDataOk;
       }
    };

FYI, with this BETA version of QxOrm library : http://www.qxorm.com/version/QxOrm_1.3.1_BETA_15.zip
The class qx::IxModel provides now a new feature to save automatically all changes to database (without having to create a new class derived from qx::QxModel<T>).
To enable this new feature, just do it :
Code: Select all
qx::IxModel * pModel = new qx::QxModel<MyClass>();
pModel->setAutoUpdateDatabase(qx::IxModel::e_auto_update_on_field_change);
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Previous

Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 5 guests

cron