Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Designed and Grid Layout: how to span multiple columns/rows?

Qt Designed and Grid Layout: how to span multiple columns/rows?

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 4 Posters 52.5k 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
    calberto
    wrote on 17 Jan 2011, 09:10 last edited by
    #1

    Is it possible, with the designed, configure a widget to span over multiple columns/rows, as I can do width addWidget()?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 17 Jan 2011, 09:30 last edited by
      #2

      I just tried it: yes, it is.

      @

      <?xml version="1.0" encoding="UTF-8"?>
      <ui version="4.0">
      <class>Form</class>
      <widget class="QWidget" name="Form">
      <property name="geometry">
      <rect>
      <x>0</x>
      <y>0</y>
      <width>193</width>
      <height>85</height>
      </rect>
      </property>
      <property name="windowTitle">
      <string>Form</string>
      </property>
      <widget class="QWidget" name="">
      <property name="geometry">
      <rect>
      <x>10</x>
      <y>10</y>
      <width>158</width>
      <height>54</height>
      </rect>
      </property>
      <layout class="QGridLayout" name="gridLayout">
      <item row="0" column="0">
      <widget class="QPushButton" name="pushButton">
      <property name="text">
      <string>PushButton</string>
      </property>
      </widget>
      </item>
      <item row="0" column="1">
      <widget class="QPushButton" name="pushButton_2">
      <property name="text">
      <string>PushButton</string>
      </property>
      </widget>
      </item>
      <item row="1" column="0" colspan="2">
      <widget class="QPushButton" name="pushButton_3">
      <property name="text">
      <string>PushButton</string>
      </property>
      </widget>
      </item>
      </layout>
      </widget>
      </widget>
      <resources/>
      <connections/>
      </ui>
      @

      1 Reply Last reply
      0
      • C Offline
        C Offline
        calberto
        wrote on 17 Jan 2011, 09:51 last edited by
        #3

        [quote author="Andre" date="1295256652"]I just tried it: yes, it is.

        @
        <layout class="QGridLayout" name="gridLayout">
        ...
        <item row="1" column="0" colspan="2">
        ...
        @[/quote]

        Do You mean I have to manually change the ui file? I cannot find I "visual" way to do it inside the Qt Designer (running from Qt Creator on Windows XP, Qt 4.7.0).

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 17 Jan 2011, 09:55 last edited by
          #4

          No, I created the file completely with designer itself.

          What I did was drop the three buttons in roughly the way I wanted them (so with the bottom botton spanning the width of both top buttons together), selected them, and applied a grid layout on them. I pasted the resulting .ui file.

          Edit:
          You can also change it later. I just dropped an additional button on the grid on the right, and Qt Designer created another column and put the button in the new top-right cell. Now I just dragged the button's bottom edge downwards, over the border of the cell, and Designer made the top right cell span two rows and put the button in the middle of it.

          Feels quite natural to me.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            calberto
            wrote on 17 Jan 2011, 10:03 last edited by
            #5

            ! Its was too simple to find! I'm sorry. It can also be done on an existing layout by simple dragging a side of a widget over the adjacent cell.

            Thanks

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jdbastardy
              wrote on 17 Jan 2011, 11:00 last edited by
              #6

              That's a nice feature. I am not going mad anymore with layouts :-)
              [quote author="calberto" date="1295258628"]! Its was too simple to find! I'm sorry. It can also be done on an existing layout by simple dragging a side of a widget over the adjacent cell.

              Thanks
              [/quote]

              http://mattias-cibien.co.cc

              • Prepare for Qt consequences.
              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jeff B
                wrote on 7 Feb 2015, 18:26 last edited by
                #7

                The answer that keeps on giving. Thanks that was driving me nuts trying to get a button box to span across the bottom of a 3 column grid layout.

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Jeff B
                  wrote on 7 Feb 2015, 18:26 last edited by
                  #8

                  The answer that keeps on giving. Thanks that was driving me nuts trying to get a button box to span across the bottom of a 3 column grid layout.

                  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