Hi everyone

I am working withr Qt 4.6 (which seems quite buggy), and I would like to know if these errors comes from me, or qt

I would like a qtreewidget, made of children, each children having children. So the design is:

TREE
  • Children 1
    • Sub Children 1
    • Sub Children 2
  • Children 2



Here I have my first issue. I successively tried:

Qt Code:
  1. QTreeWidget* tree = new QTreeWidget(parentwidget); //tree creation
  2. tree->setColumnCount(2); //not the point here but I need it
  3.  
  4. QTreeWidgetItem* main = new QTreeWidgetItem(tree); //1st level item creation
  5. QTreeWidgetItem* child= new QTreeWidgetItem(main); //2d level item creation, with 'main' as parent
  6. child->setHidden(false); //just to be sure
To copy to clipboard, switch view to plain text mode 

and

Qt Code:
  1. QTreeWidget* tree = new QTreeWidget(parentwidget);
  2. tree->setColumnCount(2);
  3.  
  4. QTreeWidgetItem* main = new QTreeWidgetItem(tree);
  5. QTreeWidgetItem* child= new QTreeWidgetItem(); //2d level creation, without parent
  6. main -> addChild(enfant); //link child->parent
  7. child->setHidden(false);
To copy to clipboard, switch view to plain text mode 

In both cases, I can't see the items but the 1st leveled one.
However with:

Qt Code:
  1. QTreeWidget* tree = new QTreeWidget(parentwidget);
  2. tree->setColumnCount(2);
  3.  
  4. QTreeWidgetItem* main = new QTreeWidgetItem(tree);
  5. QTreeWidgetItem* child= new QTreeWidgetItem(tree); //child is created as 1st level item
  6. child->setHidden(false);
To copy to clipboard, switch view to plain text mode 

Of course all items are 1st-level items now (which is not what I want), but at least they all are here!

So FIRST QUESTION:
What is wrong with my ways of including children to the 1st level item?
__________________________________________________ __________________________________________________ ________

Then, I am enjoying my all-1st-leveled items. They all are with the design:
[] Name_of_item,
[] being a checkbox.

Then I do:
Qt Code:
  1. QTreeWidgetItem* item = new QTreeWidgetItem(tree);
  2. item ->setCheckState(0,Qt::Checked); //to create the column 0 checkbox
  3. item->setText(1,tr("Name")); //to label the ligne
  4.  
  5. //blablabla do the same for other items
  6.  
  7. connect( tree , SIGNAL( itemClicked( QTreeWidgetItem*,int ) ), this, SLOT ( updateitem ( QTreeWidgetItem*,int ) ) );
To copy to clipboard, switch view to plain text mode 

So there, each item looks exactly as I want it to (which is greeeaaaaat). Let's click the first checkbox! Nothing. The second? Nothing. I am a little bit naive ; "Hum, my slot is buggy... Let's add some breakpoints..." The first one I had is right at the first line of the slot function, so if the slot function is read, the breakpoint is hit. Let's run it again. clic. clic. CLIC. CLIC. "SO why are you not hitting my breakpoint?!!!"

So there is my second question:
Why this tree is not clever enough to understand that when I clic on it, I want the itemClicked signal to be emitted?


Is there a way to solve these issues without having to use an older version of qt? I used qtreewidgets just like that with 4.3 and it worked, so what?!

Thanks,
M.