Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. GridLayout Help
Forum Updated to NodeBB v4.3 + New Features

GridLayout Help

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 251 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.
  • M Offline
    M Offline
    Marcus Adamski
    wrote on 31 Dec 2020, 14:00 last edited by
    #1

    Hello there,

    I'm using GridLayout for the first time and looking to create a simple Dlg:

            grid_layout = QGridLayout()
            grid_layout.addWidget(self._info_lbl, 0, 0, rowSpan=2, columnSpan=3)
            grid_layout.addWidget(QLabel("name: "), 2, 0, rowSpan=1, columnSpan=1)
            grid_layout.addWidget(self._name_txt, 2, 1, rowSpan=1, columnSpan=2)
            grid_layout.addWidget(QLabel("type: "), 3, 0, rowSpan=1, columnSpan=1)
            grid_layout.addWidget(self._types_cmb, 3, 1, rowSpan=1, columnSpan=2)
            grid_layout.addWidget(self._button_box, 4, 0, rowSpan=1, columnSpan=3)
            self.setLayout(grid_layout)
    

    However, the problems are:

    • I was expecting the label in the first row to be allocated 2 rows, but it only uses one
    • the LineEdit and Combo are on the far right of the layout and only appear to be taking up one column
    • I would like to add a margin / space between the buttons and the above controls. What's the best approach for this?

    Could anyone point me in a direction for a good tutorial on GridLayout and spanning / SizePolicy, so I can understand this better.

    Much appreciated,
    Marcus

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 31 Dec 2020, 19:53 last edited by
      #2

      Hi,

      Can you provide a minimal runnable script that shows that behaviour ?

      Which version of PyQt/PySide are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      2/2

      31 Dec 2020, 19:53

      • 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