Hi..
I deleted all my code and tried again but still its not happening.. i have no clue what can be the reason for non-creation of a line on the canvas... I am putting on the code.. Please help me to sort out the error...
canvasmouse.h
#ifndef CANVASMOUSE_H
#define CANVASMOUSE_H
#include "ui_zoomsample.h"
#include <Q3CanvasView>
#include <Q3Canvas>
#include <Qt>
#include <QtGui>
#include <Q3CanvasLine>
class CanvasMouse: public Q3CanvasView
{
Q_OBJECT
public:
CanvasMouse
(Q3Canvas
*pCanvas,
QFrame *frame
);
~CanvasMouse();
private:
void drawLine();
Q3Canvas *m_pCanvas;
Q3CanvasLine *m_pCanvasLine;
};
#endif
#ifndef CANVASMOUSE_H
#define CANVASMOUSE_H
#include "ui_zoomsample.h"
#include <Q3CanvasView>
#include <Q3Canvas>
#include <Qt>
#include <QtGui>
#include <Q3CanvasLine>
class CanvasMouse: public Q3CanvasView
{
Q_OBJECT
public:
CanvasMouse(Q3Canvas *pCanvas,QFrame *frame);
~CanvasMouse();
private:
void drawLine();
Q3Canvas *m_pCanvas;
Q3CanvasLine *m_pCanvasLine;
};
#endif
To copy to clipboard, switch view to plain text mode
canvasmouse.cpp
#include "canvasmouse.h"
CanvasMouse
::CanvasMouse(Q3Canvas
*pCanvas,
QFrame *frame
): Q3CanvasView
(frame
){
m_pCanvas = pCanvas;
Q3CanvasView::setCanvas(m_pCanvas);
m_pCanvas->setBackgroundColor(Qt::white);
Q3CanvasView::resize(400, 400);
drawLine();
}
CanvasMouse::~CanvasMouse()
{
}
void CanvasMouse::drawLine()
{
m_pCanvasLine = new Q3CanvasLine(m_pCanvas);
m_pCanvasLine->setPoints(10,10,100,10);
m_pCanvasLine->show();
resizeContents(400,400);
}
#include "canvasmouse.h"
CanvasMouse::CanvasMouse(Q3Canvas *pCanvas, QFrame *frame): Q3CanvasView(frame)
{
m_pCanvas = pCanvas;
Q3CanvasView::setCanvas(m_pCanvas);
m_pCanvas->setBackgroundColor(Qt::white);
Q3CanvasView::resize(400, 400);
drawLine();
}
CanvasMouse::~CanvasMouse()
{
}
void CanvasMouse::drawLine()
{
m_pCanvasLine = new Q3CanvasLine(m_pCanvas);
m_pCanvasLine->setPoints(10,10,100,10);
m_pCanvasLine->show();
resizeContents(400,400);
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QApplication>
#include "imagezoomer.h"
#include "ui_zoomsample.h"
int main(int argc, char **argv)
{
Ui::MainWindow *ui;
ui = new Ui::MainWindow();
ui->setupUi(form);
Q3Canvas *pCanvas = new Q3Canvas;
ImageZoomer imgzoom(ui,pCanvas);
form->show();
return app.exec();
}
#include <QApplication>
#include "imagezoomer.h"
#include "ui_zoomsample.h"
int main(int argc, char **argv)
{
QApplication app(argc,argv);
QMainWindow *form = new QMainWindow;
Ui::MainWindow *ui;
ui = new Ui::MainWindow();
ui->setupUi(form);
Q3Canvas *pCanvas = new Q3Canvas;
ImageZoomer imgzoom(ui,pCanvas);
form->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
imagezoomer.h
#include "imagezoomer.h"
#include <QtGui>
#include <qdir.h>
#include <QColor>
ImageZoomer::ImageZoomer(Ui::MainWindow *_mwin, Q3Canvas *pCanvas): mwin(_mwin),m_pCanvas(pCanvas)
{
frame
= new QFrame(mwin
->centralwidget
);
frame
->setGeometry
(QRect(60,
70,
591,
571));
frame
->setFrameShape
(QFrame::StyledPanel);
frame
->setFrameShadow
(QFrame::Plain);
canmouse = new CanvasMouse(m_pCanvas,frame);
}
ImageZoomer::~ImageZoomer()
{
}
#include "imagezoomer.h"
#include <QtGui>
#include <qdir.h>
#include <QColor>
ImageZoomer::ImageZoomer(Ui::MainWindow *_mwin, Q3Canvas *pCanvas): mwin(_mwin),m_pCanvas(pCanvas)
{
frame = new QFrame(mwin->centralwidget);
frame->setGeometry(QRect(60, 70, 591, 571));
frame->setFrameShape(QFrame::StyledPanel);
frame->setFrameShadow(QFrame::Plain);
canmouse = new CanvasMouse(m_pCanvas,frame);
}
ImageZoomer::~ImageZoomer()
{
}
To copy to clipboard, switch view to plain text mode
There is no compilation error.. It has to be somewhere logical... and i am not able to catch it.. Please help me in finding it out..
Thanking you...
Kapil
Bookmarks