[Solved] Graphics definition on a PC
-
wrote on 3 Jun 2014, 08:49 last edited by
Hi,
Sorry I just post the same topic but in french (my mistake).
I am new in Qt and I want to draw and view small solid circles on a PC screen.
I use QGraphicsScene and addEllipse. It is working fine but I have an issue with the definition on the screen which seems nnot so good for small circles (8 to 10 pixels)
I wonder if it is possible to tune the definition on the screen for a window.
Am I using the right module/class (QGraphicsScreen) or should I use something different?
Thanks for your advices -
wrote on 3 Jun 2014, 09:16 last edited by
I don't know what problem exactly you have (a screenshot would be helpful), but you can try:
- setRenderHint(QPainter::Antialiasing) on your QGraphicsView
- Add 0.5 to your item positions. So instead of setPos(10, 10) try setPos(10.5, 10.5)
-
wrote on 3 Jun 2014, 09:43 last edited by
Thanks,
I will try this evening.
However, I was using QGraphicsScene / QGraphicsView with the method AddEllipse.
I haven't seen that setrenderHint is working in this case. So following your advise, it seems that I would better take the module QPainter with drawEllipse is it correct?
It is not clear for me when it is best to use QPainter vs QGraphicsScene -
wrote on 3 Jun 2014, 09:47 last edited by
QGraphicsScene uses QPainter internally. If you set the RenderHint flags on the QGraphicsView, it will pass them on to the QPainter that paints the ellipse.
The QGraphicsEllipseItem which you create using addEllipse is using QPainter::drawEllipse internally. So either way, you are using the same paint functions.
-
wrote on 4 Jun 2014, 08:04 last edited by
Thanks,
The SetrenderHint resolved my issue -
wrote on 4 Jun 2014, 08:48 last edited by
You are welcome.
Please mark the topic solved by editing your original post, and put [Solved] in front of the title.
4/6