int main(int argc, char *argv[]){ QApplication app(argc,argv); PainterWidget* widget = new PainterWidget(); widget->show(); return app.exec(); }
int main(int argc, char *argv[]){ IplImage *ball; IplImage *dodgeball; IplImage *gameover; ball = cvLoadImage("ball.jpg"); ball = cvLoadImage("ball.jpg"); dodgeball = cvLoadImage("dodge.jpg", 1); gameover = cvLoadImage("gameover.jpg", 1); QApplication app(argc,argv); PainterWidget* widget = new PainterWidget(); widget->addBall(dodgeball, gameover); widget->show(); return app.exec(); }
void tst_QOpenGLWidget::reparentToAlreadyCreated() { QWidget w1; PainterWidget *glw = new PainterWidget(&w1); w1.resize(640, 480); glw->resize(320, 200); w1.show(); QTest::qWaitForWindowExposed(&w1); QWidget w2; w2.show(); QTest::qWaitForWindowExposed(&w2); glw->setParent(&w2); glw->show(); QImage image = glw->grabFramebuffer(); QCOMPARE(image.width(), 320); QCOMPARE(image.height(), 200); QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255)); }