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. Problem with stretching QGridLayout
QtWS25 Last Chance

Problem with stretching QGridLayout

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 363 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.
  • W Offline
    W Offline
    Wugge
    wrote on 10 Jan 2024, 22:12 last edited by
    #1

    Hello, I'm using PyQT6 and I want to create the following graphic (rough sketch):
    Example.png
    I have figured out most things but how I can do the red part.
    I want to have that area to stretch on the horizontal but not on the vertical. It should only take up as much space as it needs for the buttons and title to fit. If I scale the window and the buttons don't fit in the row anymore, they should go to the next row and the area should stretch with it.
    Because of my previous projects using tkinter I'm used to the QGridLayout way of working and therefore wanted to use it here. Maybe it isn't the right choice. However what I need is that I can place a new button anywhere, not only in the "back". So for example I need to be able to say "this buttons should be on position 3"
    If you could help me with that, I would be really glad.

    P 1 Reply Last reply 10 Jan 2024, 23:51
    0
    • W Wugge
      10 Jan 2024, 22:12

      Hello, I'm using PyQT6 and I want to create the following graphic (rough sketch):
      Example.png
      I have figured out most things but how I can do the red part.
      I want to have that area to stretch on the horizontal but not on the vertical. It should only take up as much space as it needs for the buttons and title to fit. If I scale the window and the buttons don't fit in the row anymore, they should go to the next row and the area should stretch with it.
      Because of my previous projects using tkinter I'm used to the QGridLayout way of working and therefore wanted to use it here. Maybe it isn't the right choice. However what I need is that I can place a new button anywhere, not only in the "back". So for example I need to be able to say "this buttons should be on position 3"
      If you could help me with that, I would be really glad.

      P Offline
      P Offline
      Pl45m4
      wrote on 10 Jan 2024, 23:51 last edited by
      #2

      @Wugge said in Problem with stretching QGridLayout:

      It should only take up as much space as it needs for the buttons and title to fit. If I scale the window and the buttons don't fit in the row anymore, they should go to the next row and the area should stretch with it.

      like this?

      • https://doc.qt.io/qt-6/qtwidgets-layouts-flowlayout-example.html

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      2

      2/2

      10 Jan 2024, 23:51

      • Login

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