2017-10-23 1 views
0

내 프로그램에 QGraphicsScene이 첨부 된 QGraphicsView 위젯을 사용합니다.QGraphicsScene addRect 잘못된 렌더링

std::vector<unsigned int> nodesCoordsOnScreen; 
    for(int i=0; i<nodesCoords.size(); i++) 
    { 
     unsigned int tempCoord = spaceH+nodesCoords.at(i)*perOneMmH; 
     graphVW->scene()->addEllipse(tempCoord, -4, 8, 8, standartPen); 
     QGraphicsTextItem* tempText = graphVW->scene()->addText(QString::number(i+1)); 
     tempText->setPos(tempCoord+8, 0); 
     graphVW->scene()->addEllipse(tempCoord+8, 5, 15, 15, standartPen); 
     nodesCoordsOnScreen.push_back(tempCoord); 
    } 

을하고이 문제가 있습니다 : 이 부분은 완벽하게 작동

for(int i=0; i<bars->rowCount(); i++) 
    { 
     unsigned int begin = barsCoords.at(i).first; 
     unsigned int end = barsCoords.at(i).second; 
     unsigned int begCrd = nodesCoordsOnScreen.at(begin-1); 
     unsigned int endCrd = nodesCoordsOnScreen.at(end-1); 
     graphVW->scene()->addRect(begCrd+4, (barsAreas.at(i)/2)*perOneMmV, endCrd-begCrd, 
           -(barsAreas.at(i))*perOneMmV, standartPen); 
    } 

말썽이 이상하다 : 두 번째 부분은 렌더링 할 때 - 그것은 잘못된 렌더링,하지만 난 프로그램 창을 이동하거나 최소화 할 경우 정상 상태로 돌아 가면 올바른 것으로 렌더링됩니다.

+0

[Minimal, Complete, Verifiable example] (https://stackoverflow.com/help/mcve)이 도움이됩니다. –

+0

나는이 프로그램으로 github에 대한 링크를 제공 할 수 있지만 영어로 된 일부 텍스트는 없다. – dimas

+0

나는 스크린 샷을 할 수 없다. 내가 할 때 렌더링이 정상이되기 때문이다. – dimas

답변

0

도면 다음에 QtGraphicsScene :: update()를 사용하면됩니다.