Change widgets in Qt

I would like to receive suggestions on how to use Qt to implement the following:

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

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

I need to change the display order of tabs or buttons (see image):

alt text

A widget that is set to an index does not remain in the same index, but must follow the title.

It doesn’t have to be exactly as I am describing, it’s more important than the general idea of ​​reordering my widgets.

Thanks to everyone.

+3
source share
1 answer

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

, , , , :

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

Source: https://habr.com/ru/post/1766271/


All Articles