[Interest] [solved] Model::data() only called with role == Qt::sizeHintRole

Eckhard Jokisch qt at eckhard-jokisch.de
Thu Apr 12 19:02:38 CEST 2012


On 04/12/12 18:04, Girish Ramakrishnan wrote:
> Hi,
> 
> On Thu, Apr 12, 2012 at 8:42 AM, Eckhard Jokisch <qt at eckhard-jokisch.de> wrote:
>> Hi,
>> in my custom subclass of QAbstractItemModel the data() is not called
>> with any other role than Qt::SizeHintRole.
>>
> 
> Maybe you do, if (role = Qt::SizeHintRole) by mistake in the code
> 
> Without code, I cannot guess more :)
> 
> Girish
Thanks for that hint.
>From that I knew it must be something obvious that I simply do not see.

Making MyModel::rowCount()
{
int count;
.....
qDebug() << "rows" << QString("%1").arg(count);
return count;
}

revealed that this allways returned 0 ....

Time for a break and some (beer)

Eckhard



More information about the Interest mailing list