Results 1 to 6 of 6

Thread: [Solved] Adding a qwtPlot to a layout

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default [Solved] Adding a qwtPlot to a layout

    Hi!

    What i'm trying to do should be pretty easy. But somehow it doesn't work.
    All i'm trying to do is to add a qwtPlot to an qt application, without launching the plot in its own application.
    Every time i try, i end up with 2 application windows (one for the application and one for the plot) or with no application (because it crashes).
    I tired this for quiet some time without any progress, so maybe you can help me out.

    If i run this somewhere in my code i end up with 2 application windows. (not what i want)
    Qt Code:
    1. QwtPlot* plot = new QwtPlot();
    2. plot->setTitle( "Plot Demo" );
    3. plot->setCanvasBackground( Qt::white );
    4. plot->setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
    5. plot->insertLegend( new QwtLegend() );
    6. [...]
    7. plot->show();
    To copy to clipboard, switch view to plain text mode 

    What i want is to add a plot to a specified layout inside my application.
    every time i try to add a qwtPlot as a widget, my application crashes.
    Qt Code:
    1. QwtPlot* plot = new QwtPlot();
    2. [...]
    3. ui->horizontalLayout->addWidget(plot);
    To copy to clipboard, switch view to plain text mode 

    Is this even Possible? i cant even find anything about this.
    Last edited by cl90; 4th March 2015 at 12:10.

Similar Threads

  1. Replies: 1
    Last Post: 23rd January 2014, 01:27
  2. Replies: 0
    Last Post: 7th July 2012, 11:32
  3. Adding line in layout.
    By Niamita in forum Qt Programming
    Replies: 5
    Last Post: 17th October 2011, 14:56
  4. Replies: 0
    Last Post: 12th December 2010, 05:09
  5. A question about adding to layout
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 12:41

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
  •  
Qt is a trademark of The Qt Company.