SeanM
29th January 2014, 20:36
I feel like this should be a simple layout question, but I'm having trouble getting it to work...
I've got a custom widget that inherits from QWidget and has a QGridLayout member that is set on this widget itself
myContainer::myContainer(QWidget* parent):QWidget(parent)
{
m_layout = new QGridLayout;
setLayout(m_layout);
}
I've got two types of widgets that go into the grid, so the grid is going to be an (n,2) grid (n rows, 2 columns). As the application is resized, I want the height of the widgets in my grid to be roughly (1/N * height of myContainer). So basically I want the application's layouts to figure out what how many pixels to give myContainer, and once that's figured out, then resize all the rows so that all the rows are visible. Instead it seems to be working from the inside out, where the items in the rows are getting some default height, which then pushes the height of myContainer to be N * that height, which then makes the application taller than the height of an actual monitor which means some of the rows aren't visible.
I've tried setting the vertical size policies of all my widgets to QSizePolicy::Maximum, but that doesn't seem to get it to work correctly.
I've got a custom widget that inherits from QWidget and has a QGridLayout member that is set on this widget itself
myContainer::myContainer(QWidget* parent):QWidget(parent)
{
m_layout = new QGridLayout;
setLayout(m_layout);
}
I've got two types of widgets that go into the grid, so the grid is going to be an (n,2) grid (n rows, 2 columns). As the application is resized, I want the height of the widgets in my grid to be roughly (1/N * height of myContainer). So basically I want the application's layouts to figure out what how many pixels to give myContainer, and once that's figured out, then resize all the rows so that all the rows are visible. Instead it seems to be working from the inside out, where the items in the rows are getting some default height, which then pushes the height of myContainer to be N * that height, which then makes the application taller than the height of an actual monitor which means some of the rows aren't visible.
I've tried setting the vertical size policies of all my widgets to QSizePolicy::Maximum, but that doesn't seem to get it to work correctly.