Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can I add padding to a QwtText object?
Forum Updated to NodeBB v4.3 + New Features

Can I add padding to a QwtText object?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 712 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KelvinSP
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AlexMal
      wrote on last edited by
      #2

      @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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved