Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DatetimeEdit Section Animation/Styling
Forum Updated to NodeBB v4.3 + New Features

DatetimeEdit Section Animation/Styling

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 177 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    didem
    wrote on last edited by didem
    #1

    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

    D 1 Reply Last reply
    0
    • D didem

      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

      D Offline
      D Offline
      didem
      wrote on last edited by didem
      #2

      @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 ?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved