11

This might very well be very stupid question, but I can not find QTabBar in Qt Designer. There is QTabWidged in the "Containers" group, but it is not the same - I don't need different pages, I just need the tab bar.

(I am using 4.7.2 version of Qt Designer under KDE4 on debian.)

gorn
  • 5,042
  • 7
  • 31
  • 46

3 Answers3

7

There is no item in the designer that is a QTabBar, the only way you could accomplish this is by creating a plain QWidget and promoting it to a tabbar, but you will then have to set up the whole thing in code.

As for the pages you do realize that you can also promote the content widgets of a QTabWidget in designer to any subclass of QWidget, builtin or something that you created.

Harald Scheirich
  • 9,676
  • 29
  • 53
  • 1
    You mean promote in code or there is a way to do it in Designer? The reason I do not need pages is that there is going to be quite expansive widget on every "page" so I prefer to have only one instance of this and reload its contents on every tab click. – gorn Apr 01 '11 at 23:50
  • Information on [promoting in Qt Designer in 4.8](http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html). – Phrogz Oct 19 '14 at 22:49
2

In Qt Designer 4.8 you can add a Widget where you want the QTabBar to be, and then right-click and choose "Promote To ▸ QTabBar". (Note: "Promote To", not "Morph Into")

Phrogz
  • 296,393
  • 112
  • 651
  • 745
0

Create a Custom Tab Widget class inheriting from QTabWidget and set the tab bar to your custom tab bar. Like this:

class CustomTabWidget(QTabWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setTabBar(CustomTabBar())

After that, you can just promote your existing QTabWidget element whose tab bar you wish to change from within the Qt Designer.

Note: I have done it in PySide6. Although, I hope it aleast gives an idea about how to solve the problem.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Esa Anjum
  • 13
  • 3