look at this code, it only draw ONE ellipse.
I want to draw TWO ellipses.
What is wrong here?? 

shape.cpp
{
QRectF rectangle1
(10.0,
20.0,
80.0,
60.0);
painter.drawEllipse(rectangle1);
QRectF rectangle2
(100.0,
200.0,
80.0,
60.0);
painter.drawEllipse(rectangle2);
}
void shape::drawMyCircle()
{
QRectF rectangle
(150.0,
250.0,
80.0,
60.0);
painter.drawEllipse(rectangle);
}
void shape::paintEvent( QPaintEvent * )
{
QPainter painter( this );
QRectF rectangle1(10.0, 20.0, 80.0, 60.0);
painter.drawEllipse(rectangle1);
QRectF rectangle2(100.0, 200.0, 80.0, 60.0);
painter.drawEllipse(rectangle2);
}
void shape::drawMyCircle()
{
QPainter painter( this );
QRectF rectangle(150.0, 250.0, 80.0, 60.0);
painter.drawEllipse(rectangle);
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include "shape.h"
#include <QApplication>
int main( int argc, char **argv )
{
shape myShape;
myShape.resize(640, 480);
myShape.show();
myShape.drawMyCircle ();
myShape.show(); //<--- why dont refresh?
return a.exec ();
}
#include "shape.h"
#include <QApplication>
int main( int argc, char **argv )
{
QApplication a ( argc, argv );
shape myShape;
myShape.resize(640, 480);
myShape.show();
myShape.drawMyCircle ();
myShape.show(); //<--- why dont refresh?
return a.exec ();
}
To copy to clipboard, switch view to plain text mode
Bookmarks