View Full Version : Not able to connect to qwtplotWidget

6th April 2008, 10:21
Hi guy's.
I am trying to run a program in Qt4.3.3 with VS2005. But there is a problem.
I am using qwtplot widget on a .ui form QDialog and a pushButton called Draw on it.I only want to change the Title and the Scale of the Plot Widget.The project compiles with out an error and the form which i created is displayed but the scale and the Title don't change. The default qwtplot widget s only displayed. Here is the code pls see if you can help me. :)


#include "newplot.h"
#include <QtGui>
#include "qwt_plot.h"
#include "qwt_scale_widget.h"
newplot::newplot(QWidget *parent)
: QDialog(parent)
QwtPlot *myPlot;
connect(drawButton, SIGNAL(clicked()), this, SLOT(draw()));
void newplot::on_drawButton_clicked()
void newplot::draw()
QwtText title( "Two Curves" );
myPlot = new QwtPlot();

myPlot->setAxisTitle(QwtPlot::xBottom, "Time/seconds");
myPlot->setAxisScale(QwtPlot::xBottom, 0, 100);

myPlot->setAxisTitle(QwtPlot::yLeft, "Values");
myPlot->setAxisScale(QwtPlot::yLeft, 0, 50);


#ifndef NEWPLOT_H
#define NEWPLOT_H
#include <QtGui/QDialog>
#include "ui_newplot.h"
#include "qwt_plot.h"

class newplot : public QDialog, public Ui::newplot

newplot(QWidget *parent = 0);
private slots:
void on_drawButton_clicked();
void draw();
#endif // NEWPLOT_H


#include <QtGui/QApplication>
#include "newplot.h"
#include "ui_newplot.h"
#include "qwt_plot.h"

int main(int argc, char *argv[])
QApplication app(argc, argv);
//Ui::newplotClass ui;
newplot *dialog = new newplot;
return app.exec();

Hey i am sorry i wanted to attach the .ui file but its a big file and i am allowed to upload a file size of max 19.5 kb. So i din attach it.

7th April 2008, 07:46
newplot::draw creates an invisible new plot widget each time it is called.


7th April 2008, 09:05
Hey Uwe thank you for the time. How do i modify the program to work with the .Ui form i created. I am not able to connect the code with the Form which i created.:confused: