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. QDockWidget resize handle style not working.
Forum Updated to NodeBB v4.3 + New Features

QDockWidget resize handle style not working.

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 3.3k 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.
  • K Offline
    K Offline
    KrabQT
    wrote on last edited by KrabQT
    #1

    It is probably common Qt fail, but i can't find the solution.

    I have QMainWindow which should have typical IDE like GUI (header with fixed height (buttons etc.), left resizable dockable sidebar (project files etc.), right resizable dockable sidebar (AST view, properties, etc.), bottom resizable dockable sidebar (compiler output etc).

    So i decided to use QDockWidget, which is what i need except that the header shouldn't be resizable at all. This is not a problem, you can setup QSizePolicy::Fixed for Header height.

    The problem is when using stylesheets, because if the header is not resizable, the space for separator (eg. resize handle) is still reserved but the seperator itself is not painted (which is logical if the size of header is fixed and you can't resize it, BUT THAN THE SPACE FOR SEPARATOR SHOULDNT BE RESERVED). This leads to behavior where your style is not applied to the space for separator and you see some background color of underlying window.

    Here you can see the condition which says the separator is not painted.
    https://github.com/qtproject/qtbase/blob/dev/src/widgets/widgets/qdockarealayout.cpp#L1644

    I need the separator to be painted because it acts for me even as border.

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

      I'm not sure I understand. What do you mean by a "header"? Which class is that? Usually the buttons are placed on a toolbar (QToolBar) which can be made movable or stationary.

      K 1 Reply Last reply
      0
      • Chris KawaC Chris Kawa

        I'm not sure I understand. What do you mean by a "header"? Which class is that? Usually the buttons are placed on a toolbar (QToolBar) which can be made movable or stationary.

        K Offline
        K Offline
        KrabQT
        wrote on last edited by KrabQT
        #3

        @Chris-Kawa The header will be QFrame subclass with custom content probably. I don't want to use QToolBar because i have feel that it is very limited to just put some buttons in single row. Because the header should be from corner to corner, i can't add it as child of centralWidget if using DockWidgets on sides. So i need to add the Header via QDockWIdget in top area and set the fixed policy for height. But than that weird behavior appears.

        I will probably make some changes in Qt code, compile it and use that my version for my app, because it is impossible to do what i need (it is actually weird because the IDE like GUI is very common).

        The first two "rows" of this GUI looks similar to header i want.
        http://twofuckingdevelopers.com/wp-content/uploads/tswsmac_02.png

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

          Instead of modifying Qt you can put QMainWindow in a vertical layout in another widget. This way you could place whatever you want above the QMainWindow.

          K 1 Reply Last reply
          1
          • Chris KawaC Chris Kawa

            Instead of modifying Qt you can put QMainWindow in a vertical layout in another widget. This way you could place whatever you want above the QMainWindow.

            K Offline
            K Offline
            KrabQT
            wrote on last edited by
            #5

            @Chris-Kawa That is good idea, thanks. But i need even that QMenuBar funcionality from QMainWindow. The menu should be drawn before that hypothehic vertical layout (so not be part of QMainWindow in that case).

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

              QLayout has a setMenuBar method. Despite the misleading name it can use any QWidget, including a toolbar or menu bar or another widget with both in another vertical layout. It's pretty flexible. A setup similar to that on the picture you posted looks easy to do this way.

              Another way is to use a main window which would handle menu bars and toolbars and then place a widget with vertical layout as a central widget. Inside that layout you would have a custom widget for that breadcrumb thingie from the picture and a main window under it to handle docks and main content.

              K 1 Reply Last reply
              1
              • Chris KawaC Chris Kawa

                QLayout has a setMenuBar method. Despite the misleading name it can use any QWidget, including a toolbar or menu bar or another widget with both in another vertical layout. It's pretty flexible. A setup similar to that on the picture you posted looks easy to do this way.

                Another way is to use a main window which would handle menu bars and toolbars and then place a widget with vertical layout as a central widget. Inside that layout you would have a custom widget for that breadcrumb thingie from the picture and a main window under it to handle docks and main content.

                K Offline
                K Offline
                KrabQT
                wrote on last edited by
                #7

                @Chris-Kawa Yes it sounds good, i will try it. Didn't though that way the QMainWindow can be actually used inside another widget.

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

                  QMainWindow is just a QWidget like any other. The biggest difference is that it has a private layout customized for docking functionality. I think the reason most don't tend to realize this is because of the misleading name which suggests it should be the top level widget, which it doesn't have to be.

                  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