Results 1 to 9 of 9

Thread: QPainter: painted color (brush) and pixel value (read after the draw) are different?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QPainter: painted color (brush) and pixel value (read after the draw) are differ

    If you want to fill the image with a specific color, there is QImage::fill().

    Also:

    * have you verified the QColor value? Is the rgba() result the same as the input
    * if not, have you tried constructing the QColor directly from the value?

    Cheers,
    _

  2. #2
    Join Date
    Feb 2017
    Posts
    4
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QPainter: painted color (brush) and pixel value (read after the draw) are differ

    Problem solved!!
    Working properly when I tried with Qt 5.8
    Looks like a bug with Qt 5.4.

    Thanks to all

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPainter: painted color (brush) and pixel value (read after the draw) are differ

    There is no draw() method in QPainter. And if you set a QBrush, it uses it in the drawRect() method to fill the rectangle. (And the current QPen, if any, to draw the outline).
    the draw() was a typo, thanks.
    Ah, and indeed, in the docs it says drawRect() will use the brush as well.
    Last edited by high_flyer; 18th February 2017 at 20:20.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QPainter above already painted
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2014, 19:59
  2. How can I draw with brush on QLabel?
    By suseway in forum Qt Programming
    Replies: 4
    Last Post: 25th October 2010, 21:13
  3. How to read a color of a pixel on a Widget?
    By wringer in forum Newbie
    Replies: 5
    Last Post: 4th December 2009, 06:31
  4. Replies: 5
    Last Post: 20th October 2009, 07:18
  5. How to get pixel color from QPainter ??
    By rameshg87 in forum Qt Programming
    Replies: 1
    Last Post: 10th August 2008, 08:58

Tags for this Thread

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.