[Development] Qt6 source changes

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Nov 2 17:52:44 CET 2018


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.dangelo at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20181102/985f6b49/attachment.bin>


More information about the Development mailing list