PDA

View Full Version : how to plot graph using qwt ?



sunitverma04
31st March 2010, 08:56
Hi,

I am new to qt -creator. I have installed the library "libqwt-dev" from synaptics (i am using Ubuntu 9.10). But when i try to "make" the examples of qwt, i get error in it.
Can you please let me know how to plot a graph in qt-creator. If possible could you provide any project related to that ?

Please help me

Regards,

sunit

qtprgrmr
12th April 2010, 16:16
I recommend that you download qwt sources and it compile on your OS.

http://sourceforge.net/projects/qwt/

first copy the download file for example in your home folder, in /home/user, and extract there the files.
into this folder you have to choose the correct options for the compilation, to compile the examples and create all good

make the following changes in /home/user/qwt-5.2/qwtconfig.pri file


################################################## ####################
# Install paths
################################################## ####################

VER_MAJ = 5
VER_MIN = 2
VER_PAT = 1
VERSION = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}

unix {
INSTALLBASE = /usr/local/qwt-$$VERSION-svn
}

win32 {
INSTALLBASE = C:/Qwt-$$VERSION-svn
}

target.path = $$INSTALLBASE/lib
headers.path = $$INSTALLBASE/include
doc.path = $$INSTALLBASE/doc

################################################## ####################
# qmake internal options
################################################## ####################

CONFIG += qt # Also for Qtopia Core!
CONFIG += warn_on
CONFIG += thread
CONFIG += silent

################################################## ####################
# release/debug mode
# If you want to build both DEBUG_SUFFIX and RELEASE_SUFFIX
# have to differ to avoid, that they overwrite each other.
################################################## ####################

VVERSION = $$[QT_VERSION]
isEmpty(VVERSION) {

# Qt 3
CONFIG += debug # release/debug
}
else {
# Qt 4
win32 {
# On Windows you can't mix release and debug libraries.
# The designer is built in release mode. If you like to use it
# you need a release version. For your own application development you
# might need a debug version.
# Enable debug_and_release + build_all if you want to build both.

#CONFIG += debug # release/debug/debug_and_release
#CONFIG += debug_and_release
CONFIG += build_all
}
else {
CONFIG += debug # release/debug
}
}

################################################## ####################
# If you want to have different names for the debug and release
# versions you can add a suffix rule below.
################################################## ####################

DEBUG_SUFFIX = d
RELEASE_SUFFIX = r

win32 {
DEBUG_SUFFIX = d
}

################################################## ####################
# Build the static/shared libraries.
# If QwtDll is enabled, a shared library is built, otherwise
# it will be a static library.
################################################## ####################

CONFIG += QwtDll

################################################## ####################
# QwtPlot enables all classes, that are needed to use the QwtPlot
# widget.
################################################## ####################

CONFIG += QwtPlot

################################################## ####################
# QwtWidgets enables all classes, that are needed to use the all other
# widgets (sliders, dials, ...), beside QwtPlot.
################################################## ####################

CONFIG += QwtWidgets

################################################## ####################
# If you want to display svg imageson the plot canvas, enable the
# line below. Note that Qwt needs the svg+xml, when enabling
# QwtSVGItem.
################################################## ####################

#CONFIG += QwtSVGItem

################################################## ####################
# You can use the MathML renderer of the Qt solutions package to
# enable MathML support in Qwt. # If you want this, copy
# qtmmlwidget.h + qtmmlwidget.cpp to # textengines/mathml and enable
# the line below.
################################################## ####################

#CONFIG += QwtMathML

################################################## ####################
# If you want to build the Qwt designer plugin,
# enable the line below.
# Otherwise you have to build it from the designer directory.
################################################## ####################

CONFIG += QwtDesigner

################################################## ####################
# If you want to auto build the examples, enable the line below
# Otherwise you have to build them from the examples directory.
################################################## ####################

CONFIG += QwtExamples

then open a terminal and install with ./conficure, make and make install, remember you must be root to perform the make install.

the make install create this folder /usr/local/qwt-5.2.1-svn, and there, you have other two folders /includes and /libs.

finally to view the qwt examples you have to introduce the qwt libs in a environment variable -> LD_LIBRARY_PATH, with this command in a terminal or in the profile file.

export LD_LIBRARY_PATH=$LD_LIBARRY_PATH:/usr/local/qwt-5.2.1-svn/lib

you can see the examples that provides qwt.

cd /home/user/qwt-5.2/examples/bind
and there, you can execute all the different examples like ./cpuplot

the last option that you can do is introduce the qwt plugin into a qt creator , only you have copy /home/user/qwt-5.2/designer/plugins/designer/libqwt_designer_plugind.so here /home/user/qtsdk-2009.04/lib/qtcreator.

When you create your application you have to introduce those commands in the .pro file
INCLUDEPATH += /usr/local/qwt-5.2.1-svn/include
LIBS += /usr/local/qwt-5.2.1-svn/lib/libqwtd.so.5

if you do not understand any thing , ask me.
I hope to help you and sorry because my English is not very good

qtlinuxnewbie
13th April 2010, 13:50
@qtprgrmr

i did as u said but when i run the qt creator, i am getting the following error :
Error while loading shared libraries: libqwt.so.5: cannot open shared object file: No such file or directory

/root/graphs/graphs/graphs exited with code 127