Solved item's line width also zoomed after zoom QGraphicsView
-
we all know,
QGraphicsView, QGraphicsScene
is good way to show graphics item.In
Scene
, i add some rect items withQGraphicsRectItem
. i set the line width is 2..View
has thematrix
. i use thematrix
to zoomin and zoomout.when i zoomed. i find the line width also zoomed when you see with your eyes. i don't want this result. i also know that set the line width 0, and the line width always is 1. this is line. but, if i fill rect.
i want to set the line width or rect area always is fixed in screen when you to see it after zoom view.
Thank u .Happy Valentine's Day
-
I think i saved it.
The item also zoomed after view set matrix. because item is on the scene. the scene is not zoom.
we just zoom the view when we see the scene from eyes. it just like you to read one book with
magnifier. the line of character is also can be zoom.so, if you don't want to this. i think the better way is to zoom the scene content not the view,
not use the matrix to zoom view.when you want to zoomin:
- get the sceneRect, and zoomin the sceneRect's width and height, reset it to scene;
- clear all the item in scene, because, you should resize them and readd them to scene;
zoomout is same with zoomin;
zoom the content not the view.
That's all.
last method was stupid.
Please to see my another post. maybe good way
-
To all who finds this as first google result.
The answer to this question is
QPen pen;
pen.setCosmetic(true);