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. Add space between toolbar and dock widgets

Add space between toolbar and dock widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
main windowwidgetui designdock widget
6 Posts 2 Posters 1.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.
  • M Offline
    M Offline
    Maluna34
    wrote on 31 May 2022, 14:24 last edited by
    #1

    Hello !

    I have in my window a toolbar at the top and a dock widget on the left.
    But I don't manage to get any space between them:
    dbb8c560-462e-41a7-ab97-3cadbb33e782-image.png

    The only solution I found is to add an empty top dock widget to create this space.
    Isn't it possible to set the space size?

    Thanks!!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tink
      wrote on 31 May 2022, 14:47 last edited by
      #2

      Well you can use the layout to add space, or add a spaceritem.
      https://doc.qt.io/qt-6/qspaceritem.html#details

      M 1 Reply Last reply 31 May 2022, 15:19
      0
      • T Tink
        31 May 2022, 14:47

        Well you can use the layout to add space, or add a spaceritem.
        https://doc.qt.io/qt-6/qspaceritem.html#details

        M Offline
        M Offline
        Maluna34
        wrote on 31 May 2022, 15:19 last edited by
        #3

        @Tink Thank you but how add this spacer into the main window layout?

        T 1 Reply Last reply 31 May 2022, 16:52
        0
        • M Maluna34
          31 May 2022, 15:19

          @Tink Thank you but how add this spacer into the main window layout?

          T Offline
          T Offline
          Tink
          wrote on 31 May 2022, 16:52 last edited by
          #4

          @Maluna34 After reading your post again, i think perhaps all you need is to set contentsmargin?
          E.g. ui->centralwidget->layout()->setContentsMargins(0,40,0,0);

          M 1 Reply Last reply 31 May 2022, 18:19
          0
          • T Tink
            31 May 2022, 16:52

            @Maluna34 After reading your post again, i think perhaps all you need is to set contentsmargin?
            E.g. ui->centralwidget->layout()->setContentsMargins(0,40,0,0);

            M Offline
            M Offline
            Maluna34
            wrote on 31 May 2022, 18:19 last edited by
            #5

            @Tink It does not work. :(

            T 1 Reply Last reply 31 May 2022, 19:36
            0
            • M Maluna34
              31 May 2022, 18:19

              @Tink It does not work. :(

              T Offline
              T Offline
              Tink
              wrote on 31 May 2022, 19:36 last edited by
              #6

              @Maluna34 said in Add space between toolbar and dock widgets:

              @Tink It does not work. :(

              I'm sorry, my last remark was non-sensical since a dockwidget is not part of the centralwidget. This is probably some very specific dockwidget stuff that i don't know about. Perhaps some of the guru's here will know if it's possible.

              1 Reply Last reply
              0

              2/6

              31 May 2022, 14:47

              4 unread
              • Login

              • Login or register to search.
              2 out of 6
              • First post
                2/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved