Hi, Il 02/11/18 07:05, Shawn Rutledge ha scritto:
This is reasonable given the tree-of-tables that QAbstractItemModel models; there's the bigger question of whether the one-API-fits-all is a good way forward, however I don't see anyone willing to rewrite the model classes for this. (There are also another couple of ideas I have in the QAIM department, e.g. a multiData(), which is just BC because it's a new virtual).If anyone was willing to work on it, what sort of API would you propose?
(Side note: please double check your email client, it seems you've got Sérgio as contact for the development mailing list :-))
For this sort of API, something really simple, along the lines of
struct Data { Qt::ItemDataRole role; QVariant data; }; virtual vector<Data> multiData(const QModelIndex &index, vector<Data> roles) const;
(We can bikeshed on the exact signature, and if we should be using some "small map" type, QVector, std::vector, ...). Anyhow, the idea is to pass the set of roles that we want to read for a given index, and get the data for all those roles in one go. This should help stop hammering data() once per role; of course, the default implementation will simply call data() multiple times.
My 2 c, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: Firma crittografica S/MIME
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development