Quick animation to show a semi-transparent circle
I am developing a simple test app with Qt for Android. I'm trying to animate each user on the screen by showing a semi-transparent circle that increases their radius from 0 to 100, for example.
I added a custom QLabel on top of all the widgets. And I am trying to animate his QPixmap by updating it with QPropertyAnimation for a custom property
Q_PROPERTY(QRect circleGeometry READ getCircleGeometry WRITE setCircleGeometry)
Installer:
void CircleLabel::setCircleGeometry(QRect circleGeometry)
{
QPixmap pixmap(this->size());
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setOpacity(0.2);
painter.setPen(QPen(Qt::transparent));
painter.setBrush(QBrush(Qt::white));
painter.setRenderHint(QPainter::Antialiasing);
painter.drawEllipse(circleGeometry);
this->setPixmap(pixmap);
}
I see that the setter is too heavy to animate, so it is slow on my android device. Could you please advise me how I can change my animation to make it fast and smooth.
+3
source to share