QGraphicsView/QGraphicsScene rotating wheel
Unsolved
General and Desktop
-
Hi,
i need a rotating wheel and with this code it is nearly possible (without any stucks)wheelWidget::wheelWidget(QWidget *parent) : QGraphicsView(parent)
{
this->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);setViewport(new QOpenGLWidget); this->setViewportUpdateMode(QGraphicsView::NoViewportUpdate); wheel_pix = QPixmap(":/wheel.png"); this->setOptimizationFlags(QGraphicsView::DontSavePainterState | QGraphicsView::DontAdjustForAntialiasing); this->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); this->setAttribute(Qt::WA_NoSystemBackground); QGraphicsScene *scene = new QGraphicsScene(this); scene->setItemIndexMethod(QGraphicsScene::NoIndex); setScene(scene); QLabel *rotateWheel = new QLabel(); rotateWheel->setPixmap(wheel_pix); rotateWheel->setStyleSheet("background: transparent"); QGraphicsProxyWidget *rotateWheelItem = scene->addWidget(rotateWheel); rotateWheelItem->setTransformOriginPoint((qreal)rotateWheel->width()/(qreal)2, (qreal)rotateWheel->height()/(qreal)2); rotateWheel_animation = new QPropertyAnimation(rotateWheelItem, "rotation", this); rotateWheel_animation->setDuration(14400); rotateWheel_animation->setEasingCurve(QEasingCurve::InOutCubic); connect(this, SIGNAL(start_now_wheel()), rotateWheel_animation, SLOT(start())); connect(rotateWheel_animation, SIGNAL(finished()), this, SLOT(animation_wheel_finish()));
..
The dimension of this png is 401*401 pixel. The problem is, if i have a additional running progress bar on the main window, the wheel runs with micro lag. What i know it is not possible to put the widgets in different threads. But it seems that the running progress bar interrupt the rotating wheel display (micro - but visible). The OptimizationFlags helps nothing in this case. Have anyone maybe a idea what i can do on such situation?