Graphicsview didn't change, changing Graphicsscene larger, should not impact the project view when it is run. The window never change, isn't it? (solved)
To place a rect at the bottom of the scene.
i have to set scene, view and rect all 600 width.
I change GraphicsScene larger, didn't expect the view to change.
I thought since the view didn't change, changing scene (width-900, height-900), should not impact the project when it is run, isn't it?
scene.setSceneRect(0, 0, 600, 600); //step 1- scene 600 QGraphicsRectItem* rect = new QGraphicsRectItem(); rect->setRect(0,500,600,20); //full width 600 view.resize(600, 600); //step3 -view 600 view.show();
I simply set QGraphicsView and QGraphicsScene same parameter
qreal LCDScreenX = 0; qreal LCDScreenY = 0; qreal LCDScreenWidth = CComponent::m_LCDWidth; qreal LCDScreenHeight = CComponent::m_LCDHeight; QRectF LCDScreenSize(LCDScreenX,LCDScreenY,LCDScreenWidth,LCDScreenHeight); qDebug() <<LCDScreenX <<LCDScreenY <<LCDScreenWidth <<LCDScreenHeight; QGraphicsScene scene; scene.setSceneRect(LCDScreenSize); QSize ViewGraphicSize(CComponent::m_LCDWidth,CComponent::m_LCDHeight); view.resize(ViewGraphicSize); view.show();