[Qt-interest] data() in QAbstractItemModel

Pradeep K V pradeep.vijayan at gmail.com
Wed Dec 17 22:21:08 CET 2008


Hi,

data() is an important interface that provides 'data' to Views and 
Delegates to what it should show/do. If you notice, it has a role 
parameter passed. Views/Delegates 'queries' for data for each of these 
roles, when required, to get the information to display/perform 
different functions.

For example:
If you refer QAbstractItemView class, you can see:

QString statustip = d->model->data(persistent, 
Qt::StatusTipRole).toString();

Refer http://doc.trolltech.com/4.3/model-view-model-subclassing.html for 
more details.

I hope it helps.
Pradeep K V

ami guru wrote:
> Hello forum,
> 
> Any subclass of QAbstractItemModel must implement the pure virtual 
> function - data()
> 
> And i want to see when it is called and by whom. Browsing through the 
> examples i have not found any that calls the function
> data() belonging to the model though that function is executed.
> 
> Any hint?
> 
> 
> Sajjad

-- 
Pradeep K V
Bugless Software Development Ltd.
https://bugless.co.uk/



More information about the Qt-interest-old mailing list