• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

line up items and stretch in a Qt frid

I have 4 pairs of items.  4 labels and 4 combo boxes that go with the associated label.  For concreteness, call the items:

NW (for northwest)
NE (for northeast)
SW (for southwest)
SE (for southeast)

The problems I have are:

1) I would like to use a grid to horizontally line up the combo boxes for NW and SW (as well as NE with SE)
2) Instead of a grid, I want to use horizontal layout boxes so I can use a stretch

So: how to I get things to stretch when I put them on a grid?
1 Solution
Use QGridLayout::setColumnStretch(int column, int stretch)

QGridLayout *g = new QGridLayout();
g->setColumnStretch(0, 1);

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now