Qt World Summit: Register Today!

Can I add padding to a QwtText object?

  • I am adding a QwtPlotMarker to a QwtPlot using the following code:

    QwtPlotMarker *tooltip = new QwtPlotMarker(tr("Tooltip"));
    QwtText label("02/01/17\n06:00:00\nVoltage: 4.02");
    QColor blue(QColor(30, 140, 220));
    label.setBorderPen(QPen(blue, 1));
    label.setBackgroundBrush(QColor(65, 177, 225, 50));
    QFont font("MS Shell Dlg 2", 8);
    tooltip->setLabelAlignment(Qt::AlignCenter | Qt::AlignTop);    

    where this points to a QwtPlot object.

    With the code above I'm getting the following result:

    enter image description here

    Note that in the image the letter V from the Voltage is overlapped by the border.

    Is it possible to add padding to the QwtText (or maybe to the QwtPlotMarker!?), so I can get a result like the following one?

    enter image description here

    I'm using Qt 5.3.2 and Qwt 6.1.0.

  • @KelvinSP said in Can I add padding to a QwtText object?:

    Qwt has its own forum. and mailing list.
    I would rather seek for advice there.


Log in to reply