vieraci
7th November 2007, 04:03
I'm designing a mainMenu form a bit like Qt Assistant and other GUI forms I've seen with a tree on the left and a stackedWidget on the right.
I want to react to a tree item selection and flip the stackedWidget to the corresponding page. The cleanest and less-coding method I can think of is obtaining an integer of the selected menu item row so in my code I can simply code
stackedWidget->setCurrentIndex(row)
I've experimented with both QTreeWidget or QTreeView and in both cases, I have to extract the parent and child and write a long if...else if...endif block to see what was selected. If there's no row() function available in either QTreeWidget or QTreeView I would probably add an invisible column that holds an int row.
I also want to dynamically be able to insert or remove pages to the stackedWidget and update the tree at runtime via double-click and/or context menu on the tree.
Which is more suitable...QTreeWidget or QTreeView ?
All comments and criticism cheerfully accepted.
Thanks,
I want to react to a tree item selection and flip the stackedWidget to the corresponding page. The cleanest and less-coding method I can think of is obtaining an integer of the selected menu item row so in my code I can simply code
stackedWidget->setCurrentIndex(row)
I've experimented with both QTreeWidget or QTreeView and in both cases, I have to extract the parent and child and write a long if...else if...endif block to see what was selected. If there's no row() function available in either QTreeWidget or QTreeView I would probably add an invisible column that holds an int row.
I also want to dynamically be able to insert or remove pages to the stackedWidget and update the tree at runtime via double-click and/or context menu on the tree.
Which is more suitable...QTreeWidget or QTreeView ?
All comments and criticism cheerfully accepted.
Thanks,