Page 2 of 2

Re: Q_PROPERTY decls where?

PostPosted: Thu Aug 28, 2014 8:26 am
by doulos
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

Re: Q_PROPERTY decls where?

PostPosted: Tue Oct 28, 2014 9:34 am
by qxorm
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);