PDA

View Full Version : Problem in changing the tracker font size



gd
3rd December 2009, 12:37
Hi all,

I have a 2D plot and I want to change the font size used by the tracker pen.

My code is:



if (zoomer != NULL)
delete zoomer;

zoomer = new QwtPlotZoomer(qwtPlot->canvas());

zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt:: RightButton, Qt::ControlButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt:: RightButton);

const QColor c(Qt::white);
zoomer->setTrackerMode(QwtPicker::AlwaysOn);
zoomer->setRubberBandPen(c);
zoomer->setTrackerPen(c);
QFont qf=zoomer->trackerFont();
zoomer->setTrackerFont(QFont(qf.family(),18,qf.weight(), qf.italic()));


Even if the code is compiled without errors or warnings the font size of tracker pen is not changed at all in the plot (the default size is 10)! The color instead is set properly.

Thank you in advance for your help!

Bye

Uwe
3rd December 2009, 15:21
Indeed setTrackerFont doesn't work.

But what you can do is to assign the font to the plot canvas ( the font of the tracker text widget is initialized with it ) before you attach your zoomer.

Another option is to overload the trackerText method and add the font to the QwtText object.

Uwe