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. Resizing parent QLayout, and resizing QForm widget rows
QtWS25 Last Chance

Resizing parent QLayout, and resizing QForm widget rows

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 206 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.
  • C Offline
    C Offline
    CEO.
    wrote on last edited by
    #1

    qwidgetscrol.JPG qwidgetcode.JPG

    Hello, kindly study this code and guide me on how I can increase the size of the parent widget. As you can see in one of the attached photos showing the gui, how can I enlarge the widget which is the scrollable area there?

    Also, how can I increase the length and breadth of the widgets QLineEdit (rows) in the QFormLayout?

    The codes below are extracts:

    <>```
    widget = QWidget()
    #widget.setGeometry(100,100,700,500)
    hbox = QHBoxLayout(widget)
    gbox = QGroupBox()
    vbox = QVBoxLayout()
    glayt = QGridLayout()

        fbox = QFormLayout()
        fbox.setVerticalSpacing(20)
        fbox.setHorizontalSpacing(20)
    
        hbox.addLayout(glayt)
        hbox.addLayout(vbox)
        glayt.addWidget(gbox,1,2,1,2)
        gbox.setLayout(fbox)
    
    jsulmJ 1 Reply Last reply
    0
    • C CEO.

      qwidgetscrol.JPG qwidgetcode.JPG

      Hello, kindly study this code and guide me on how I can increase the size of the parent widget. As you can see in one of the attached photos showing the gui, how can I enlarge the widget which is the scrollable area there?

      Also, how can I increase the length and breadth of the widgets QLineEdit (rows) in the QFormLayout?

      The codes below are extracts:

      <>```
      widget = QWidget()
      #widget.setGeometry(100,100,700,500)
      hbox = QHBoxLayout(widget)
      gbox = QGroupBox()
      vbox = QVBoxLayout()
      glayt = QGridLayout()

          fbox = QFormLayout()
          fbox.setVerticalSpacing(20)
          fbox.setHorizontalSpacing(20)
      
          hbox.addLayout(glayt)
          hbox.addLayout(vbox)
          glayt.addWidget(gbox,1,2,1,2)
          gbox.setLayout(fbox)
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @CEO Looks like "widget" wasn't added to any layout. Do you actually need it? registerTB is already a QWidget.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CEO.
        wrote on last edited by
        #3

        I actually was using self.setLayout(glayt) where glayt = QGridLayout()
        but someone said I should use that widget = QWidget() and setting it to my scrollarea since I don't understand scrollArea that much. But it turns out not to give me what I expected and the person couldn't help further. So if you can guide me, I can also share with the person.

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

          Hi,

          As said by @jsulm, there's no need here for that "widget" variable.

          As for QScrollArea, you only need a dummy widget if you do all the construction in the same widget you declare QScrollArea in.

          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
          1
          • C Offline
            C Offline
            CEO.
            wrote on last edited by
            #5

            To resolve it, I used a gridLayout as the parent widget, then I set the scrollArea widget to be resizable(True)codi.JPG

            This makes everywhere in the gbox which I set as the scrollArea widget to be resizable. I ensured the other widgets are coded inside. I set the first layout, vbox to the gbox

            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