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. Problem with not showing tabs in tabified QDockWidget?

Problem with not showing tabs in tabified QDockWidget?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.6k 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.
  • N Offline
    N Offline
    never_ever
    wrote on last edited by
    #1

    Hi,
    I have QMainWindow, where I have:

    • centralWidget containing QWidget
    • statusBar
    • toolBar

    I have menu in main window with action actionAddDock. When that action is triggered there should be addNewDock slot called. That slot calls method addDock(QString title).
    But the reason I write is that when I call it first time the tab is not showing (QDockWidget is showing but without tab). Only when there is at least two QDockWidgets the tabs are showing up.

    constructor:
    @
    MyWindow::MyWindow(QWidget *parent)
    : QMainWindow(parent)
    {
    ui.setupUi(this);

    setDockConfiguration();
    connect(ui.actionAddDock, SIGNAL(triggered(bool)),
      this, SLOT(addNewDock()));
    

    }
    @

    setDockConfiguration():
    @
    void MyWindow::setDockConfiguration()
    {
    setDockOptions(AnimatedDocks | AllowTabbedDocks | ForceTabbedDocks);
    setTabPosition(Qt::BottomDockWidgetArea, QTabWidget::North);
    setTabShape(QTabWidget::Rounded);
    }
    @

    addNewDock():
    @
    void MyWindow::addNewDock()
    {
    addDock("Test");
    }
    @

    addDock(QString title):
    @
    void MyWindow::addDock(QString title)
    {
    QDockWidget *newDock = new QDockWidget(title, this);
    newDock->setTitleBarWidget(new QWidget());
    newDock->setAllowedAreas(Qt::BottomDockWidgetArea);

    newDock->setFloating(false);
    newDock->setFeatures(QDockWidget::DockWidgetMovable 
    /*QDockWidget::DockWidgetClosable |
    QDockWidget::DockWidgetFloatable*/);
    addDockWidget(Qt::BottomDockWidgetArea, newDock);
    
    // Add docking widget to list QList<QDockWidget*> dockList;
    bool isEmpty = dockList.isEmpty();
    if(!isEmpty)
    {
      int index = dockList.size() - 1;
      tabifyDockWidget(dockList[index], newDock);
    }
    dockList.append(newDock);
    

    }
    @

    Is there any way to show tab when there is only one QDockWidget?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      that's how it is implemented. So this is not supported.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      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