[Solved] Graphics definition on a PC
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
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)
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
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.
The SetrenderHint resolved my issue
You are welcome.
Please mark the topic solved by editing your original post, and put [Solved] in front of the title.