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. Tabbed QDockWidgets: how to fetch the QWidgets "under" a QTabBar ?

Tabbed QDockWidgets: how to fetch the QWidgets "under" a QTabBar ?

Scheduled Pinned Locked Moved General and Desktop
14 Posts 3 Posters 7.4k Views
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    I'd rather search for a QTabWidget and ask for the current widget.

    Hope it helps

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HornetMaX
      wrote on last edited by
      #3

      [quote author="SGaist" date="1401565464"]Hi,

      I'd rather search for a QTabWidget and ask for the current widget.
      [/quote]

      I tried, there's no QTabWidget, only a QTabBar (that is created and destroyed automatically whenever some QDockWidgets are tabified).

      MaX.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        QStackedLayout/QStackedWidget ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HornetMaX
          wrote on last edited by
          #5

          [quote author="SGaist" date="1401570231"]QStackedLayout/QStackedWidget ?[/quote]

          None between the children of the QMainWindow.

          I have uploaded a minimal Qt Creator example here, if you want to have a look: "QDockWidget - QTabBar":https://drive.google.com/file/d/0BzmU7Qoo77i1UFpiVzBzVDZ2Qjg/edit?usp=sharing

          When running, put the 3 QDockWidgets on the left together (tabify them), then hit CTRL-L and it will print some info via qDebug(), including all the children of the main window.

          MaX.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Looks like it goes down in the guts of QMainWindow. If you want to get the current widget, I'd go with tabifiedDockWidgets and check which one is currently visible.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              HornetMaX
              wrote on last edited by
              #7

              [quote author="SGaist" date="1401654398"]Looks like it goes down in the guts of QMainWindow. If you want to get the current widget, I'd go with tabifiedDockWidgets and check which one is currently visible.[/quote]

              Hmmm, no: a tabified qdockwidget is visible even when his tab is not the current one: I can't use "isVisible()" to get which one is current.

              Also, if there are two areas that can have tabified widgets (and hence two QTabBar objects), how can one see who's belong to who ?

              Seems too big a lack to be true ...

              MaX.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                I must say that I never encountered the need to check which of my QDockWidget were visible when stacked. Can you describe your use case ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  HornetMaX
                  wrote on last edited by
                  #9

                  It's no big deal in fact: I have two keyboard shortcuts that toggle the visibility of my 2 QDockWidgets. When the widgets are not tabified (i.e. they are either docked alone or floating), this is OK. When they are tabified I can put some code in the actions in order to do nothing (that's easy), but for consistency it would be nicer if the action would make the associated widget current in the QTabBar. But to make the widget current I have to know his index, thing that seems to be not easy to get.

                  There's probably some sort of dirty workaround checking the "name" of the tab (tabText) and using it to find the widget it belongs to. Still, it seems strange nothing is available for this purpose.

                  MaX.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Are you using the toggleViewAction from QWidget for that ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      HornetMaX
                      wrote on last edited by
                      #11

                      [quote author="SGaist" date="1401745680"]Are you using the toggleViewAction from QWidget for that ?[/quote]

                      No, my own (trivial) action: if not tabified, toggle visibility, if tabified, do nothing (as I'm unable to do what I'd like to do).

                      MaX.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        You can try to make a feature request for that on the "bug report system":http://bugreports.qt-project.org

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          HornetMaX
                          wrote on last edited by
                          #13

                          [quote author="SGaist" date="1401811706"]You can try to make a feature request for that on the "bug report system":http://bugreports.qt-project.org [/quote]

                          Just created this: "https://bugreports.qt-project.org/browse/QTBUG-39489":https://bugreports.qt-project.org/browse/QTBUG-39489

                          MaX.

                          1 Reply Last reply
                          0
                          • W Offline
                            W Offline
                            wuqi
                            wrote on last edited by
                            #14

                            http://stackoverflow.com/questions/22230042/how-to-detect-if-a-tabified-qdockwidget-is-the-active-tab This may help

                            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