[Qt-interest] subitems for QTableWidget
Ferenc Stelcz
ferenc at stelcz.hu
Thu Jun 11 11:23:17 CEST 2009
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
More information about the Qt-interest-old
mailing list