I think I managed to create my own class myPicker.
{
public:
{
setRubberBandPen
(QColor(Qt
::green));
//d_picker->setRubberBand(QwtPicker::PolygonRubberBand);
setTrackerPen
(QColor(Qt
::yellow));
//setTrackerFont(f);
}
QwtText trackerText
(const QwtDoublePoint
& pos
) const;
};
QwtText myPicker
::trackerText (const QwtDoublePoint
& pos
) const {
bgColor.setAlpha(160);
text.
setBackgroundBrush(QBrush(bgColor
));
return text;
}
class myPicker : public QwtPlotPicker
{
public:
myPicker(QwtPlot::Axis xAxis, QwtPlot::Axis yAxis, QwtPicker::RubberBand rb, QwtPicker::DisplayMode dm, QwtPlotCanvas* canvas):
QwtPlotPicker( xAxis, yAxis, rb , dm , canvas)
{
setStateMachine(new QwtPickerPolygonMachine());
setRubberBandPen(QColor(Qt::green));
//d_picker->setRubberBand(QwtPicker::PolygonRubberBand);
setTrackerPen(QColor(Qt::yellow));
//setTrackerFont(f);
}
QwtText trackerText (const QwtDoublePoint & pos) const;
};
QwtText myPicker::trackerText (const QwtDoublePoint & pos) const
{
QwtText text("(" + QString::number(pos.x()) + "," + QString::number(pos.y()) + ") ");
QColor bgColor(Qt::black);
bgColor.setAlpha(160);
text.setBackgroundBrush(QBrush(bgColor));
return text;
}
To copy to clipboard, switch view to plain text mode
and i created my object like this:
myPlot->canvas());
d_picker = new myPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPlotPicker::PolygonRubberBand, QwtPicker::AlwaysOn,
myPlot->canvas());
To copy to clipboard, switch view to plain text mode
I have two very basic questions..
1.how do i use my new function trackerText (const QwtDoublePoint & pos) const
2.When i use the myPlot private member
QwtText text("(" + QString::number(pos.x()) + "," + QString::number(pos.y()) + ") " + QString::number(myPlot.ValueAt(pos.x(), pos.y()))); QColor bgColor(Qt::black);
To copy to clipboard, switch view to plain text mode
i get that myPlot is undeclared. How did FelixB used it with m_spectrogram without getting any error?
Bookmarks