Results 1 to 2 of 2

Thread: Update QwtPlot after create the plot object...

  1. #1
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Update QwtPlot after create the plot object...

    I've got my own plot class CDataPlot

    Qt Code:
    1. class CDataPlot : public QwtPlot
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. CDataPlot(QWidget* parent = 0);
    7. virtual ~CDataPlot();
    8. void SetPlotConfiguration(const QString& title = "", const QString& curvetitle="",
    9. const QString& xtitle = "", const QString& ytitle = "",
    10. double xlen = 0.0, double ylen = 0.0);
    11. };
    To copy to clipboard, switch view to plain text mode 

    In the constructor
    Qt Code:
    1. CDataPlot::CDataPlot(QWidget* parent):QwtPlot(parent)
    2. {
    3. setupQWTUi();
    4. this->SetPlotConfiguration("This can !");
    5. // I can update the title of the plot here. For sure, this is just the constructor of the plot !!!!
    6. }
    To copy to clipboard, switch view to plain text mode 

    Then, I've got another class CObjectDetectionPlots


    Qt Code:
    1. // Object detection figures
    2. class CObjectDetectionPlots : public QMainWindow
    3. {
    4. Q_OBJECT
    5.  
    6. public:
    7. CObjectDetectionPlots(QWidget *parent = 0, Qt::WFlags flags = 0);
    8. ~CObjectDetectionPlots();
    9.  
    10. CDataPlot* m_pDataPlot;
    11. };
    To copy to clipboard, switch view to plain text mode 

    In the constructor

    Qt Code:
    1. CObjectDetectionPlots::CObjectDetectionPlots(QWidget *parent, Qt::WFlags flags)
    2. : QMainWindow(parent, flags)
    3. {
    4. // private ui
    5. m_pDataPlot = new CDataPlot(this);
    6. m_pDataPlot->SetPlotConfiguration("Can the title be updated?"); // no updating at all !!!
    7. m_pDataPlot->replot(); // even if replot(), no use!!!!
    8. ui.setupUi(this);
    9. }
    To copy to clipboard, switch view to plain text mode 

    I just want to update the title of CDataPlot* m_pDataPlot; after having created the plot. Can I?
    If so, how to do it?


    As you can see, if I updated the title from within plot's constructor, I can get it done.
    However, if I try to update the plot's title from outside, no updating at all !!!!!!!!!
    Even if I use replot(), no use at all!!!


    Please can anybody help to explain and give me a solution how will QWT update the plot after a plot object has been created??


    Best Regards
    JIA
    Welcome to Vision Open
    http://www.visionopen.com

  2. #2
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: Update QwtPlot after create the plot object...

    You just need to call QwtPlot::setTitle?

Similar Threads

  1. Replies: 9
    Last Post: 12th May 2014, 02:25
  2. Replies: 2
    Last Post: 12th September 2012, 08:43
  3. Replies: 12
    Last Post: 31st October 2010, 18:08
  4. Replies: 4
    Last Post: 14th May 2009, 11:31
  5. immediate update of QT object
    By db in forum Newbie
    Replies: 3
    Last Post: 14th August 2007, 13:25

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.