I create one QGraphicsWidget inside which in two columns I want to place circles.
So inside this widget tree layout are created. One main to store two vertical Layouts.
m_hbMainLayout = new QGraphicsLinearLayout(Qt::Horizontal);
vbLeftLayout = new QGraphicsLinearLayout(Qt::Vertical);
vbRightLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_hbMainLayout->addItem(vbLeftLayout);
m_hbMainLayout->addItem(vbRightLayout);
if (layout())
delete layout();
setLayout(m_hbMainLayout);
m_hbMainLayout = new QGraphicsLinearLayout(Qt::Horizontal);
vbLeftLayout = new QGraphicsLinearLayout(Qt::Vertical);
vbRightLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_hbMainLayout->addItem(vbLeftLayout);
m_hbMainLayout->addItem(vbRightLayout);
if (layout())
delete layout();
setLayout(m_hbMainLayout);
To copy to clipboard, switch view to plain text mode
Then I add circles by
vbLeftLayout->addItem(devGUIChild);
vbLeftLayout->setAlignment(devGUIChild,Qt::AlignVCenter);
vbLeftLayout->addItem(devGUIChild);
vbLeftLayout->setAlignment(devGUIChild,Qt::AlignVCenter);
To copy to clipboard, switch view to plain text mode
But at the end circles aren't placed as I expect.

Those circles should be placed vertically evenly and in the middle. Right ones are placed evenly, but the left one isn't placed in the middle.
This approach works fine when I work with normal widgets and layout. Could some one tell me how to fix it?
Bookmarks