Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QTabBar vs QTabWidget

I am using QTabWidget in my project. Is there any stron reason I should use QTabBar and not QTabWidget?

What advantages I have if I use QTabWidget?

like image 907
RLT Avatar asked Dec 29 '09 09:12

RLT


People also ask

What is QTabBar?

QTabBar is straightforward to use; it draws the tabs using one of the predefined shapes, and emits a signal when a tab is selected. It can be subclassed to tailor the look and feel. Qt also provides a ready-made QTabWidget.

How do I use tab widget in Qt?

The normal way to use QTabWidget is to do the following: Create a QTabWidget. Create a QWidget for each of the pages in the tab dialog, but do not specify parent widgets for them. Insert child widgets into the page widget, using layouts to position them as normal.


1 Answers

QTabWidget associates a QWidget to each tab of a QTabBar. So widget management when switching from one tab to an other is already done by the QTabWidget class. It was done for convenience. See documentation for more details : http://doc.qt.io/qt-4.8/qtabwidget.html#details.

QTabBar is only a tab bar. You can do every thing you want when switching from one tab to an other. More details.

The best advantage is that QTabWidget combines QTabBar AND QStackedWidget behaviors.

like image 182
Patrice Bernassola Avatar answered Nov 03 '22 07:11

Patrice Bernassola