Results 1 to 2 of 2

Thread: painting problem

  1. #1
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default painting problem

    I have a signal plot with a grid where I would like to change the background color of just some of the grid cells.
    Tried this:
    Qt Code:
    1. void SignalView::paintEvent(QPaintEvent*)
    2. {
    3. QPainter* painter = new QPainter(this);
    4.  
    5. QColor bpColor;
    6. bpColor.setNamedColor("grey");
    7.  
    8. painter->setPen(bpColor);
    9. QwtPainter::drawRect(painter, 500, 500, 100, 500);
    10. }
    To copy to clipboard, switch view to plain text mode 

    But no paint and the message QPaintDevice: Cannot destroy paint device that is being painted appears in the application output window.

    Any suggestions are welcome.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: painting problem

    Your approach won't work - all painting needs to be done in a QwtPlotItem.

    Uwe

Similar Threads

  1. problem painting
    By eric_vi in forum Qt Programming
    Replies: 5
    Last Post: 13th August 2009, 23:07
  2. painting problem.
    By joseph in forum Qt Programming
    Replies: 5
    Last Post: 25th July 2007, 12:18
  3. Painting problem
    By ScoOteR in forum Qt Programming
    Replies: 5
    Last Post: 11th March 2007, 11:03
  4. Painting Problem
    By shyam prasad in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2007, 14:07
  5. Painting Problem on Mac
    By shyam prasad in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2007, 08:58

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.