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

Qt-interest Archive, January 2007
QTreeWidgetItem::type isn't cloned by QTreeWidgetItem::clone() [Qt 4.2.2]


Message 1 in thread

When I create a QTreeWidgetItem object and clone it, the type of the new 
object is set to zero.  Is this a bug, or the expected behavior?

I noticed the doc says that I can define new user types in QTreeWidgetItem 
subclasses, but I don't really need to subclass it just to define new 
types, do I?   I should be able to use whatever integer values I want for 
the type, as long as I don't exceed the max value of 1000.

The following code reproduces the error:
---------------
QTreeWidget *myTree = new QTreeWidget();
QTreeWidgetItem *firstItem = new QTreeWidgetItem(myTree, 1);
QTreeWidgetItem *secondItem = firstItem->clone();
int firstType = firstItem->type();      // = 1, correct
int secondType = secondItem->type();    // = 0, incorrect
---------------

Thanks,
Josh