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. How to show title bar on docked QDockWidget?
Forum Updated to NodeBB v4.3 + New Features

How to show title bar on docked QDockWidget?

Scheduled Pinned Locked Moved General and Desktop
18 Posts 2 Posters 8.4k 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
    ningu
    wrote on last edited by
    #1

    I have a QDockWidget that, instead of docking, it completely closes when pressing the close button. Is there a way to still see the title bar when the widget is docked?

    Apparently it should be like that by default. Looking around for an answer I see that other people want to HIDE the title bar when docked, but I want it to be visible because now it isn't.

    The widget is set to be closable, not movable, not floatable and with a vertical titlebar.

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

      did you set the title with QWidget::setWindowTitle()?

      --- 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
      • N Offline
        N Offline
        ningu
        wrote on last edited by
        #3

        No, I added it with QtCreator. Should I code it?

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

          as long as you've set the windowTitle property you should be fine.
          If you did it seems like a bug in Qt. Can you test it on another system?

          --- 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
          • N Offline
            N Offline
            ningu
            wrote on last edited by
            #5

            I'm not sure I was using it properly. Should the close button (X) close or dock the window?

            I may try it with linux, but it will take a while because I'd have to install Qt.

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

              close it

              --- 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
              • N Offline
                N Offline
                ningu
                wrote on last edited by
                #7

                and how may I dock it? I can drag to expand and shrink the dock, but haven't found a way to dock it with one click. Can it be done?

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

                  -AFAIK this isn't possible.-
                  Only a button in docked state is displayed to make it floating. But not the other way around.
                  I think this has to do with the fact, that it's not clear where to put once it is floating. Because if you have many QDockWidgets the dock area's arrangement can have changed a lot in the meantime.

                  Edit: double clicking on the title-bar redocks the window

                  --- 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
                  • N Offline
                    N Offline
                    ningu
                    wrote on last edited by
                    #9

                    mmm... hold on, I think I got something wrong here. English is not my first language... I just realized I missunderstood what "dockable" means. Sorry about that. Now I do know what it means, and I see I wasn't using the right word.

                    What I need is a widget that behaves similarly to a QToolBox, but I need the tabs to be side by side, not one on top of the other, and different tabs may be open at the same time. As far as I can tell, QToolBox can't be tweaked that much (it was my first choice).

                    I thought that I could do it with QDockWidgets set side by side. Is that how I should do it or am I completely out of track?

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

                      There is no such widgets that comes with Qt which does what you want.
                      You will have to do it by your own i'm afraid.

                      Or you do it with the widgets you already know but with some losings of functionality.

                      --- 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
                      • N Offline
                        N Offline
                        ningu
                        wrote on last edited by
                        #11

                        Ok, thanks a lot!

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

                          actually you can give the QDockWidget approach another try.
                          You can use
                          @
                          dockWidget->setFeatures( QDockWidget::DockWidgetVerticalTitleBar );
                          @
                          Maybe this is already what you want?

                          --- 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
                          • N Offline
                            N Offline
                            ningu
                            wrote on last edited by
                            #13

                            Thanks.

                            I already took a look at that. It's nice, but I can't put dock widgets side by side.

                            Actually what I'm looking for is collapsible widgets that can be set side by side and that they show the vertical title bar when collapsed.

                            1 Reply Last reply
                            0
                            • N Offline
                              N Offline
                              ningu
                              wrote on last edited by
                              #14

                              I have been trying to create a collapsible dock widget, subclassing QDockWidget. I got as far as creating a clickable vertical title bar. But the key to success is being able to resize the dock widget to the title bar's width. I've been searching around, and it seems impossible to do. As far as I'm concerned, dock widgets cannot be resized. They adjust to their contents.

                              If their's a way to override this, it would be great. But I think I'll have to code a collapsible panel from scratch.

                              I'll start a new thread because I think this one would mislead others seeking the same.

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

                                and what happens when you "collapse" the widget by just hiding the widget inside the QDockWidget?
                                So you would need to listen to the double click event on the title bar widget and toggle the visibility of the content widget.

                                --- 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
                                • N Offline
                                  N Offline
                                  ningu
                                  wrote on last edited by
                                  #16

                                  hey! It works! Thank you very much!

                                  There are some issues with the height, which is affected as well, but I'm sure it's pretty easy to solve. I'll work on it and let you know my progressions.

                                  1 Reply Last reply
                                  0
                                  • N Offline
                                    N Offline
                                    ningu
                                    wrote on last edited by
                                    #17

                                    I haven't managed to solve the height issue.

                                    When I hide the widget inside the QDockWidget, it collapses in all directions, not just horizontally. So the widget resizes to the bar's minimum size, which is the minimum size of a button (I replaced the title bar widget with this great "OrientationButton":http://www.qtcentre.org/wiki/index.php?title=OrientationButton).

                                    How would you prevent it from collapsing veritcal-wise? If I set minimumHeight() to anything big, then it behaves awkwardly when the height of the window containing the QDockWidget is shrunk (if it can be shrunk at all).

                                    1 Reply Last reply
                                    0
                                    • N Offline
                                      N Offline
                                      ningu
                                      wrote on last edited by
                                      #18

                                      I just discovered QSplitter. Maybe that's what I'm looking for.

                                      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