Answer the question
In order to leave comments, you need to log in
How to return a custom widget in overriding the model's data method?
QVariant A::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
Day *day = new Day(index);
return day;
}
return QVariant();
}
Answer the question
In order to leave comments, you need to log in
The model only returns values, you need to create a QItemDelegate and screw it into the View
Read Qt Assistant. Examples from Qt SDK sources in folders:
../examples/widgets/itemviews/spinboxdelegate
../examples/widgets/itemviews/stardelegate
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question