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. QGridLayout - I don't get it :(
Forum Updated to NodeBB v4.3 + New Features

QGridLayout - I don't get it :(

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 226 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.
  • HoMaH Offline
    HoMaH Offline
    HoMa
    wrote on last edited by
    #1

    Hi all and thanks for reading.
    I put a QGridLayout into a QWizardPage but it does not look as expected. In the third line, which should display a field for postal code and city - the postal code field is bigger than that of the city. Despite this code:

    QGridLayout* grid  = new QGridLayout;
    grid->addWidget(leAddress1, 0, 0, 1, 5);
    grid->addWidget(leAddress2, 1, 0, 1, 5);
    grid->addWidget(leStrasse,  2, 0, 1, 5);
    grid->addWidget(lePlz,      3, 0, 1, 1);
    grid->addWidget(leStadt,    3, 1, 1, 4);
    grid->addWidget(leEmail,    4, 0, 1, 5);
    grid->addWidget(leUrl,      5, 0, 1, 5);
    setLayout(grid); 
    

    pcbigcitysmall

    1 Reply Last reply
    0
    • HoMaH Offline
      HoMaH Offline
      HoMa
      wrote on last edited by
      #2

      OK - I found a solution! This code does the trick:

      QGridLayout* grid  = new QGridLayout;
      grid->addWidget(leAddress1, 0, 0, 1, 5);
      grid->addWidget(leAddress2, 1, 0, 1, 5);
      grid->addWidget(leStrasse,  2, 0, 1, 5);
      grid->addWidget(lePlz,      3, 0);
      grid->addWidget(leStadt,    3, 1, 1, 4);
      grid->addWidget(leEmail,    4, 0, 1, 5);
      grid->addWidget(leUrl,      5, 0, 1, 5);
      grid->setColumnStretch(0, 1);
      grid->setColumnStretch(1, 4);
      

      https://photos.app.goo.gl/xPWJtbQ2s9XAtZuZ9

      So the position in the grid plays less of a role - it is more about the stretching... Not that I think that I totally understand - but... it works.
      Thx if you thought about helping.

      Regards
      HM

      1 Reply Last reply
      1
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #3

        understanding size policies are also important, but admittedly, they are a PITA to get right.

        I light my way forward with the fires of all the bridges I've burned behind me.

        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