How can I use QGraphicsLineItem not as a continuous line but like a dotted line with animated stroke (from 1 to 3 px)?
Asked
Active
Viewed 18 times
0
-
What about creating a QVariantAnimation that updates the item's `pen` property by setting the pen's offset by calling [`setDashOffset()`](https://doc.qt.io/qt-5/qpen.html#setDashOffset)? Note that, since QGraphicsLineItem is not a widget nor a QObject, you have no direct control over or access to the *actual* visibility of the item, so the animation will keep running even if the view is hidden (for instance, while minimizing the window), which may not be optimal in case you have *many* lines. – musicamante Aug 02 '23 at 20:23
-
Thanks for the comment. It's about 15 lines. – Chris P Aug 03 '23 at 08:29
-
setDashOffset works like in svg? – Chris P Aug 03 '23 at 08:30