
Originally Posted by
babu198649
Different view has to display different data based on the same model.So returning data for a particular view from the data() function is not possible.
No problem. You have the "original" model called modelOriginal and two views A and B which displays the data of modelOriginal in different ways. So create two models modelForA and modelForB like this:
class modelForA : public modelOriginal
{...};
{
QVariant originalData
= modelOriginal
::data(...
);
// here alter the data for the model A and return it
return modifiedData;
}
class modelForA : public modelOriginal
{...};
QVariant modelForA::data(...)
{
QVariant originalData = modelOriginal::data(...);
// here alter the data for the model A and return it
return modifiedData;
}
To copy to clipboard, switch view to plain text mode
VoilÃ
Bookmarks