PDA

View Full Version : QGridLayout scaling widgets



Markus_AC
24th November 2011, 11:37
I'm having a problem about the scaling of widgets in a QGridLayout.
I have a layout with 7 rows and 1 or 2 columns. There is a header in row 0.

Then after I want to put a widget in row 1 (only 1 column) and a QwtPlot and a QLabel in row 2. And so forth in the next rows. I do not select any fixed height for my QwtPlot widgets and QLabels (in rows 2, 4 and 6). My pheader and the widgets in rows 1, 3 and 5 have a fixed width.



QGridLayout *layout = new QGridLayout(this);
if(layout != 0)
{
layout->addWidget(pheader, 0, 0);
layout->addWidget(topWidget, 1, 0);
layout->addWidget(topGraph, 2, 0);
layout->addWidget(topGraphLabel, 2, 1);
layout->addWidget(midWidget, 3, 0);
layout->addWidget(midGraph, 4, 0);
layout->addWidget(midGraphLabel, 4, 1);
layout->addWidget(botWidget, 5, 0);
layout->addWidget(botGraph, 6, 0);
layout->addWidget(botGraphLabel, 6, 1);
}

setLayout(layout);

It is strange that the widgets in row 4 are larger (in height) than those in row 2 and 6, but all should be of the same size.

Before this I used a QVBoxLayout, because I didn't have the QLabel behind the QwtPlot, and all QwtPlot-Widgets had the same size.

What can I do to make the QwtPlots to equal size?