mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-13 04:21:51 +02:00
* Don't animate initial hide.
This commit is contained in:
parent
90bba51411
commit
af4898331a
@ -44,7 +44,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
|
||||
m_splitter->addWidget( m_stack );
|
||||
m_splitter->addWidget( m_queueView );
|
||||
m_splitter->hide( 1 );
|
||||
m_splitter->hide( 1, false );
|
||||
|
||||
m_widget->layout()->setMargin( 0 );
|
||||
m_widget->layout()->addWidget( m_splitter );
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <QDebug>
|
||||
#include <QTimeLine>
|
||||
|
||||
#define ANIMATION_TIME 300
|
||||
|
||||
|
||||
AnimatedSplitter::AnimatedSplitter( QWidget* parent )
|
||||
: QSplitter( parent )
|
||||
@ -14,11 +16,12 @@ AnimatedSplitter::AnimatedSplitter( QWidget* parent )
|
||||
|
||||
|
||||
void
|
||||
AnimatedSplitter::show( int index )
|
||||
AnimatedSplitter::show( int index, bool animate )
|
||||
{
|
||||
if ( m_greedyIndex < 0 )
|
||||
return;
|
||||
|
||||
int time = animate ? ANIMATION_TIME : 0;
|
||||
m_animateIndex = index;
|
||||
|
||||
QWidget* w = widget( index );
|
||||
@ -27,7 +30,7 @@ AnimatedSplitter::show( int index )
|
||||
|
||||
m_greedyHeight = widget( m_greedyIndex )->height();
|
||||
|
||||
QTimeLine *timeLine = new QTimeLine( 300, this );
|
||||
QTimeLine *timeLine = new QTimeLine( time, this );
|
||||
timeLine->setFrameRange( w->height(), size.height() );
|
||||
timeLine->setUpdateInterval( 10 );
|
||||
timeLine->setCurveShape( QTimeLine::EaseOutCurve );
|
||||
@ -41,11 +44,12 @@ AnimatedSplitter::show( int index )
|
||||
|
||||
|
||||
void
|
||||
AnimatedSplitter::hide( int index )
|
||||
AnimatedSplitter::hide( int index, bool animate )
|
||||
{
|
||||
if ( m_greedyIndex < 0 )
|
||||
return;
|
||||
|
||||
int time = animate ? ANIMATION_TIME : 0;
|
||||
m_animateIndex = index;
|
||||
|
||||
QWidget* w = widget( index );
|
||||
@ -53,7 +57,7 @@ AnimatedSplitter::hide( int index )
|
||||
|
||||
m_greedyHeight = widget( m_greedyIndex )->height();
|
||||
|
||||
QTimeLine *timeLine = new QTimeLine( 300, this );
|
||||
QTimeLine *timeLine = new QTimeLine( time, this );
|
||||
timeLine->setFrameRange( 25, w->height() );
|
||||
timeLine->setUpdateInterval( 10 );
|
||||
timeLine->setDirection( QTimeLine::Backward );
|
||||
|
@ -10,8 +10,8 @@ Q_OBJECT
|
||||
public:
|
||||
explicit AnimatedSplitter( QWidget* parent = 0 );
|
||||
|
||||
void show( int index );
|
||||
void hide( int index );
|
||||
void show( int index, bool animate = true );
|
||||
void hide( int index, bool animate = true );
|
||||
|
||||
void setGreedyWidget( int index ) { m_greedyIndex = index; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user