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. scrollbar animation effect
Qt 6.11 is out! See what's new in the release blog

scrollbar animation effect

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 360 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1

    I want to give an animation effect that makes the qScrollbar appear whenever I move it and hide it when it stops moving, how can I do that?
    There is a user class that inherits Scrollbar, and we want to animate it by receiving the valuechanged signal.

    void usrScrollBar::VisibleSlider(bool bShow)
    {
    	if (bShow)
    	{
    		auto anim = new QPropertyAnimation(this, "AnmFrameAlpha", this);
    		anim->setDuration(2000);
    		anim->setStartValue(0.00);
    		anim->setEndValue(1.00);
    		anim->start(QAbstractAnimation::DeleteWhenStopped);
    	}
    	else
    	{
    		auto anim = new QPropertyAnimation(this, "windowOpacity");
    		anim->setDuration(2000);
    		anim->setStartValue(1.00);
    		anim->setEndValue(0.00);
    		anim->start(QAbstractAnimation::DeleteWhenStopped);
    
    		emit UserDefineFinishScroll();
    	}
    
    	this->setVisible(bShow);
    }
    
    qreal usrScrollBar::AnmFrameAlpha() const
    {
    	qDebug() << QString("AnmFrameAlpha : %1").arg(this->windowOpacity());
    	return this->windowOpacity();
    }
    
    void usrScrollBar::SetAnmFrameAlpha(qreal rAlpha)
    {
    	this->setWindowOpacity(rAlpha);
    	this->update();
    }
    
    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