QGraphicsScene::addPath() versus QPainter::drawPath in QWidget::paintEvent()
-
Hi, I'm making a paint application for kids. I am using a QGraphicsView as the canvas. Below is the image which shows the difference between QGraphicsScene::addPath and QPainter::drawPath in QWidget::paintEvent(). Yes, the smooth 'K' is a widget actually. It looks far better than the other 'K' which is a QPainterPath painted on the Scene. I want the smooth one, of' course.
!http://s7.postimg.org/riq1uphxn/Screen_Shot_2013_08_07_at_4_01_21_PM.png(Image)!
So, you see that I can draw over the distorted 'K' but I can't do so in the 'K' widget. How can I accomplish drawing over the 'K' widget just like I can do over the distorted text path using the mouse events?
-
maybe you just miss the following:
@QGraphicsView::setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing);@Without knowing your exact requirements i don't know what you really want to achieve.
But i guess you do want to let the kids fill a shape with color?If so best would be to add a shape item to the view and set the "z-value":http://qt-project.org/doc/qt-4.8/qgraphicsitem.html#setZValue of all later added items (e.g. coming from your mouse events).
-
thanks a lot! This solved my problem :)