下面的程序只显示了一下,就没了。而且没显示图片,请打下帮忙分析一下,不胜感激!
//while(1)
{
buffer=v4lsyn(dev1,i);
repaint();
v4lcapture(dev1);
}
void imageprocess::paintEvent( QPaintEvent * )
{
paint=new QPainter(this);
paint->begin(this);
label = new QLabel(this);
QImage *img=new QImage((unsigned char*)buffer,640,480,8,0,1,QImage::IgnoreEndian);
QPixmap tmp;
tmp=*img;
label->setPixmap(tmp);
fprintf (stderr, "readjusting width to %d\n", *buffer);
paint->end();
}
下面是调试时显示的错误:
QPainter::begin: Painter is already active.
You must end() the painter before a second begin()
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1084981632 (LWP 6669)]
0x0804d70b in imageprocess::paintEvent(QPaintEvent*) (this=0xbfffe540)
at imageprocess.cpp:243
243 fprintf (stderr, "readjusting width to %d\n", *buffer
如果把while 前的//去掉,就完全打不开界面,本人很是疑惑,这个问题也帮忙分一下,
[ 此贴被XChinux在2007-01-12 14:35重新编辑 ]