2011-05-11 5 views
3

QGraphicsItem을 애니메이션화하려고하지만 깜박임을 없애는 방법을 찾을 수 없습니다. 항목에 점 목록 (1.000 이상)이 있고 그 점으로 구성된 폴리 라인이 그려집니다 (예 : 전자 심전도). 이중 버퍼링 (픽스맵에서 선 그리기)을 사용하고 애니메이션을 시도했지만 깜박임이 여전히 존재합니다. 여기에 내가 QProperty 애니메이션Qt 애니메이션 filicker

QPropertyAnimation* animation = new QPropertyAnimation(graph, "pos"); 
animation->setDuration(70000); 
animation->setStartValue(QPointF(0,0)); 
animation->setEndValue(QPointF(-1500,0)); 
animation->start(); 

코드를 개선하는 방법에 대한 아이디어를 사용하고있는 항목

Graph::Graph(float *data,int length,int frequency,QGraphicsItem *parent) : QGraphicsItem(parent),data(data) 
{ 
    this->path = new QPainterPath(); 
    this->pixmap = new QPixmap(3*length,100); 
    QPainter *p = new QPainter(pixmap); 
    for (int i=0; i<length; i++){ 
     path->lineTo(3*i,data[i]); 
    } 
    pixmap->fill(Qt::black); 
    p->setPen(Qt::white); 
    p->drawPath(*path); 
    setCacheMode(DeviceCoordinateCache); 
} 

및 페인트 방법

void Graph::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ 

    QRectF area = option->exposedRect.toRect(); 
    painter->drawPixmap(area,*pixmap,area); 
} 

의 코드는? 부모 위젯과 애니메이션이 플래그를 설정할 수 있습니다 일어나고있는 위치에 위젯에

답변

0

:

parentWidget.setAttribute (Qt는 :: WA_NoSystemBackground을); animatingWidget.setAttribute (Qt :: WA_NoSystemBackground);

관련 문제