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.setColor(blue);
    label.setBorderPen(QPen(blue, 1));
    label.setBorderRadius(5);
    label.setBackgroundBrush(QColor(65, 177, 225, 50));
    
    QFont font("MS Shell Dlg 2", 8);
    label.setFont(font);
    
    tooltip->setLabel(label);
    tooltip->setLabelAlignment(Qt::AlignCenter | Qt::AlignTop);    
    tooltip->attach(this);
    
    this->replot();
    

    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.

    http://qwt.sourceforge.net/#support


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.