[Qt-interest] Fwd: QAbstractItemModel edit process

Nikos Gerontidis geronik444 at gmail.com
Wed Apr 21 19:59:13 CEST 2010


---------- Forwarded message ----------
From: Stephen Kelly <steveire at gmail.com>
Date: Wed, Apr 21, 2010 at 6:30 PM
Subject: Re: [Qt-interest] QAbstractItemModel edit process
To: qt-interest at trolltech.com


Nikos Gerontidis wrote:

> Hello list,
>
> I have subclassed the QAbstractItemModel class and reimplemented the
> setData and the other functions needed in order to make the model
> editable. I have created custom items and my model follows a tree
> structure and multiple columns.
> The problem is that when I edit my model for a given index for decoration
> prurposes, then this results to setting all columns with decoration flags
> enabled to
> be updated with the data given. To be more specific, I made an example
> post
> :
> *setData(model->index(1,4),QColor(Qt::blue),Qt::DecorationRole)*
> after updating this then also the data of model->*index(1,6)* are being
> updated.
> The above situation is not happening though when my model is being updated
> for the last column :
> *setData(model->**index(1,6)**,QColor(Qt::blue),Qt::DecorationRole)*
> *this does not result *to an update of *model->**index(1,4)*
>
> Does the model updates all remaining indexes until model->columnCount() ;
> If yes how could I end this update in order to set my data correctly? Any
> ideas?

That depends on how you implemented setData. It sounds like you accidentally
implemented it to change the color of all columns instead of just one.

> Thanks in advance..
>

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

Hi,
This could be it, I will check it and post again.
Thanks anyway.

-- 
Best Regards
Nikos Gerontidis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100421/aa4266a8/attachment.html 


More information about the Qt-interest-old mailing list