Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, October 2007
QTreeView and different column count at different levels


Message 1 in thread

Hi,

is there a way of creating a QTreeView, that has a different number of
columns on different levels?

What I'm trying to do is something like:

+ Long Text (e.g. Category)
|--- Item | Text | Text
|-+- Item | Text | Text
  |- Item | Text | Text
  |- Item | Text | Text
|--- Item | Text | Text
|--- Item | Text | Text
+ Long Text (e.g. Category)
|--- Item | Text | Text
|-+- Item | Text | Text
  |- Item | Text | Text
  |- Item | Text | Text
|--- Item | Text | Text
|--- Item | Text | Text

Thanks,
    Sven

--
 [ signature omitted ] 

Message 2 in thread

I believe that setFirstColumnSpanned is the function you are looking for.
Available in Qt 4.3.

Ryan

Sven Flossmann wrote:
> Hi,
> 
> is there a way of creating a QTreeView, that has a different number of
> columns on different levels?
> 
> What I'm trying to do is something like:
> 
> + Long Text (e.g. Category)
> |--- Item | Text | Text
> |-+- Item | Text | Text
>   |- Item | Text | Text
>   |- Item | Text | Text
> |--- Item | Text | Text
> |--- Item | Text | Text
> + Long Text (e.g. Category)
> |--- Item | Text | Text
> |-+- Item | Text | Text
>   |- Item | Text | Text
>   |- Item | Text | Text
> |--- Item | Text | Text
> |--- Item | Text | Text
> 
> Thanks,
>     Sven
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 3 in thread

Hi,

Thanks, that's basically what I was looking for.

@trolls:
But, I'm wondering just a little bit, why the QTreeView does not do this
automatically. I mean, the QAbstractItemModel has method
columnCount(), so it should theoretically be possible.

With setFirstColumnSpanned() it is possible, but one has to call this
method several times, for each root level item and if data changes, this
must be repeated.

Many thanks Ryan,
	Sven

Ryan Winter wrote:
> I believe that setFirstColumnSpanned is the function you are looking for.
> Available in Qt 4.3.
> 
> Ryan
> 
> Sven Flossmann wrote:
>> Hi,
>>
>> is there a way of creating a QTreeView, that has a different number of
>> columns on different levels?
>>
>> What I'm trying to do is something like:
>>
>> + Long Text (e.g. Category)
>> |--- Item | Text | Text
>> |-+- Item | Text | Text
>>   |- Item | Text | Text
>>   |- Item | Text | Text
>> |--- Item | Text | Text
>> |--- Item | Text | Text
>> + Long Text (e.g. Category)
>> |--- Item | Text | Text
>> |-+- Item | Text | Text
>>   |- Item | Text | Text
>>   |- Item | Text | Text
>> |--- Item | Text | Text
>> |--- Item | Text | Text
>>
>> Thanks,
>>     Sven
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body. List archive and information:
>> http://lists.trolltech.com/qt-interest/
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 

--
 [ signature omitted ]