Results 1 to 9 of 9

Thread: How to copy QwtPlot

  1. #1
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default How to copy QwtPlot

    I'm trying to copy QwtPlot.
    copy constructor doesn't work:
    > QFrame::QFrame(const QFrame&) is private. in qframe.h
    ...Q_DISABLE_COPY(QFrame)


    Could you help me?
    thank YOU!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to copy QwtPlot

    You can't copy widgets. What do you need it for?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: How to copy QwtPlot

    i have 5 QWidgets, such as 5 oscilloscopes. Each Widget has 10 sec interval. so over 50 sec i would update Widget #1 but i don't want remove all dates. so i can print, export, etc with all Widgets. e.g. over 100 sec i can print 10 oscilloscopes

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to copy QwtPlot

    I don't understand your explanation. You want to clone a plot to end up with 50 widgets in the end? Or do you just need an image of a plot so that you can save it somewhere?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: How to copy QwtPlot

    I need an image and all points from thess widgets (X,Y, and timestamp). I want to print all dates and images.
    I have points for 5 min but just 5 plots to draw these points. I draw the first 10 sec in Plot 1 (0 to 10 sec), then Plot 2 (10 to 20 sec) and so on. The dates from 50 sec can I draw in Plot 1. A Circular buffer but with Plots. Use can see the last 5 Plots, but others images and tables of points (X,Y, Timestamp) are in memory located
    Last edited by TomiBomi; 19th January 2012 at 13:43.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to copy QwtPlot

    Use QwtPlotRenderer to render a plot to an image, store the image somewhere and reuse the plot object.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: How to copy QwtPlot

    It doesn't work

    constructor(){
    printer = new QPrinter(QPrinter::HighResolution);
    renderer = new QwtPlotRenderer();
    }


    FunctionNextPlot(){
    // e.g. when Plot 1 is full, stop(Plot1); start(Plot2)
    renderer->renderTo(plotVec[PlotNumberCounter], *printer); // HERE: each time i see a dialog, so each plot will be saved separate but i want just one file with all plots ???
    }


    Added after 31 minutes:


    or do you mean

    void renderDocument (QwtPlot *, const QString &format, const QSizeF &sizeMM, int resolution=85)
    void renderDocument (QwtPlot *, const QString &title, const QString &format, const QSizeF &sizeMM, int resolution=85)

    but i save also separatly all Plots... if program runs 10 min with 10 sec interval, i have 60 files
    Last edited by TomiBomi; 19th January 2012 at 18:21.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to copy QwtPlot

    Qt Code:
    1. QPixmap px(1000,1000);
    2. px.fill();
    3. QwtPlotRenderer renderer;
    4. QPainter p(&px);
    5. renderrer.renderTo(plot, &p);
    6. px.save("file.png");
    To copy to clipboard, switch view to plain text mode 

    This saves a single plot to a single image. Then you can compose images by creating yet another image and drawing all those on it or printing all of them to a single QPrinter object.

    Alternatively (however this is more complicated) create one large pixmap and use QPainter::setViewport() to limit the area drawn so that you can paint all plots on a single pixmap.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. The following user says thank you to wysota for this useful post:

    TomiBomi (19th January 2012)

  10. #9
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: How to copy QwtPlot

    almost. just
    renderrer.renderTo(plot, px);

    but this works too:
    renderer.renderDocument( plot, fileName, QSizeF(300, 100), 85);

Similar Threads

  1. QSettings: copy from ini to xml? Copy group?
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2012, 14:51
  2. Replies: 6
    Last Post: 14th May 2009, 12:02
  3. I need run only one copy of program.
    By ivi2501 in forum Qt Programming
    Replies: 2
    Last Post: 28th January 2009, 09:54
  4. copy file
    By deepa.selvaraj in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2007, 07:53
  5. Replies: 1
    Last Post: 23rd January 2007, 07:46

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.