Sunday, July 6th 2008, 4:28pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

1

Monday, March 31st 2008, 1:46pm

QwtPlot Widget not working.

Hello every body.

I am working on Qt4.3.3 integrated with VS2005. I have a small problem. I wanted to use qwtplot widget for plotting some Real Time graphs. I have installed qwt plugin into Vs2005. All the Qwt example program's work. But i am having problem running the Application program with the .Ui form. I have named the program plotting. I took this sample example from here http://qwt.sourceforge.net/class_qwt_plot.html and put it in my program.

------plotting.cpp--------

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "plotting.h"
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
plotting::plotting(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
ui.setupUi(this);
QwtPlot *qwtPlot;
double x[100], y1[100], y2[100]; // x and y values

qwtPlot = new QwtPlot("Two Curves",parent); // [ <----- error here ]

// add curves
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2");

//getSomeValues(x, y1, y2);

// copy the data into the curves
curve1->setData(x, y1, 100);
curve2->setData(x, y2, 100);

curve1->attach(qwtPlot);
curve2->attach(qwtPlot);

// finally, refresh the plot
qwtPlot->replot();

}

plotting::~plotting()
{

}


-------plotting.h-----------

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef PLOTTING_H
#define PLOTTING_H

#include <QtGui/QDialog>
#include "ui_plotting.h"
#include <qwt_plot.h>

class plotting : public QDialog
{
Q_OBJECT

public:
plotting(QWidget *parent = 0, Qt::WFlags flags = 0);
~plotting();

private:
Ui::plottingClass ui;

};

#endif // PLOTTING_H


-----main.cpp--------

Source code

1
2
3
4
5
6
7
8
9
10
11
#include <QtGui/QApplication>
#include "plotting.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
plotting w;
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}


Hey i have attached the .Ui form.The qwtplot widget's Object name is qwtPlot.
I wanted to just plot two curves. But i have a error pls help me out with this problem.

Source code

1
2
3
1>.plotting.cpp(11) : error C2664: 'QwtPlot::QwtPlot(const QwtText &,QWidget *)' : cannot convert parameter 1 from 'const char [11]' to 'const QwtText &'
1> Reason: cannot convert from 'const char [11]' to 'const QwtText'
1> No constructor could take the source type, or constructor overload resolution was ambiguous

