Results 1 to 3 of 3

Thread: Draw histogram with QwtPlot

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Draw histogram with QwtPlot

    Hello everybody. I quite new to the QT/Qwt scheme and I've run into a difficulty.
    I am trying to plot a histogram using the QwtPlot, based on the example found in Qwt. When the user clicks a button a new window opens and a histogram is drawn in it. My problem is that the histogram is just plotted and then vanishes, leaving the window open but empty. The part of the code inside the clicked button section is like that:

    Qt Code:
    1. QWidget* nw= new QWidget(0, Qt::Window);
    2. QwtPlot plot(nw);
    3. // ....
    4. //Passing Data to histogram
    5. // ...
    6. plot.show();
    7. nw->show();
    To copy to clipboard, switch view to plain text mode 

    If I create a Modal MessageBox right after the nw->show part, I can see the histogram. But as soon as the OK is pressed, it disappears ....

    Please any help would be really appreciated!!!

  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: Draw histogram with QwtPlot

    When you create at widget on the stack it is gone when you leave the procedure. Allocate it with new instead.

    Uwe

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw histogram with QwtPlot

    Thank you very much!
    It was simple indeed!!!

Similar Threads

  1. Replies: 1
    Last Post: 16th March 2010, 15:23
  2. Histogram
    By giusepped in forum Qwt
    Replies: 1
    Last Post: 9th March 2010, 08:54
  3. Replies: 2
    Last Post: 7th July 2009, 07:44
  4. Replies: 6
    Last Post: 14th May 2009, 12:02
  5. Replies: 5
    Last Post: 18th March 2008, 16:11

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.