How can I change the pointSize of a QLabel?
Unsolved
General and Desktop
-
I tried this, but the font just be default
auto *animation = new QPropertyAnimation(&lyrics[i], "font"); animation->setDuration(200); animation->setStartValue(lyrics[i].font()); animation->setEndValue(QFont("Noto Sans CJK SC Medium", 18, QFont::Bold; animation->setEasingCurve(QEasingCurve::OutQuad); animation->start(QAbstractAnimation::DeleteWhenStopped);
-
@Z3PHYR
This attempts to animate/increment aQFont
object, which of course makes no sense --- what could it mean/how could it be achieved? You want to animate the font size, which is a number. The types which you can animate are listed in https://doc.qt.io/qt-6/qvariantanimation.html#details.Have a look at https://stackoverflow.com/a/68131633/489865, and translate to C++. As the guy there says:
There is no property for the font size, though, so there are two possibilities:
create a custom property (by using the pyqtProperty decorator in PyQt);
use a QVariantAnimation, which is not bound to any property;
Pick whichever way you prefer.