mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-28 11:42:42 +01:00
* Properly center spinner.
This commit is contained in:
parent
246d935c04
commit
5d977d1ca7
@ -28,6 +28,9 @@
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QShowEvent>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
|
||||
AnimatedSpinner::AnimatedSpinner( QWidget *parent )
|
||||
: QWidget( parent )
|
||||
, m_showHide( new QTimeLine )
|
||||
@ -107,7 +110,7 @@ AnimatedSpinner::paintEvent( QPaintEvent* event )
|
||||
Q_UNUSED( event );
|
||||
if ( m_autoCenter && parentWidget() )
|
||||
{
|
||||
QPoint center = parentWidget()->contentsRect().center();
|
||||
QPoint center = parentWidget()->contentsRect().center() - QPoint( sizeHint().width() / 2, sizeHint().height() / 2 );
|
||||
if ( center != pos() )
|
||||
{
|
||||
move( center );
|
||||
@ -144,7 +147,6 @@ AnimatedSpinner::drawFrame( QPainter* p, const QRect& rect )
|
||||
}
|
||||
|
||||
p->setRenderHint( QPainter::Antialiasing, true );
|
||||
|
||||
p->translate( rect.center() + QPoint( 0, 1 ) ); // center
|
||||
|
||||
const qreal stepRadius = (360 + 2*m_armWidth) / segmentCount();
|
||||
@ -214,12 +216,10 @@ AnimatedSpinner::sizeHint() const
|
||||
void
|
||||
AnimatedSpinner::frameChanged( int frame )
|
||||
{
|
||||
|
||||
if ( m_currentIndex == frame || frame > segmentCount() - 1 )
|
||||
return;
|
||||
|
||||
m_currentIndex = frame;
|
||||
|
||||
Q_ASSERT( frame >= 0 && frame < m_colors.size() );
|
||||
|
||||
// calculate colors, save a factor from 1 to 0 behind the current item
|
||||
|
Loading…
x
Reference in New Issue
Block a user