Qlist geometry interference with GridLayout in QT Designer
Hi all,
I try to design a dialog with QtDesigner. Inside a Group box i want the following layout
label... Spinbox1 Spinbox1
####
#....#
#....# . Lineedit
#....#
#....#
####
where ### is the listbox.
every time I try to use a grid layout the size of the list box grows to much bigger size than I need. Even if i set the sizePolicy to fixed to Minimum or every other value
How can I prevent this nasty behaviour ?
Thanks an have a nice day
dexli
Re: Qlist geometry interference with GridLayout in QT Designer
setting maximum width must work.
Re: Qlist geometry interference with GridLayout in QT Designer
Or you can use the stretch parameter to QBoxLayout::addWidget() to apportion the available space in a known ratio:
Code:
#include <QtGui>
#include <QDebug>
Q_OBJECT
public:
layout->addWidget(list, 1); // allocate 1 unit to this
layout->addWidget(edit, 2); // and 2 units to this
central->setLayout(layout);
setCentralWidget(central);
}
public slots:
private:
};
int main(int argc, char *argv[])
{
MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"
How you tweak the layout depends on exactly what behaviour you want.
Re: Qlist geometry interference with GridLayout in QT Designer
Thanks for the hints.
I decide to omit the layout around this widget. This was the easiest way, because the other solutions seem to be a kind of hacking.