Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Displaying an QTabWidget
Qt 6.11 is out! See what's new in the release blog

Displaying an QTabWidget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 661 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtanian
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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-prop

      So 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);
      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved