Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 QPainter 绘制动画文本? 我只想定期更改文本的颜色。 如果可能怎么实现?
您需要创建新插槽,您将在其中更改用于绘制文本的变量存储颜色。在您调用的那个插槽的末尾
update();
重绘小部件。
要定期执行此操作,您还需要QTimer连接到该插槽。在paintEvent您将颜色变量设置为由QPainter.
QTimer
paintEvent
QPainter
就这样。