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 ?

Qt Code:
  1. m_firstView = new QGraphicsView(this);
  2. m_secondView = new QGraphicsView(this);
  3.  
  4. m_firstScene = new QGraphicsScene(0,0,100,100,m_firstView);
  5. m_secondScene = new QGraphicsScene(m_secondView);
  6.  
  7.  
  8. m_firstScene->addRect(0,10,10, 10, QPen(Qt::black), QBrush(Qt::gray));
  9.  
  10. m_secondView->setScene(m_secondScene);
  11. m_firstView->setScene(m_firstScene);
  12.  
  13.  
  14. m_secondView->setAlignment(Qt::AlignTop|Qt::AlignLeft);
  15. m_firstView->setAlignment(Qt::AlignTop|Qt::AlignLeft);
  16.  
  17.  
  18.  
  19. m_horizontalSplitter = new QSplitter(this);
  20.  
  21. m_horizontalSplitter->addWidget(m_firstView);
  22. m_horizontalSplitter->addWidget(m_secondView);
  23. m_horizontalSplitter->setOrientation(Qt::Horizontal);
  24.  
  25. m_horizontalSplitter->setStretchFactor(0,1);
  26. m_horizontalSplitter->setStretchFactor(1,5);
  27.  
  28. this->setWidget(m_horizontalSplitter);
To copy to clipboard, switch view to plain text mode 

Thank in advance