[Qt-interest] Adding items in QTreeWidget in arbitrary order
Irfan Omair
irfan.omair.qt at gmail.com
Wed Mar 17 19:39:09 CET 2010
Hi Ville,
that is because you are doing
1. QTreeWidgetItem *item = new QTreeWidgetItem(this, itemh);
2. QTreeWidgetItem *item2 = new QTreeWidgetItem(this, itemh2);
3. QTreeWidgetItem *item3 = new QTreeWidgetItem(this, itemh3);
if you do insertToplevelItem() that wont be inserted if that item has
already been inserted some where else (unless you remove it)
so if inspite of making item as above if you do QTreeWidgetItem *item
= newQTreeWidgetItem
(itemh);
This should solve your problem.
Hope this helps
Regads,
Irfan Omair
On Wed, Mar 17, 2010 at 5:15 AM, Ville Ranki <ext-ville.1.ranki at nokia.com>wrote:
>
> Hello,
>
> I can't figure out how to add items to a QTreeWidget in
> the middle. Here's a code example:
>
> http://pastebin.ca/1843464
>
> As a result "Middle item" is added as last item, although
> I'm trying to insert it to the middle (at index 1). Even
> inserting item with index 0 results it being added in the end
> of the list.
>
> Any ideas?
>
> Tested with Qt 4.5 on Ubuntu Jaunty.
>
> --
> Ville Ranki <ext-ville.1.ranki at nokia.com>
> Symbio/Nokia
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100317/279c210f/attachment.html
More information about the Qt-interest-old
mailing list