tags:

views:

43

answers:

1

Hi, I would like to have suggestions as to how to use Qt to implement the following:

I have multiple identical widgets that I want to display once at a time.

I know that QToolbox exists, but the problem is the following:

I need to change the order in which the tabs or buttons appears (see image):

alt text

The widget that is set to an index does not stay at the same index, but should follow the header.

It doesn't have to be exactly as I describe, it's more the general idea of reordering my widgets that matters.

Thanks to all.

+2  A: 

To change the order of the children, you can use QToolBox::removeItem() and QToolBox::insertItem(int index, QWidget *widget, const QString & text)

If you don't need random placement, but simply having the top widget moved to the bottom is sufficient, a couple of lines are enough to rotate the widgets :

QWidget *widget = toolBox->widget(0);
QString text = toolBox->itemText(0);
toolBox->removeItem(0);
toolBox->addItem(widget, text);
Fred