Am 25.02.2016 um 19:22 schrieb Milian Wolff:
Can you explain what those reasons are? I'd really love to write a generic QAbstractTableModel implementation that operates using concepts. Currently that would require type erasure and thus another set of virtual function calls...I.e. in many projects I end up writing the same boiler plate code to display a QVector<MyRowType> in a view. As far as I can see most of that could be abstracted away easily, leaving only slim concepts to the struct: struct MyRowType { QString foo; int bar; QVariant data(int column, int role) const { if (!role == Qt::DisplayRole) return {} switch (column) { case 1: return foo; case 2: return bar; } return {}; } };
Yes, please! Writing the almost same list model over and over again is boring. Although MyRowType::data() should not be a member, but a free-standing function to allow any type to be used as row data type.
If we'd have templates QObjects, the above could easily be written. I bet there are other valid use-cases.
QFutureWatcher comes to mind. Regularly using its pattern in projects and would prefer I could avoid this boilerplate.
Ciao, Mathias _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
