Results 1 to 9 of 9

Thread: Installing (or using?) Qwt without compiling the Qt Creator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2016
    Posts
    57
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Question Installing (or using?) Qwt without compiling the Qt Creator

    Is there any way for me to use the Qwt without compiling the Qt Creator?

    And by the way my Qt Creator is: Based on Qt 5.7.0 (MSVC 2013, 32 bit)

    And even if I still must build Qwt in order to use it, can it be done by building it from Qt Creator itself?

    Again, all I want is to be able to generate plots inside my program, if I do not get those drag/drop Qwt controls (which I do not need anyway) I am perfectly fine with it.
    I just need to be able to call Qwt functions to plot data inside my window widgets (and also plot using OpenGL)

    I even tried this, I extracted the qwt-6.1.3 folder, and opened its .pro file with my Qt Creator, built it. then created a simple gui project in QtCreator, and:

    .pro file:
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2016-08-09T16:55:09
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8. CONFIG += qwt
    9. QWT_LOCATION = C:\Qwt-6.1.3
    10. INCLUDEPATH += $${QWT_LOCATION}/src
    11. LIBS = -L$${QWT_LOCATION}/lib \
    12. -lqwt
    13.  
    14.  
    15. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    16.  
    17. TARGET = QwtTest2
    18. TEMPLATE = app
    19.  
    20.  
    21. SOURCES += main.cpp
    22.  
    23. HEADERS +=
    24.  
    25. FORMS +=
    To copy to clipboard, switch view to plain text mode 

    And here is the main.cpp (some code I took as example from some of the threads in here)
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_plot.h>
    3. #include <qwt_plot_curve.h>
    4. #include <qwt_plot_grid.h>
    5. #include <qwt_symbol.h>
    6. #include <qwt_legend.h>
    7.  
    8. int main( int argc, char **argv )
    9. {
    10. QApplication a( argc, argv );
    11.  
    12. QwtPlot plot;
    13. plot.setTitle( "Plot Demo" );
    14. plot.setCanvasBackground( Qt::white );
    15. plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
    16. plot.insertLegend( new QwtLegend() );
    17.  
    18. QwtPlotGrid *grid = new QwtPlotGrid();
    19. grid->attach( &plot );
    20.  
    21. QwtPlotCurve *curve = new QwtPlotCurve();
    22. curve->setTitle( "Some Points" );
    23. curve->setPen( Qt::blue, 4 ),
    24. curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    25.  
    26. QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
    27. QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
    28. curve->setSymbol( symbol );
    29.  
    30. QPolygonF points;
    31. points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
    32. << QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
    33. << QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
    34. curve->setSamples( points );
    35.  
    36. curve->attach( &plot );
    37.  
    38. plot.resize( 600, 400 );
    39. plot.show();
    40.  
    41. return a.exec();
    42. }
    To copy to clipboard, switch view to plain text mode 

    It compiles without error, but when I run it it shows this in Application Output:
    QWidget: Must construct a QApplication before a QWidget
    ANy ideas how can I get it to work?
    Last edited by r2com; 9th August 2016 at 22:50.

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

    Default Re: Installing (or using?) Qwt without compiling the Qt Creator

    Quote Originally Posted by r2com View Post
    Is there any way for me to use the Qwt without compiling the Qt Creator?
    As long as you don't want to get the designer plugin running ( where I don't see, that you need it ) the Qt Creator is unrelated to the application and the libraries ( f.e Qwt ) used for building it. So recompiling the Creator won't change anything.

    QWidget: Must construct a QApplication before a QWidget
    This is a standard symptom, when linking incompatible binaries. The incompatibility should be between the Qt library you are building your application with and the version you have used for building the Qwt library - often simply a debug/release mismatch.

    Your project file also indicates, that you didn't follow the installation process - skipping the "make install" step. Most of the problems with building and running Qwt applications have to do with not doing it carefully, then trying to fix things manually ( like adding include + link paths to the source directory ) ...

    http://qwt.sourceforge.net/qwtinstal...PILEANDLINKAPP is all that needs to be done - as soon as you have to add extra include/link paths to your project files you know, that something is wrong.

    Uwe

Similar Threads

  1. installing QT creator 5
    By crisHerald in forum Newbie
    Replies: 14
    Last Post: 24th May 2013, 02:30
  2. Problems installing Qt Creator 5 and Qt 4
    By u04245822 in forum Qt Tools
    Replies: 0
    Last Post: 22nd April 2013, 10:10
  3. Replies: 1
    Last Post: 17th October 2011, 09:53
  4. Installing FANN lib in Qt creator!
    By Abeer in forum Newbie
    Replies: 6
    Last Post: 10th July 2011, 08:51
  5. Matplotlib widget installing on Qt Creator
    By soulz9 in forum Newbie
    Replies: 0
    Last Post: 15th April 2010, 06:57

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.