Answer the question
In order to leave comments, you need to log in
How to return a QList from overriding the data method of a model?
In writing a delegate, I encountered such a problem: my data represents a dictionary. The key is a date, and the data corresponding to that date is a MyClass list. How can I get it in the delegate. Here is the code:
QMap<QDate, QList<MyClass*>*>::const_iterator item = lessons.begin();
switch (role) {
case Roles::DateRole:
return item.key();
case Roles::LessonRole:
return QVariant((item.value()));
default:
return QVariant();
Answer the question
In order to leave comments, you need to log in
You need qvariant_cast
doc.qt.io/qt-5/qtcore-tools-customtype-example.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question