DatetimeEdit Section Animation/Styling
-
Hello,
I need to animate datetimeedit widget as follows;
When user focuses/edits year section, it should be animated using opacity property. ( like flickering, show and hide for every second )
I've searched animation part, and it could only be used for widgets/sub-widgets. But the part I'm trying to animate is "section", not widget.
In this context, could you please help me about how to achieve animation on the section part of datetimeedit ?
Is there any other way of handling this feature like styling ?Thanks,
Best Regards -
Hello,
I need to animate datetimeedit widget as follows;
When user focuses/edits year section, it should be animated using opacity property. ( like flickering, show and hide for every second )
I've searched animation part, and it could only be used for widgets/sub-widgets. But the part I'm trying to animate is "section", not widget.
In this context, could you please help me about how to achieve animation on the section part of datetimeedit ?
Is there any other way of handling this feature like styling ?Thanks,
Best Regards@didem
I've found a case as follows; aplying "QPropertyAnimation" for QRect.https://stackoverflow.com/questions/43428627/applying-qpropertyanimation-to-qrect
In my case, I need to apply QPropertyAnimation for "QDateTimeEdit::Section" which is an enum ( https://doc.qt.io/qt-6/qdatetimeedit.html ). The goal is to blink/animate focused part (day) of the QDateTimeEdit widget
Alternatively, I've tried to catch focused part ( day, month or year ) while editing datetime;
this->setStyleSheet("QDateTimeEdit:focus { selection-background-color: red; selection-color: white; }")
For the way stated above, I need to set the stylesheet for different colors for every seconds. But, I could not find the way of transition between the start and end value like in the animation ;
QPushButton *button = new QPushButton(tr("Animated Button"), this); QPropertyAnimation *anim = new QPropertyAnimation(button, "opacity", this); anim->setDuration(1000); anim->setStartValue(1); anim->setEndValue(0) anim->start();
Could you please help me for both alternative ways of solution ?