• 7910阅读
  • 1回复

[提问]QPainter::begin: A paint device can only be painted by one painter at a time. [复制链接]

上一主题 下一主题
离线294987445
 
只看楼主 倒序阅读 楼主  发表于: 2011-08-24
定义三个GLWidget类 ,GLWidget继承自QGLWidget类
g1 = new GLWidget(this,widgetW,widgetH,pix,px);  
g2 = new GLWidget(this,widgetW,widgetH,pix,px);  
g3 = new GLWidget(this,widgetW,widgetH,pix,px);


timer = new QTimer(this);    
connect(timer, SIGNAL(timeout()), g1, SLOT(animate()));    
connect(timer, SIGNAL(timeout()), g2, SLOT(animate()));    
connect(timer, SIGNAL(timeout()), g3, SLOT(animate()));  
timer->start(40);

void GLWidget::animate()
{
        this->repaint();
}

void GLWidget::paintEvent(QPaintEvent *event)
{    
           painter = new QPainter(this);  
           painter->begin(this);    
           painter->setRenderHint(QPainter::Antialiasing);  
           painter->drawPixmap(QPoint(0,0),pix);    
           painter->end();
}


画出的pixmap会出现屏闪  
显示QPainter::begin: A paint device can only be painted by one painter at a time.
          QGLShader::link: "Fragment shader(s) linked, vertex shader(s) linked."


请问是为什么啊   谢谢啊  
离线294987445
只看该作者 1楼 发表于: 2011-08-25
怎么没有人知道啊   自己顶一个
快速回复
限100 字节
 
上一个 下一个