Results 1 to 4 of 4

Thread: [SOLVED] QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?

  1. #1
    Join Date
    Apr 2012
    Posts
    13
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question [SOLVED] QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?

    Hallo.

    I have a simple line:

    Qt Code:
    1. plot->labelRpPlot->setText((const QString &) "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455", QwtText::RichText);
    To copy to clipboard, switch view to plain text mode 

    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:
    Qt Code:
    1. void QwtTextLabel::setText ( const QString & text,
    2. QwtText::TextFormat textFormat = QwtText::AutoText
    3. )
    To copy to clipboard, switch view to plain text mode 
    http://qwt.sourceforge.net/class_qwt...2caff41ba2b9b8


    Thanks for all your answers in advance.
    Last edited by sirop; 2nd May 2015 at 18:05. Reason: solved

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?

    Qt Code:
    1. plot->labelRpPlot->setText( QString( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText);
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. The following user says thank you to Uwe for this useful post:

    sirop (2nd May 2015)

  4. #3
    Join Date
    Apr 2012
    Posts
    13
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?

    I do not get it yet.

    Now used your proposal:

    Qt Code:
    1. plot->labelRpPlot->setText(QString ( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText);
    To copy to clipboard, switch view to plain text mode 

    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.

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotTextLabel::setText(const QString&, QwtText::TextFormat) ?

    Ah yes: QwtTextLabel != QwtPlotTextLabel ( re-read your initial question ! ):

    So your line should be:
    Qt Code:
    1. plot->labelRpPlot->setText( QwtText( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" , QwtText::RichText ) );
    To copy to clipboard, switch view to plain text mode 
    or:
    Qt Code:
    1. plot->labelRpPlot->setText( QwtText( QString( "Rp [N]=20000.333 <br><br> Rp[N/mm <sup>2</sup>]=3.44455" ), QwtText::RichText ) );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  6. The following user says thank you to Uwe for this useful post:

    sirop (2nd May 2015)

Similar Threads

  1. Replies: 0
    Last Post: 21st November 2013, 06:39
  2. Replies: 2
    Last Post: 11th August 2011, 15:42
  3. How to convert QString to const char*
    By fulin in forum Newbie
    Replies: 7
    Last Post: 9th May 2010, 23:25
  4. Disturbing: const QString &
    By magland in forum General Programming
    Replies: 9
    Last Post: 28th November 2007, 15:34
  5. QString to const char
    By TheRonin in forum Newbie
    Replies: 2
    Last Post: 12th February 2007, 14:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.