dheeraj
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. :)
----newplot.cpp------
#include "newplot.h"
#include <QtGui>
#include "qwt_plot.h"
#include "qwt_scale_widget.h"
newplot::newplot(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
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);
myPlot->replot();
}
-----------newplot.h----------
#ifndef NEWPLOT_H
#define NEWPLOT_H
#include <QtGui/QDialog>
#include "ui_newplot.h"
#include "qwt_plot.h"
class newplot : public QDialog, public Ui::newplot
{
Q_OBJECT
public:
newplot(QWidget *parent = 0);
private slots:
void on_drawButton_clicked();
void draw();
};
#endif // NEWPLOT_H
------------main.cpp----------
#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;
//ui.setupUi(dialog);
dialog->show();
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.
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. :)
----newplot.cpp------
#include "newplot.h"
#include <QtGui>
#include "qwt_plot.h"
#include "qwt_scale_widget.h"
newplot::newplot(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
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);
myPlot->replot();
}
-----------newplot.h----------
#ifndef NEWPLOT_H
#define NEWPLOT_H
#include <QtGui/QDialog>
#include "ui_newplot.h"
#include "qwt_plot.h"
class newplot : public QDialog, public Ui::newplot
{
Q_OBJECT
public:
newplot(QWidget *parent = 0);
private slots:
void on_drawButton_clicked();
void draw();
};
#endif // NEWPLOT_H
------------main.cpp----------
#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;
//ui.setupUi(dialog);
dialog->show();
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.