PDA

View Full Version : [SOLVED] QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?



sirop
2nd May 2015, 12:41
Hallo.

I have a simple line:


plot->labelRpPlot->setText((const QString &) "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455", QwtText::RichText);

but got errors:

..\AATORQUE_PLOTTIMER\mainwindow.cpp:767:135: error: no matching function for call to 'QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat)'
plot->labelRpPlot->setText((const QString &) "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455",QwtText::RichText);
^
..\AATORQUE_PLOTTIMER\mainwindow.cpp:767:135: note: candidate is:
In file included from ..\AATORQUE_PLOTTIMER\myplot.h:16:0,
from ..\AATORQUE_PLOTTIMER\mainwindow.h:7,
from ..\AATORQUE_PLOTTIMER\mainwindow.cpp:22:
..\..\LIB\qwt-6.1.2\include/qwt_plot_textlabel.h:55:10: note: void QwtPlotTextLabel::setText(const QwtText&)
void setText( const QwtText & );

Why? The documentation for 6.1.2 does offer:

void QwtTextLabel::setText ( const QString & text,
QwtText::TextFormat textFormat = QwtText::AutoText
)
http://qwt.sourceforge.net/class_qwt_text_label.html#ab300b9a0a6392e180f2caff 41ba2b9b8


Thanks for all your answers in advance.

Uwe
2nd May 2015, 14:28
plot->labelRpPlot->setText( QString( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText);Uwe

sirop
2nd May 2015, 14:54
I do not get it yet.

Now used your proposal:


plot->labelRpPlot->setText(QString ( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText);

Compiler output:

..\AATORQUE_PLOTTIMER\mainwindow.cpp:816:126: error: no matching function for call to 'QwtPlotTextLabel::setText(QString, QwtText::TextFormat)'
plot->labelRpPlot->setText(QString("Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455"),QwtText::RichText);
^
..\AATORQUE_PLOTTIMER\mainwindow.cpp:816:126: note: candidate is:
In file included from ..\AATORQUE_PLOTTIMER\myplot.h:16:0,
from ..\AATORQUE_PLOTTIMER\mainwindow.h:7,
from ..\AATORQUE_PLOTTIMER\mainwindow.cpp:22:
..\..\LIB\qwt-6.1.2\include/qwt_plot_textlabel.h:55:10: note: void QwtPlotTextLabel::setText(const QwtText&)
void setText( const QwtText & );

I use mingw 4.9.2 32 bit dw without unicode support.

Uwe
2nd May 2015, 17:14
Ah yes: QwtTextLabel != QwtPlotTextLabel ( re-read your initial question ! ):

So your line should be:

plot->labelRpPlot->setText( QwtText( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" , QwtText::RichText ) );or:

plot->labelRpPlot->setText( QwtText( QString( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText ) );Uwe