Different Colored Rectangles in QwtPlotPicker
Hi everyone,
I would like to have one QwtPlotPicker object attached to my plot that allows me to select a rectangle of color A (for instance, green) using the left mouse button, while also being able to select a rectangle of color B (red) using the right mouse button.
Currently, I am attaching the mouse buttons to patterns like this:
Code:
signalPicker-> new MySignalPicker( canvas() );
signalPicker
->setRubberBand
( QwtPicker::RectRubberBand );
signalPicker
->setMousePattern
( QwtEventPattern::MouseSelect1, Qt
::LeftButton );
signalPicker
->setMousePattern
( QwtEventPattern::MouseSelect2, Qt
::RightButton );
Also, in my inherited class, MySignalPicker, I have reimplemented the widgetMousePressEvent() function:
Code:
{
if( mouseMatch( MouseSelect1, me ) )
{
setRubberBandPen
( QColor( Qt
::green ) );
}
else if( mouseMatch( MouseSelect2, me ) )
{
setRubberBandPen
( QColor( Qt
::red ) );
}
}
Hoever, it seems like only MouseSelect1 is able to draw rectangles. I've been trying to look through the source code, but I haven't had any luck yet finding out where/why only MouseSelect1 can draw rectangles.
Any help would be appreciated.
Thanks in advance,
Chris
Re: Different Colored Rectangles in QwtPlotPicker
Use 2 pickers with different pens.
Uwe