예제 #1
0
int main(int argc, char *argv[]){
	
	QApplication app(argc,argv);
	PainterWidget* widget = new PainterWidget();

	widget->show();

	return app.exec();

}
예제 #2
0
bool
PainterWidget::
is_ancestor_of(PainterWidget *q)
{
  for(PainterWidget *p = q; p != NULL; p = p->parent())
    {
      if(this == p)
        return true;
    }
  return false;
}
예제 #3
0
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();

}
예제 #4
0
void tst_QOpenGLWidget::reparentToNotYetCreated()
{
    QWidget w1;
    PainterWidget *glw = new PainterWidget(&w1);
    w1.resize(640, 480);
    glw->resize(320, 200);
    w1.show();
    QTest::qWaitForWindowExposed(&w1);

    QWidget w2;
    glw->setParent(&w2);
    w2.show();
    QTest::qWaitForWindowExposed(&w2);

    QImage image = glw->grabFramebuffer();
    QCOMPARE(image.width(), 320);
    QCOMPARE(image.height(), 200);
    QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
}
예제 #5
0
void tst_QOpenGLWidget::painter()
{
    QWidget w;
    PainterWidget *glw = new PainterWidget(&w);
    w.resize(640, 480);
    glw->resize(320, 200);
    w.show();
    QTest::qWaitForWindowExposed(&w);

    QImage image = glw->grabFramebuffer();
    QCOMPARE(image.width(), glw->width());
    QCOMPARE(image.height(), glw->height());
    QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));

    glw->m_clear = true;
    image = glw->grabFramebuffer();
    QVERIFY(image.pixel(20, 10) == qRgb(0, 255, 0));
}