Hi again,

I'm using QwtText in order to show a message on a QwtPlot.
I would like my QwtText to have some padding

I'm trying to do it in a dirty way, i'm adding some space so that the rectangle grow bigger.
See here : https://www.dropbox.com/s/7tojqexfon0b1ag/QwtTextEx.png
Problem I have with this approach is that the text is not centered no matter how I add the space

I also tried to subclass QwtText but I can't use the private field used in the draw() method, I would just increase the QRect size
or maybe I can write code directly in QwtText, but I'm not sure i'm allowed to do that and not good when Qwt has update..

if you have an idea thanks



Current code :
void WorkoutPlot::setDisplayMessage(QString text, bool workoutPausedMsg) {

/// DISPLAY MSG
QFont fontBig;
fontBig.setPointSize(16);

int lengthText = text.length();
QString emptySpace = " ";
QString emptyLine;
for (int i=0; i<lengthText + 8; i++) {
emptyLine+= emptySpace;
}

QString msg = emptyLine + "\n";
msg += " " + text + " " + "\n";
msg += emptyLine;
displayMsgTxt = QwtText( msg );


displayMsgTxt.setFont(fontBig);
displayMsgTxt.setRenderFlags( Qt::AlignHCenter | Qt::AlignHCenter );
displayMsgTxt.setColor(Qt::white);
if (workoutPausedMsg)
displayMsgTxt.setBackgroundBrush(QBrush(QColor(1, 1, 1, 128), Qt::SolidPattern));

displayMessageLabel = new QwtPlotTextLabel();
displayMessageLabel->setText( displayMsgTxt );
displayMessageLabel->attach( this );