How to scale down QGraphicsItem in Qt?
-
I have a QGraphicsItem made up of QGraphicsPathItem (polyline) and QGraphicsEllipseItem (an Arc )
Through co-ordinates of Line and an Arc I have drawn QGraphicsItem ( XNOR gate ) But the problem is, it is quite bigger.
I want that it should get fit in a rectangle. But I do not want to resize it manually.The above figure is showing the current scenario. I want to scale down XNOR gate such that it's input line should match to the a0 and a1 rectangle and it's output should get match to the o rectangle. Currently I have hidden whole rectnagle and showing only input , output (small) rectangle.
I am reading co-ordinates of XNOR gate and storing them in a object. And when I am drawing those on a scene I want to resize them.
How to do that ? Can anyone help me ? -
I have a QGraphicsItem made up of QGraphicsPathItem (polyline) and QGraphicsEllipseItem (an Arc )
Through co-ordinates of Line and an Arc I have drawn QGraphicsItem ( XNOR gate ) But the problem is, it is quite bigger.
I want that it should get fit in a rectangle. But I do not want to resize it manually.The above figure is showing the current scenario. I want to scale down XNOR gate such that it's input line should match to the a0 and a1 rectangle and it's output should get match to the o rectangle. Currently I have hidden whole rectnagle and showing only input , output (small) rectangle.
I am reading co-ordinates of XNOR gate and storing them in a object. And when I am drawing those on a scene I want to resize them.
How to do that ? Can anyone help me ? -
Hi,
QGraphicsItem::setScale comes to mind.
On an unrelated note, please stop @ people like you are doing in your latest questions. It's rude and disrespectful for other forum members. This a voluntary driven forum. People come here when they have time and the desire to answer questions not on your request.
-
Hi,
QGraphicsItem::setScale comes to mind.
On an unrelated note, please stop @ people like you are doing in your latest questions. It's rude and disrespectful for other forum members. This a voluntary driven forum. People come here when they have time and the desire to answer questions not on your request.
@SGaist My intention is not to disrespecting anyone. But if you feel so, sorry for that. From next time own wards I will keep this in mind. Thank you.
I do not have a single QGraphicsItem to use setScale(). My structure is something like this.
struct mySymbols { vector<LINES> lines; vector<ARCS> arcs; }; struct LINES { tuple<int,int,int,int> lines_ }; struct ARCS { tuple<int,int,int,int,int,int> arc_; }; std::map<std::string, mySymbols> allSymbols
So in a map, there is a object of mySymbols through which I am trying to access all the lines, arc etc.
So not understanding how to use setScale() here. -
You are creating graphics items out of these structures, no ?
-
Don't you have a scale factor provided already when you build these structures ?
-
@SGaist Yes. They have provided. But though I used those factor, it is not perfectly fitting. I have to bring that symbol down. ( by changing y co-ordinates of lines ). So I was told that, let Qt do this scale up and down.
That's why I am asking, is there any way that Qt will scale down QGraphicsItem before drawing on scene ? -
One thing I am wondering is how what values you have for the letter parts that make such a change of size with regard to the gate itself.
-
@SGaist Yes. They have provided. But though I used those factor, it is not perfectly fitting. I have to bring that symbol down. ( by changing y co-ordinates of lines ). So I was told that, let Qt do this scale up and down.
That's why I am asking, is there any way that Qt will scale down QGraphicsItem before drawing on scene ?@tushu said in How to scale down QGraphicsItem in Qt?:
That's why I am asking, is there any way that Qt will scale down QGraphicsItem before drawing on scene
@SGaist, already mentioned this, but it seems like setScale() will do what you want.