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. Is there a way to customize/Replace QMdiArea's QTabBar which shows opened Tabs list like in FireFox?

Is there a way to customize/Replace QMdiArea's QTabBar which shows opened Tabs list like in FireFox?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 9.8k 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.
  • M Offline
    M Offline
    ManasQt
    wrote on last edited by
    #1

    Hi,
    I am not able to figure it out customizing/replace the QTabBar inside QMdiArea.
    Can we replace QTabBar with custom QTabBar ? I want to add more widgets to the QTabBar, so that it will display custom widgets (QPushButtons,QCheckBox....) right after the QTabBar's scrollbars. The reason for this is QMdiArea/QTabBar doesn't have a way to list opened Tabs in ContextMenu. When you have more Tabs open its hard to select the desired /specific one instead of scrolling all the way to that one.

    can any one please tell me how to achieve this?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      A QMdiArea doesn't have a tab bar.

      You can add whatever widget you want to the MDI subwindows, including your own subclasses of a tab widget or a tab bar.

      What did you do exactly?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        ManasQt
        wrote on last edited by
        #3

        Hi Volker,
        Well i am not trying to add any widget to the Mdi Subwindows and I know that QMdiArea doesn't have an ability to set/get QTabBar directly. we can get the TabBar by searching QMdiArea's children like,

        tabBar=QMdiArea.findChild(QtGui.QTabBar)

        I am actually exploring whether can we create/replace QTabBar inside QMdiArea with the one like in Mozilla FireFox ,
        [<][tab1] [tab2] [tab3] [tab4] [tab5] [...] [>] [+] [/]
        left scroll| Tabs...................................|right scroll | add new Tab| show Tabs list

        I can create a custom TabBar with all these features though but how to embed/replace QTabbar inside QMdiArea?
        Is there a way to create Mozilla Firefox kind of TabBar?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          There is no easy way to do that. You might get close by using a combination of:

          • eventFilters
          • style sheets to modify rendering and create some additional room
          • inserting additional widgets into the tabbar (and manually controlling their layout).

          I think there would be plenty of interest in something like that, especially if it does not require subclassing QTabBar as that would make it usable with QTabWidget and QMdiArea as well.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            I still do not get the relation of that tab bar to a [[Doc:QMdiArea]]. The latter is supposed to be a container for arbitrarily sized and positioned MDI sub windows. Your idea looks much more like an advanced [[Doc:QTabWidget]].

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              QMdiArea has a "tab":http://developer.qt.nokia.com/doc/qt-4.8/qmdiarea.html#viewMode-prop mode, so the question is relevant.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                [quote author="Andre" date="1326178521"]QMdiArea has a "tab":http://developer.qt.nokia.com/doc/qt-4.8/qmdiarea.html#viewMode-prop mode, so the question is relevant. [/quote]

                OMG - I never realized that this sneaked in. I take back everything - sorry for the confusion, please.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  ManasQt
                  wrote on last edited by
                  #8

                  Hi Andre,Volker,
                  What could be the reason for

                  • QMdiArea not having setTabBar() method which allows us to customize the TabBar
                  • QTabBar not having setCornerWidget() method which allows us to insert any widget
                    and allow user to set scrollbars as left scrollbar on left side rightscrollbar on right side

                  i mean seriously why do they have to control these features?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    For the first, I guess 'encapsulation'. For the second, I guess it is deemed up to the style to determine how they render the tabs.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      ManasQt
                      wrote on last edited by
                      #10

                      Hi Andre,
                      Thanks for the explanation. I have some other doubts i can't figure it out myself, Can you please explain,
                      Why does QMdiArea returns the activeSubWindow() as None(0) when it lost the focus?

                      even when QMdiArea gains the focus back it still returns the activeSubWindow() as None(0)

                      but only when you switch between windows QMdiArea returns the activeSubWindow() as QMdiSubWindow

                      Thanks in advance

                      1 Reply Last reply
                      0
                      • Z Offline
                        Z Offline
                        zzz9_z
                        wrote on last edited by
                        #11

                        Hi, much time passed since the topic was started but I think I have figured out the solution (I have the same question at stackoverflow).

                        If you can get QTabBar you can hide it! Then you can make your own widget with QMdiArea and a custom tab bar layed out vertically connecting signals/slots of each other. The custom class may have all the public members of both QMdiArea and custom sidebar.

                        I haven't tried it yet but I think it worth a try.

                        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