PDA

View Full Version : painting problem



K4ELO
22nd April 2013, 23:19
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:


void SignalView::paintEvent(QPaintEvent*)
{
QPainter* painter = new QPainter(this);

QColor bpColor;
bpColor.setNamedColor("grey");

painter->setPen(bpColor);
QwtPainter::drawRect(painter, 500, 500, 100, 500);
}


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.

Uwe
23rd April 2013, 06:44
Your approach won't work - all painting needs to be done in a QwtPlotItem.

Uwe