Results 1 to 4 of 4

Thread: drawLine without qrect

  1. #1
    Join Date
    May 2013
    Posts
    45
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default drawLine without qrect

    hi.

    Is some function for drawLine in painter, but without drawing line in some QRect?

    example:

    i can drawLine from 0,5 to 10,5, but I have rect (5,2,2,5) which is transparent and in this rect i don't want this line

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: drawLine without qrect

    Call QPainter::setClipPath() with a QRegion that excludes the rectangle you do not want to draw inside. You can build the region by starting with one that covers the entire screen and then subtracting one that covers the rectangle.

  3. The following user says thank you to ChrisW67 for this useful post:

    stevocz (3rd October 2014)

  4. #3
    Join Date
    May 2013
    Posts
    45
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: drawLine without qrect

    thanks and is possible set ends of Line was clipped on nearest point of edge of rect?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drawLine without qrect

    Clipping is defined by the clipping region so the line will be clipped to whatever region you set.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. drawLine not working
    By papillon in forum Newbie
    Replies: 1
    Last Post: 30th December 2011, 05:59
  2. drawLine with QGradient is slow
    By D.Dupuis in forum Qt Programming
    Replies: 0
    Last Post: 7th December 2011, 12:35
  3. DrawLine over QPixmap within Qlabel
    By Qt Coder in forum Qt Programming
    Replies: 8
    Last Post: 26th March 2009, 12:21
  4. QTransform + drawLine ?
    By verburg in forum Qt Programming
    Replies: 0
    Last Post: 23rd January 2009, 00:32
  5. Painter drawLine doubt
    By arjunasd in forum Qt Programming
    Replies: 5
    Last Post: 24th August 2007, 19:59

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.