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
Qt Code:
  1. #ifndef CANVASMOUSE_H
  2. #define CANVASMOUSE_H
  3.  
  4. #include "ui_zoomsample.h"
  5. #include <Q3CanvasView>
  6. #include <Q3Canvas>
  7. #include <Qt>
  8. #include <QtGui>
  9. #include <Q3CanvasLine>
  10.  
  11. class CanvasMouse: public Q3CanvasView
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. CanvasMouse(Q3Canvas *pCanvas,QFrame *frame);
  17. ~CanvasMouse();
  18.  
  19. private:
  20.  
  21. void drawLine();
  22. Q3Canvas *m_pCanvas;
  23. Q3CanvasLine *m_pCanvasLine;
  24. };
  25.  
  26. #endif
To copy to clipboard, switch view to plain text mode 

canvasmouse.cpp
Qt Code:
  1. #include "canvasmouse.h"
  2. CanvasMouse::CanvasMouse(Q3Canvas *pCanvas, QFrame *frame): Q3CanvasView(frame)
  3. {
  4. m_pCanvas = pCanvas;
  5. Q3CanvasView::setCanvas(m_pCanvas);
  6. m_pCanvas->setBackgroundColor(Qt::white);
  7. Q3CanvasView::resize(400, 400);
  8. drawLine();
  9. }
  10. CanvasMouse::~CanvasMouse()
  11. {
  12. }
  13. void CanvasMouse::drawLine()
  14. {
  15. m_pCanvasLine = new Q3CanvasLine(m_pCanvas);
  16. m_pCanvasLine->setPoints(10,10,100,10);
  17. m_pCanvasLine->show();
  18. resizeContents(400,400);
  19. }
To copy to clipboard, switch view to plain text mode 

main.cpp
Qt Code:
  1. #include <QApplication>
  2. #include "imagezoomer.h"
  3. #include "ui_zoomsample.h"
  4.  
  5. int main(int argc, char **argv)
  6. {
  7. QApplication app(argc,argv);
  8. QMainWindow *form = new QMainWindow;
  9.  
  10. Ui::MainWindow *ui;
  11. ui = new Ui::MainWindow();
  12. ui->setupUi(form);
  13. Q3Canvas *pCanvas = new Q3Canvas;
  14. ImageZoomer imgzoom(ui,pCanvas);
  15. form->show();
  16. return app.exec();
  17. }
To copy to clipboard, switch view to plain text mode 

imagezoomer.h
Qt Code:
  1. #include "imagezoomer.h"
  2. #include <QtGui>
  3. #include <qdir.h>
  4. #include <QColor>
  5.  
  6. ImageZoomer::ImageZoomer(Ui::MainWindow *_mwin, Q3Canvas *pCanvas): mwin(_mwin),m_pCanvas(pCanvas)
  7. {
  8. frame = new QFrame(mwin->centralwidget);
  9. frame->setGeometry(QRect(60, 70, 591, 571));
  10. frame->setFrameShape(QFrame::StyledPanel);
  11. frame->setFrameShadow(QFrame::Plain);
  12.  
  13. canmouse = new CanvasMouse(m_pCanvas,frame);
  14. }
  15. ImageZoomer::~ImageZoomer()
  16. {
  17. }
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