本文整理汇总了C++中QTimeLine::currentFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimeLine::currentFrame方法的具体用法?C++ QTimeLine::currentFrame怎么用?C++ QTimeLine::currentFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimeLine
的用法示例。
在下文中一共展示了QTimeLine::currentFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateOpacity
void updateOpacity()
{
QPoint pos = q->parentWidget()->mapFromGlobal(QCursor::pos());
QRect opaqueRect = q->geometry();
bool opaqueCollapser = opaqueRect.contains(pos);
int frame = mOpacityTimeLine->currentFrame();
if (opaqueCollapser && frame == mOpacityTimeLine->startFrame()) {
mOpacityTimeLine->setDirection(QTimeLine::Forward);
startTimeLine();
} else if (!opaqueCollapser && frame == mOpacityTimeLine->endFrame()) {
mOpacityTimeLine->setDirection(QTimeLine::Backward);
startTimeLine();
}
}
示例2: updateIndex
//.........这里部分代码省略.........
HoverControls* controls = new HoverControls( m_view );
controls->setFixedSize( m_margin * 2, m_margin + m_margin / 4 );
controls->move( cRect.center() - QPoint( controls->width() / 2 -1, controls->height() / 2 -1 ) );
controls->setContentsMargins( 0, 0, 0, 0 );
controls->setFocusPolicy( Qt::NoFocus );
controls->installEventFilter( this );
controls->show();
NewClosure( controls, SIGNAL( play() ),
const_cast<GridItemDelegate*>(this), SLOT( onPlayClicked( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
m_hoverControls[ index ] = controls;
}
if ( m_hoveringOverArtist != index || ( !hoveringArtist && m_hoveringOverArtist.isValid() ) )
{
emit updateIndex( m_hoveringOverArtist );
if ( hoveringArtist )
m_hoveringOverArtist = index;
else
m_hoveringOverArtist = QPersistentModelIndex();
emit updateIndex( index );
}
if ( m_hoveringOverAlbum != index || ( !hoveringAlbum && m_hoveringOverAlbum.isValid() ) )
{
emit updateIndex( m_hoveringOverAlbum );
if ( hoveringAlbum )
m_hoveringOverAlbum = index;
else
m_hoveringOverAlbum = QPersistentModelIndex();
emit updateIndex( index );
}
if ( m_hoveringOverBuyButton != index || ( !hoveringBuyButton && m_hoveringOverBuyButton.isValid() ) )
{
emit updateIndex( m_hoveringOverBuyButton );
if ( hoveringBuyButton )
m_hoveringOverBuyButton = index;
else
m_hoveringOverBuyButton = QPersistentModelIndex();
emit updateIndex( index );
}
if ( m_hoverIndex != index || !hoveringCover )
{
if ( m_hoverIndex.isValid() )
{
int startFrame = 100;
if ( m_hoverFaders.contains( m_hoverIndex ) )
{
QTimeLine* oldFader = m_hoverFaders.take( m_hoverIndex );
startFrame = oldFader->currentFrame();
oldFader->deleteLater();
}
QTimeLine* fadeOut = createTimeline( QTimeLine::Backward, startFrame );
_detail::Closure* c = NewClosure( fadeOut, SIGNAL( frameChanged( int ) ), this, SLOT( fadingFrameChanged( QPersistentModelIndex ) ), QPersistentModelIndex( m_hoverIndex ) );
c->setAutoDelete( false );
c = NewClosure( fadeOut, SIGNAL( finished() ), this, SLOT( fadingFrameFinished( QPersistentModelIndex ) ), QPersistentModelIndex( m_hoverIndex ) );
c->setAutoDelete( false );
m_hoverFaders[ m_hoverIndex ] = fadeOut;
fadeOut->start();
}
emit updateIndex( m_hoverIndex );
foreach ( HoverControls* controls, m_hoverControls )
controls->deleteLater();
m_hoverControls.clear();
m_hoverIndex = QPersistentModelIndex();
}
if ( hoveringCover && m_hoverIndex != index )
{
m_hoverIndex = index;
int startFrame = 0;
if ( m_hoverFaders.contains( index ) )
{
QTimeLine* oldFader = m_hoverFaders.take( index );
startFrame = oldFader->currentFrame();
oldFader->deleteLater();
}
QTimeLine* fadeIn = createTimeline( QTimeLine::Forward, startFrame );
_detail::Closure* c = NewClosure( fadeIn, SIGNAL( frameChanged( int ) ), this, SLOT( fadingFrameChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
c->setAutoDelete( false );
c = NewClosure( fadeIn, SIGNAL( finished() ), this, SLOT( fadingFrameFinished( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
c->setAutoDelete( false );
m_hoverFaders[ index ] = fadeIn;
fadeIn->start();
emit updateIndex( index );
}