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. setRowStretch() dynamically change?
Qt 6.11 is out! See what's new in the release blog

setRowStretch() dynamically change?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 2 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
    Schiho
    wrote on last edited by
    #1

    After Creating a Grid-Layout i would like to change the setRowStretch() dynamically, when adding new Elements. How is that possible. It seems that the setRowStretch() is frozen, when i once set it and start the application.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you share a sample code where you setup your QGridLayout and call setRowStretch ?

      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
      • S Offline
        S Offline
        Schiho
        wrote on last edited by
        #3

        spacerItem = QSpacerItem(20,80,QSizePolicy.Minimum,QSizePolicy.Expanding)

        n = self.grid.rowCount() + 1
        self.grid.addItem(spacerItem, n, 1)
        self.grid.setRowStretch(n, n)
        

        Theoretically, everytime i call t his function, the last element will be stretched the most right?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It won't make the row itself bigger, it will allow it to grow more if needed.

          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

          • Login

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