Displaying an QTabWidget
-
Hey there,
I've created an QTabWidget as an extra file/class (TabBottomArea.h, TabBottomArea.cpp, TabBottomArea.ui). Now I want to display this on the MainWindow on the bottom. Mainly I can display QDockWidgets with:
@addDockWidget(Qt::BottomDockWidgetArea, myVeryCoolDockWidget)@
but how I can display a QTabWidget ON the bottom on it?
Regards,
Jan -
Hi, welcome to devnet,
You set a widget of the dock with "setWidget":http://qt-project.org/doc/qt-5/qdockwidget.html#setWidget.
If you would like the tabs of the QTabWidget on the bottom of it then you can use "setTabPosition":http://qt-project.org/doc/qt-5/qtabwidget.html#tabPosition-propSo something like this:
@
auto bar = new QTabWidget();
bar->setTabPosition(QTabWidget::South);
bar->addTab(new QWidget(), "Tab1");
bar->addTab(new QWidget(), "Tab2");auto foo = new QDockWidget("Foo");
foo->setWidget(bar);addDockWidget(Qt::BottomDockWidgetArea, foo);
@