[Qt-interest] subitems for QTableWidget

Sujan Dasmahapatra sdh at lmglasfiber.com
Thu Jun 11 12:43:37 CEST 2009


Thanks Ferenc you have got my point. Now I am going re-implemente
treewidget instead of tablewidget.

Kind Regards,
Sujan Dasmahapatra

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Ferenc Stelcz
Sent: Thursday, June 11, 2009 2:53 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] subitems for QTableWidget

Sujan Dasmahapatra wrote:
> Dear Friends
> 
> I have a QTableWidget with only one column.I am suing it basically as
> part  tree.But now I want to add some subitems under each part.Can  u
> plss tell me how would I go about it.
> 
>  

You can't do it as Alessandro Portale pointed you already kindly out 
yesterday. And then others too. Please set the +r flag first :)

Is your tablewidget looking like this right now? ::

[header]
--------
[item_a]
[item_b]
[item_c]

Do you want to look it like this? ::

[header]
--------
[item_a]
     [item_a1]
         [item_a1_1]
         [more_items]
     [item_a2]
     [ more  ]
[item_b]
[item_c]
     [item_c1]
     [ more  ]

Doesn't this figure remind you on a TREEWIDGET?
BINGO!!! That's what you are looking for. Period.

Explanation:
Tables (IMHO) are for representing data in a n-by-m grid (forget about
merging 
and splitting cells like in OOo Calc or MS Excel etc. for now). So if
you have 
a tablewidget with one column, you can represent your data in it in a
1-by-m 
grid. If you want to add a sub-item to one of your items (a row) in the
first 
and only column, then your table MUST grow to a 2-by-m grid or else you
get a 
new row in column #1, which is not what you want I think.
So here comes the treewidget widgety-thingy which lets you add columns
to only 
those rows which actually have any sub-items.

HTH

p.s. #1 : Please-please-please try to be more accurate, and forget about
"u" 
and "pls" and "plss". The correct form is: you and please. We're not on
IRC 
nor MSN nor are we some 10 year old emo-like kiddies. :)
No, my native language isn't english either but reading and practicing
it can 
help a lot.

p.s. #2 : Before asking your next question please read this carefully: 
http://catb.org/esr/faqs/smart-questions.html

and last but not least: don't take this as an offense.

--
Ferenc Stelcz
Junior Software Engineer

Banyan Technologies LLC.


__________ Information from ESET Smart Security, version of virus
signature database 4146 (20090611) __________

The message was checked by ESET Smart Security.

http://www.eset.com


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




More information about the Qt-interest-old mailing list