PDA

View Full Version : QTreeWidget Dilemma



JediSpam
17th November 2011, 22:17
I'm having a hard time trying to figure out what I need to do with the application I'm writing. I'll give some psuedocode to explain.

Basically, I have a QTreeWidget holding two different sets of QTreeWidgetItems

On Launch I Want Set A to appear.

As soon as Set B data is avaiable, i want it to display automatically and CLEAR Set A's data.

I want to display Set A's data off and on (clearing Set B) with a Toggle button (QAbstractButton).



Constructor:
connect(ui.FullSystemButton, SIGNAL(toggled()), this, SLOT(FullSystem())); //will this work when the button is pushed in?



MainWindow::CheckPackets
{
//This function contains Set B and will refresh every 5 seconds on a QTimer. Once started it will ALWAYS run.
}



MainWindow::FullSystem
{
//This function contains Set A and will show on default. I want this function to show data on a toggle switch.
}

d_stranz
17th November 2011, 22:59
A really simple way to do this is to use TWO QTreeWidget instances inside a QStackedWidget or QStackedLayout and simply toggle between them. Use one tree for A and one for B, and display whichever one of them is appropriate.

JediSpam
18th November 2011, 13:48
Thanks I will give that a try!