How to insert data rows to QProxyModel?
-
@this->beginInsertRows(QModelIndex(),this->rowCount(),List.length());
for (int i=0;i<List.length();i++){
this->insertRow(this->rowCount(),QModelIndex());
this->setData(this->index(this->rowCount(),0),QString("TEST"),Qt::DisplayRole);}
this->endInsertRows();@I can't insert with above code..
How can I insert QList<QStandardItem*> List into that QProxyModel?
Or need another QList<????*> List ?Thanks
-
Hi zither,
If the proxy model is the QSortFilterProxyModel it will call the source modles functions for that. If the source model does not support inserting rows, it will do nothing.
Or do you have a custom implemented proxy model? then perhaps, it's missing some implementation...
-
What do you try to achieve?
Do you just want to insert data temporarily? then QProxyModel is a a possibility. But you have to handle it on your own. There is no default model for such things. You have abstract models (only base classes), proxy models (QSFPM) which do not implement inserting data by default, SQL models which allow inserting data but that is only possible if the model is not readonly.
-
I made a search method for SQLite Database.
So, I choose QSqlQueryModel as it source. Then, I need to insert some XML data from another at the same time. So, I have to insert new rows to that Model which link to ModelView.Plz help me to pass that problem...
Thanks