novackb
8th July 2015, 21:58
I have a QwtPlotMarker that I configure using QwtFont and QwtText to get the font/color that I desire. The data is being displayed in image mode using a QwtPlotSpectrogram. The problem is the marker text is easy/hard to read depending on the current color behind it. Just changing the font color doesn't help because the image color behind it is constantly changing.
I'd like to add a single-pixel border just around the text (not a box) to help the text 'pop'. I came across the QGraphicsDropShadowEffect class in Qt which might work, but QwtText doesn't seem to have that capability natively.
Here's my current code to create the QwtPlotMarker. Nothing fancy, but in case it helps....
QwtPlotMarker selectedPoint = new QwtPlotMarker();
QwtText labelText("");
labelText.setColor(Qt::black);
QFont labelFont("Times", 12, QFont::Black);
labelText.setFont(labelFont);
selectedPoint->setLabel(labelText);
selectedPoint->setLabelAlignment(Qt::AlignTop);
selectedPoint->attach(this);
I then update the labelText as new data is received via external message.
Any ideas or suggestions to point me in the right direction are appreciated.
Bryan
I'd like to add a single-pixel border just around the text (not a box) to help the text 'pop'. I came across the QGraphicsDropShadowEffect class in Qt which might work, but QwtText doesn't seem to have that capability natively.
Here's my current code to create the QwtPlotMarker. Nothing fancy, but in case it helps....
QwtPlotMarker selectedPoint = new QwtPlotMarker();
QwtText labelText("");
labelText.setColor(Qt::black);
QFont labelFont("Times", 12, QFont::Black);
labelText.setFont(labelFont);
selectedPoint->setLabel(labelText);
selectedPoint->setLabelAlignment(Qt::AlignTop);
selectedPoint->attach(this);
I then update the labelText as new data is received via external message.
Any ideas or suggestions to point me in the right direction are appreciated.
Bryan