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. [SOLVED] QGridLayout: widget takes too much space
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QGridLayout: widget takes too much space

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.5k 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.
  • S Offline
    S Offline
    Sh4dd0w
    wrote on last edited by
    #1

    I've met a problem that QToolBar takes way too much space on my layout so other widgets are moved too far from the place where they should be. I've tried SetMaximumSize(), SetFixedSize() and so on and none works. Yes, I've read post describing why QGridLayout has no "MaximumSize" property, although I've read a lot of other posts and nothing helps... Could you give me an advice please?
    !http://img20.imageshack.us/img20/1684/toolbarj.png(some illustration)!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sh4dd0w
      wrote on last edited by
      #2

      I can't believe nobody has something to say :(
      If you need more information just say it...

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gmaro
        wrote on last edited by
        #3

        Hi,

        I would like to help but I don't see clearly your problem. Can you share the code corresponding to the used widgets and layout? On other hand - how you set the size policies?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Honestly, I don't quite get your example, but I'll try it anyway: you have a QGridLayout, consisting of several widgets left and right of a QToolBar, which keeps growing larger then it has to be.

          Well, this is due to the fact that the default size policy for QToolBar is Preferred, which basically means that QToolBar might expand if there is additional space, although it doesn't benefit from doing so.

          Just set the size policy to Maximum, which prevents the QToolBar from exceeding its absolutely minimum dimensions.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sh4dd0w
            wrote on last edited by
            #5

            Solved by now. Thanks all.
            What didnt help: setting QToolBar's sizePolicy
            What helped: setting QToolBar's to Minimum,Maximum and adding few Expanding QSpacerItem

            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