[Interest] Best practice for properties, QAbstractListModel with a QList<QObject*> and a Quick2 view
Martin Koller
kollix at aon.at
Thu Dec 19 16:34:01 CET 2013
On Wednesday 18 December 2013 14:58:17 Jan Kundrát wrote:
> On Wednesday, 18 December 2013 11:59:15 CEST, Ola Røer Thorsen wrote:
> > However I get problems when I delete objects from the list model. The
> > delegates are deleted later than the actual objects, so I get warnings
> from
> > QML on the console (saying myObject is null). These seem harmless enough,
> > but I would like to avoid having any warnings at all.
>
> When working with the QAbstractItemModel, items can only be deleted via
> resetting the model, or when removing rows/columns. The row/column removal
> shall happen in three phases:
>
> 1) call beginRemoveRows
> 2) remove the internal representation, freeing the MyObject instances
> 3) call endRemoveRows
A related question:
is it mandatory to have exactly this order or can I do:
beginRemoveRows(... row1, row1);
beginRemoveRows(... row17, row17);
...
endRemoveRows();
endRemoveRows();
?
If yes, would all row numbers correspond to the number BEFORE I removed any row ?
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
More information about the Interest
mailing list