Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, December 2006
Drawing functionality on frame giving problem


Message 1 in thread

Hi All,
I have created a Mainwindow (widget).
In that i created two qframes.
I wanted to draw lines in side the frame1 and frame 2.
As everybody knows Qframe is inherited by Qwidget i thought i could draw
lines in side it.

I have one button in the window(Main widget )also.
I created all these using qt designer

So in the button click function i tryed to implement it.

What i did is

Note : in the function ECGDrawingarea it is a frame inside the window
void MainProcessingFormImpl::MP_MORE_BUT_Clicked()
{

       QPainter  *ecgpainter;


     // QColor red(255,0,0);
      //Qpen redpen(red,1,SolidLine);
      //ecgpainter.setPen(redpen);
      ecgpainter->begin( (QWidget*)this->ECGDrawingarea ); //Type cast from
frame to qwidget
      qWarning( "\n Test1 " );
   //   ecgpainter->setWindow (0,0,200,200)
      qWarning( "\n Test2 " );
      ecgpainter->setPen(Qt::red);
      qWarning( "\n Test3 " );
      ecgpainter->drawLine(20,20,100,100);
      qWarning( "\n Test4 " );
      ecgpainter->end();
      qWarning( "\n Test5 " );

}

But when i run the application and
when i click the button it is giving segmentation fault error message.

Kindly suggest me what i am doing wrong.

Thanks in advance.

Regards
Harsha