I'd suggest using QStackedWidget (or QStackedLayout). It'll save you from flickering problems.![]()
I'd suggest using QStackedWidget (or QStackedLayout). It'll save you from flickering problems.![]()
J-P Nurmi
thanks jpn. From Assistant: "QStackedLayout class provids a stack of widgets where only one widget is visible at a time." Is there a Class in which I could put a stack of Layouts? ...so that only one layout is visible at a time?
Any Ideas here? I have my layouts, but I still don't know how to delete (or hide) them from the rootLayout.
Qt Code:
//creates 5 QHBoxLayouts for(int a=0; a<5; a++) { createLayouts(a); } rootLayout->addLayout(layout[0]); //only adds the first layout // function() will hide/remove "layout[0]" and show/add layout[1] connect(mainButton1, SIGNAL(clicked()), this, SLOT(function()));To copy to clipboard, switch view to plain text mode
but I don't see a way to hide or remove the first layout[0]
Last edited by vonCZ; 15th June 2007 at 15:39.
Install each layout on a plain QWidget and add them to a QStackedWidget.
J-P Nurmi
vonCZ (15th June 2007)
Sorry for such a short answer, I was in hurry. Anyway, as mentioned, I'd suggest installing each layout on a plain QWidget and then adding them to a QStackedWidget. Furthermore, you may construct a QButtonGroup out of the main buttons for switching pages more or less like this:
Qt Code:
... page1->setLayout(layout[0]); stack->addWidget(page1); ... page1->setLayout(layout[1]); stack->addWidget(page2); ... group->addButton(btn1, 0); // "page1" at index 0 group->addButton(btn2, 1); // "page2" at index 1 ... connect(group, SIGNAL(buttonClicked(int)), stack, SLOT(setCurrentIndex(int)));To copy to clipboard, switch view to plain text mode
J-P Nurmi
gotcha (i think): create 5 layouts with their respective widgets (buttons & labels). Also create 5 QWidgets; do:
Qt Code:
myQWidget_0->addLayout(myLayout_0);To copy to clipboard, switch view to plain text mode
for myQWidgets 0-4, then use QStackWidget to manage.
...working on it.
just saw your second response: excellent, thanks for the advice/direction.
Bookmarks