Results 1 to 2 of 2

Thread: QPainter::setClipPath

  1. #1
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPainter::setClipPath

    Hi everyone,

    Did anyone succeed in setting a clip path with QPainter::setClipPath?

    I verifyied carefully my coordinates and they are right since QPainter::fillPath works. I dont want to set a mask to the QImage since I use QPainter::drawImage(const QRectF&, const QImage&, const QRectF&) and I dont want to copy neither scale the image buffer I use in drawing.

    I tried a lots of commands without success in the paint event of a QGraphicsItem. Setting a clip path that is filled with polygons cancel the image painting instructions I use later.

    Here are some of my unsuccessful tries :

    Qt Code:
    1. painter->setClipping(true);(
    2. painter->setClipPath(shape());
    3. painter->drawImage(exposedSceneRect, *imageBuffer, rectInPixels);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. path.addRect(exposedSceneRect);
    2. path = path.subtracted(shape());
    3.  
    4. painter->setClipRect(exposedSceneRect);
    5. painter->setClipPath(path, Qt::IntersectClip);
    6. painter->drawImage(exposedSceneRect, *imageBuffer, rectInPixels);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. path.addRect(exposedSceneRect);
    2. painter->setClipPath(path.intersected(shape()));
    To copy to clipboard, switch view to plain text mode 

    Thanks for any help.
    Last edited by scascio; 1st December 2009 at 16:19.

  2. #2
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter::setClipPath

    Seems that my problem is related with QGLWidget.

    When GL viewport is disable, every display operations are fine

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.