?(
crazycoder has attached the following file:
  • plotting.bmp (746.07 kB - 18 times downloaded - Last download: Jun 16th 2008, 4:28pm)
  • Go to the top of the page

2

Monday, March 31st 2008, 2:38pm

RE: QwtPlot Widget not working.

use:
QwtText title( "Two Curves" );
qwtPlot = new QwtPlot( title, parent );
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

3

Monday, March 31st 2008, 6:07pm

RE: QwtPlot Widget not working.

Hey thank you so much for the reply. I replaced code with your's . There seems to be no program error's now but many linker errors have come now. These are the errors.

Source code

1
2
3
4
5
6
7
8
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlot::QwtPlot(class QWidget *)" (??0QwtPlot@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_plottingClass::setupUi(class QDialog *)" (?setupUi@Ui_plottingClass@@QAEXPAVQDialog@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::~QwtText(void)" (??1QwtText@@QAE@XZ) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotItem::attach(class QwtPlot *)" (?attach@QwtPlotItem@@QAEXPAVQwtPlot@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotCurve::setData(double const *,double const *,int)" (?setData@QwtPlotCurve@@QAEXPBN0H@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlotCurve::QwtPlotCurve(class QString const &)" (??0QwtPlotCurve@@QAE@ABVQString@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlot::QwtPlot(class QwtText const &,class QWidget *)" (??0QwtPlot@@QAE@ABVQwtText@@PAVQWidget@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::QwtText(class QString const &,enum QwtText::TextFormat)" (??0QwtText@@QAE@ABVQString@@W4TextFormat@0@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>C:\Qt\4.3.3\QWT\qwt-5.0.2\qwt-5.0.2\examples\plotting\Release\plotting.exe : fatal error LNK1120: 7 unresolved externals


what do you think is wrong.??
  • Go to the top of the page

4

Monday, March 31st 2008, 6:35pm

RE: QwtPlot Widget not working.

qwt libraries are not linked qith your application
I'll see and post some info
Nicolas
  • Go to the top of the page

5

Monday, March 31st 2008, 6:38pm

RE: QwtPlot Widget not working.

did you add this to your .pro file

Source code

1
2
3
QWTDIR       = /path/to/qwt
INCLUDEPATH += $$QWTDIR/src
LIBS        += -L$$QWTDIR/lib -lqwt

notice that I'm under Linux
Nicolas

This post has been edited 2 times, last edit by "Nicolas SOUCHON" (Mar 31st 2008, 6:40pm)

  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

6

Tuesday, April 1st 2008, 7:19am

Linked

Hi i have linked all the library and include directories in VS2005 in the project Properties.I have these linker error's still .

Source code

1
2
3
4
5
6
7
error LNK2019: unresolved external symbol "public: __thiscall QwtPlot::QwtPlot(class QWidget *)" (??0QwtPlot@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_plottingClass::setupUi(class QDialog *)" (?setupUi@Ui_plottingClass@@QAEXPAVQDialog@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::~QwtText(void)" (??1QwtText@@QAE@XZ) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotItem::attach(class QwtPlot *)" (?attach@QwtPlotItem@@QAEXPAVQwtPlot@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: void __thiscall QwtPlotCurve::setData(double const *,double const *,int)" (?setData@QwtPlotCurve@@QAEXPBN0H@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlotCurve::QwtPlotCurve(class QString const &)" (??0QwtPlotCurve@@QAE@ABVQString@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtPlot::QwtPlot(class QwtText const &,class QWidget *)" (??0QwtPlot@@QAE@ABVQwtText@@PAVQWidget@@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
1>plotting.obj : error LNK2019: unresolved external symbol "public: __thiscall QwtText::QwtText(class QString const &,enum QwtText::TextFormat)" (??0QwtText@@QAE@ABVQString@@W4TextFormat@0@@Z) referenced in function "public: __thiscall plotting::plotting(class QWidget *,class QFlags<enum Qt::WindowType>)" (??0plotting@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
  • Go to the top of the page

7

Tuesday, April 1st 2008, 8:03am

RE: Linked

show your .pro file

or at least the command executed to link your application

error messages aren't sufficient
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

8

Tuesday, April 1st 2008, 9:56am

RE: Linked

Hey i am sorry but there is no .pro file in the directory in which the project is created. I am using Qt 4.3.3 integrated with VS2005. I have a .qrc file. Hey where do i find the .pro files. I have Qt integrated with VS2005. So i debug the program in VS and see the o/p there itself. I set all the inculude and Library Directories in the Project Property window.
  • Go to the top of the page

9

Tuesday, April 1st 2008, 11:36am

RE: Linked

Quoted

Originally posted by Nicolas SOUCHON
or at least the command executed to link your application
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

10

Tuesday, April 1st 2008, 11:51am

Build Log

Hey i have attached the build log which was created.
crazycoder has attached the following file:
  • BuildLog.htm (16.31 kB - 13 times downloaded - Last download: Jun 8th 2008, 1:28pm)
  • Go to the top of the page

11

Tuesday, April 1st 2008, 12:55pm

RE: Build Log

qwt library path is ok
qwt library is not in the linked libraries
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

12

Tuesday, April 1st 2008, 5:18pm

RE: Build Log

Hey thank you for the interest in helping me out with my problem.. I added the path of both Qt and Qwt Lib to the project properties.But i still have errors. what should i do now. ?( . ??
  • Go to the top of the page

13

Wednesday, April 2nd 2008, 9:50am

RE: Build Log

you've added the path to Qwt library, that's ok

you must now add Qwt library to the list of the linked libraries
I don't know how it can be made with VS2005
search in the project options
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

14

Wednesday, April 2nd 2008, 1:07pm

How in Qt designer

Hey i don think this program is going to work in Qt4.3.3 with VS2005. Can u pls tell me how i cud implement the same program in Qt. Thank You Nicolas
  • Go to the top of the page

15

Wednesday, April 2nd 2008, 5:00pm

RE: How in Qt designer

I think it should work with Qt 4 and VS2005

the problem is not a Qt problem,

it's to find in VS2005 the way to add a library to link to the application

probably in the project's settings, "near" where you added the path
Nicolas
  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

16

Thursday, April 3rd 2008, 7:21am

Bingo !!!

Hey thank You so Much :) All the Linker errors have vanished. I added qwt5.lib to Additional Dependencies line. In the project Properties. The program executes properly and
the form pop's up. But no graph. It only shows the default qwtplot widget on the form without any curves. ??? ;(
  • Go to the top of the page

17

Thursday, April 3rd 2008, 9:21am

how are data x, y1, y2 initialized ?
Nicolas

This post has been edited 1 times, last edit by "Nicolas SOUCHON" (Apr 3rd 2008, 9:22am)

  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

18

Friday, April 4th 2008, 6:21am

QwtPlot Widget not working

Hey i got this example program on a site ---> http://qwt.sourceforge.net/class_qwt_plo…2c0726b5f31e271
i tried to modify it but it is not working. !! ?(
  • Go to the top of the page

19

Friday, April 4th 2008, 8:29am

again

Quoted

Originally posted by Nicolas SOUCHON
how are data x, y1, y2 initialized ?
Nicolas

This post has been edited 1 times, last edit by "Nicolas SOUCHON" (Apr 4th 2008, 8:29am)

  • Go to the top of the page

crazycoder

Trainee

Posts: 128

Occupation: Software Engineer

20

Friday, April 4th 2008, 9:02am

QwtPlot Widget not working

Source code

1
double x[100], y1[100], y2[100];   ---- > x,y,y1 initialized here.


Hey Nicolas and even the graph Title [Two Curves] is not displayed. Only the default qwtplot widget with the scale is displayed. ? ?( What do you think is wrong. ?
  • Go to the top of the page

Rate this thread