Unsolved Why graphics scene occupy whole graphics view?
-
Why graphics scene is beeing drawed in whole graphics view area? I invoked setSceneRect and scene does not have correct size as it supposed to have.
graphicsScene = std::make_shared<GraphicsScene>(new GraphicsScene(this)); graphicsScene->setSceneRect(0, 0, 250, 250); graphicsScene->setBackgroundBrush(QColor(123,123,123)); ui->canvas->setScene(graphicsScene.get());
Whole view area is gray (color(123,123,123)) regardless what view's size is. Even graphics items are beeing drawed outside scene rect. How to correcty set scene size?
-
Hi
As that is how it works. The setSceneRect defines the logical extent of the scene and
used by the View to know if to show scrollbars etc.
Its not a setting for the ClientArea it will occupy. It will always fill the View completely. -
This post is deleted! -
@mrjj said in Why graphics scene occupy whole graphics view?:
Hi
As that is how it works. The setSceneRect defines the logical extent of the scene and
used by the View to know if to show scrollbars etc.
Its not a setting for the ClientArea it will occupy. It will always fill the View completely.Well, how to make graphics view render only selected region of scene? Also, I have other questions: how to make scene to get events when mouse pointer is over scene's rendering rectangle?
-
@clostridium_difficile said in Why graphics scene occupy whole graphics view?:
how to make scene to get events when mouse pointer is over scene's rendering rectangle?
Override https://doc.qt.io/qt-5/qgraphicsscene.html#mouseMoveEvent