QGraphicsView and QSplitter
Hello,
I'm having trouble to manager two graphics views in a QSplitter. If I comment the line that adds a rect onto the scene, my splitter have good stretchFactors and behave like intended, but as soon as I add my rect, the first view (index 0 in the splitter) gets wider. Even without using the setStretchFactor lines and by hardcoding a size for the scene it dosen't react properly. Any suggestions ?
Code:
m_firstScene
->addRect
(0,
10,
10,
10,
QPen(Qt
::black),
QBrush(Qt
::gray));
m_secondView->setScene(m_secondScene);
m_firstView->setScene(m_firstScene);
m_secondView->setAlignment(Qt::AlignTop|Qt::AlignLeft);
m_firstView->setAlignment(Qt::AlignTop|Qt::AlignLeft);
m_horizontalSplitter->addWidget(m_firstView);
m_horizontalSplitter->addWidget(m_secondView);
m_horizontalSplitter->setOrientation(Qt::Horizontal);
m_horizontalSplitter->setStretchFactor(0,1);
m_horizontalSplitter->setStretchFactor(1,5);
this->setWidget(m_horizontalSplitter);
Thank in advance