Page 1 of 1

Insert row to model from inside QML

PostPosted: Sat Aug 13, 2016 11:05 am
by algogr
Hello everyone,

I cannot find a function to insert records to QML model derived from qx::IxModel from inside QML. Am i something missing?

Thanks in advance

Re: Insert row to model from inside QML

PostPosted: Tue Aug 16, 2016 7:14 am
by qxorm
Hello,

1- From QML model to database :
All functions available in QML which interact with databases are listed in the manual here : https://www.qxorm.com/qxorm_en/manual.html#manual_90

There is :
qxInsert_() : insert all model entities (all model rows) to database ;
qxInsertRow_() : insert a model row to database ;


2- Insert new row to QML model :
Since qx::IxModel interface is a Qt model and derived from QAbstractItemModel, I think you can find the solution in Qt documentation : http://doc.qt.io/qt-5/qabstractitemmodel.html
For example, you can use the insertRows() method : http://doc.qt.io/qt-5/qabstractitemmode ... insertRows