Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do I add another tab to QtTabWidget using QtDesigner ?



  • I am trying to get a hang of using QtDesigner.
    It looks as I can copy some parts and not some other.

    I have QTabWidget with two original tabs and I like to "copy and paste" more tabs into it.

    My latest attempt created another QTabWidget within the first tab , not what I intended to do.

    If I select / highlight tab itself - QWidget - I have no option to "copy " it.

    Suggestions on how to do this would be appreciated.

    PS
    Do the panes in QtDesigner GUI have names ?

    fe974721-b2df-423d-bbd3-2106832e720a-image.png



  • @AnneRanch said in How do I add another tab to QtTabWidget using QtDesigner ?:

    more tabs

    Right-click on one of your tabs or the tabWidget in your list on the right and select "add page" or "insert page" (I dont know the exact term since my QtC is not in English language). It's the 11th option from top.

    BTW:
    Your centralWidget doesn't have a layout (red crossed circle sign next to the name).

    Edit:

    It seems that you've copied your whole tabWidget (because you have cascading tabs)



  • Thanks, works perfect.
    Even when my Qt is in English "Page" and "Tab" are not the same in MY dictionary. I do not mind misleading terminology / labels if I do have a backup copy or I do see easy way to delete the results.
    But generally I am hesitant to use it.
    I am sure I'll have some fun deleting the extras I have accidentally" created .



  • @AnneRanch

    QStackedWidget is another example...
    I guess its content is called "page" too, but in this case it makes a bit more sense, since it works like a book of widgets, where you can flip the "pages" to change your visible widgets in place.

    Some things need some time to get familiar with.

    Edit:
    Page is only the content of QTabWidget. You create a new "page", which is connected to the tabWigets' tabBar, showing which "page" is currently active and to provide the functionality of changing pages by clicking the "tabs". If this makes sense :)
    (If they had called it "Tab", somebody would say "Why "tab" and not "page"?)

    Edit^2:

    The C++ functions to add tabs are indeed called addTab() and insertTab()
    https://doc.qt.io/qt-5/qtabwidget.html#addTab



  • @Pl45m4Your are correct on both counts - it takes some practice.
    I unfortunately recall, , I would rather forget that experience , "tab" in MFC . Never did mastered the "tab bar" and "pages" relations...
    I am slowly practising "switching" between GUI and "text".
    So far my program still compiles and runs...or just limps along...
    Still collecting "#includes " as I go .

    As I was afraid , adding all this "ui_..." stuff is a challenge to a greenhorn.

    Many thanks for all you help, appreciate it.


Log in to reply