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. To many QDockWidget in one area
Forum Updated to NodeBB v4.3 + New Features

To many QDockWidget in one area

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

    Hello!

    I have trouble with QDockWidgets. I have a lot tab that are docked on the right side. They are squeez and unreadable. Look img: !https://www.dropbox.com/lightbox/home?select=tab.PNG(Squeezed tabs)!

    https://www.dropbox.com/sh/xj02uino8v3ms04/AACYz74JCLgYrpwZW94Y5vSva?dl=0

    They should have some scrool bar or second bar line offset to left.

    Any idea?

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

      QTabWidget by default extends to hold entire text and provides scroll buttons for tabs that don't fit:
      !http://i296.photobucket.com/albums/mm188/crossblades666/tabs.jpg(Tabs)!

      You seem to have custom styling applied. Check if you restrict the maximum size of the tab or disable scroll buttons.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        poonury
        wrote on last edited by
        #3

        Thanks for your response.

        Hmm I comment styles and problem still exists so this was not by style.

        This how do it:

        Set some options:
        @
        setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::ForceTabbedDocks | QMainWindow::VerticalTabs);
        setTabPosition(Qt::RightDockWidgetArea, QTabWidget::East);
        setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::West);
        setTabPosition(Qt::BottomDockWidgetArea, QTabWidget::South);
        @

        Create single tab:
        @
        m_pObjects3DTab = new O3DM::Components::Objects3DTabWidget(tr("Objects 3D"),this); (title , parent, flag = 0 )
        m_pObjects3DTab->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
        @

        Tabify docks widget:
        @
        std::vector<QDockWidget*>::iterator itTabWidget;
        for (itTabWidget = m_vTabWidgets.begin(); itTabWidget != m_vTabWidgets.end(); ++itTabWidget)
        {
        if (NULL != (*itTabWidget))
        {
        tabifyDockWidget(pPreviousDocWidget,*itTabWidget);
        if (NULL == pPreviousDocWidget)
        {
        addDockWidget(Qt::RightDockWidgetArea, *itTabWidget);
        }

        (*itTabWidget)->setFloating(false);
        pPreviousDocWidget = (*itTabWidget);

        pPreviousDocWidget->setContextMenuPolicy(Qt::CustomContextMenu);
        }
        }
        @

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

          Sorry, I jumped to the answer too quickly.
          Seems that dock widgets behave a little different than QTabWidget by default. When you create a tabbed docks Qt creates a QTabBar dynamically with the elide mode set to eliding text.
          So you need to react to that (connect to dockLocationChanged and topLevelChanged signals of the docks). Then find the dynamic QTabBar and set the elision mode to none:
          @
          auto tabbar = mainWindow->findChild<QTabBar*>(QString(), Qt::FindDirectChildrenOnly);
          if(tabbar) //might be null if there are no tabbed docks
          tabbar->setElideMode(Qt::ElideNone);
          @
          If there can be more than one tabbed areas use findChildren instead of findChild and iterate over the resulting list.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            poonury
            wrote on last edited by
            #5

            Ok problem solved...

            Thank you very much :)

            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