C++ (Qt)void MyWidget::paintEvent( QPaintEvent * ){ QPainter m_pPainter( this ); m_pPainter.drawLine( QPoint( 0, 0), QPoint( 200, 200) );}
C++ (Qt)void MyWidget::MyWidget (){ m_pPainter = new QPainter ();} void MyWidget::paintEvent (QPaintEvent * pEvent){ m_pPainter->begin (this); m_pPainter->drawLine( QPoint( 0, 0), QPoint( 200, 200) ); m_pPainter->end ();}