Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsScene::addPath() versus QPainter::drawPath in QWidget::paintEvent()

QGraphicsScene::addPath() versus QPainter::drawPath in QWidget::paintEvent()

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    binaryking
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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).

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • B Offline
        B Offline
        binaryking
        wrote on last edited by
        #3

        thanks a lot! This solved my problem :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved