[Qt-interest] QAbstractItemModel::setHeaderData() and headerData()
j
j at dynamica.org
Fri Jan 29 18:26:15 CET 2010
thanks, I get it now, but still, I think I'll go for he multiple-
inheritance variation because I already have subclasses of
'MyModel' outside of 'RenderTools' depending on it. it's easier
that way. Incidentally, why is everybody so much 'against'
multiple inheritance, personally, I really like it,
it seems quite natural to me ;)
J
> Hi,
>
> On Friday 29 January 2010 16:31:23 j wrote:
>> >OK so why not do the simple thing and derive your own view that
>> >contains the model? E.g.
>> >...
>> >No need for multiple inheritance. Just get you MyModel class to
>> >override the headerData() function as normal and you are set.
>> >Or did I miss something subtle that you need in addition?
>>
>> The thing is, MyModel comes from my own 'RenderTools'
>> library that I do not want to mix with Qt. I want to be
>> able to use that independently with f.i. glut. So I
>> cannot place a Qt class above any class in RenderTools.
>> Right now I'm writing a "Qt-view" for RenderTools, but I
>> want to keep my 'glut-view' on RenderTools as well..
>>
>> makes sense ?
>
> Yes, but you never mentioned this as a requirement before. It is still easy to
> work around. Just make this kind of structure:
>
> class MyQtModel : public QAbstractTableModel
> {
> ...
> private:
> MyModel* m_data;
> };
>
> and use that as the member instead of MyModel* in the MyView class shown in my
> previous email.
>
> With this way you have single inheritance, a "Qt model", and your "generic
> model".
>
> HTH,
>
> Sean
More information about the Qt-interest-old
mailing list