~ubuntu-branches/ubuntu/lucid/amarok/lucid-backports

« back to all changes in this revision

Viewing changes to src/widgets/IconButton.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-03-03 10:27:39 UTC
  • mfrom: (114.1.20 natty)
  • Revision ID: james.westby@ubuntu.com-20110303102739-ar67wpa6mllo59n2
Tags: 2:2.4.0-0ubuntu4~lucid1
* Source backport to lucid (LP: #728447)
  - Drop version requirement on libindicate-qt-dev build-dep

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
****************************************************************************************/
16
16
 
17
17
#include "IconButton.h"
 
18
#include "SvgHandler.h"
18
19
 
19
20
#include <QMouseEvent>
20
21
#include <QPainter>
22
23
#include <QTimerEvent>
23
24
#include <QToolBar>
24
25
 
25
 
 
26
26
IconButton::IconButton( QWidget *parent ) : QWidget( parent )
27
27
    , m_isClick( false )
28
28
{
29
29
    m_anim.step = 0;
30
30
    m_anim.timer = 0;
31
31
    setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
 
32
 
 
33
    // cannot use paletteChanged() from the palette handler directly since the
 
34
    // svg handler also watches it for retinting. So upon palette change, we are
 
35
    // called first and the old svg icons will be used.
 
36
    connect( The::svgHandler(), SIGNAL(retinted()), SLOT(svgRetinted()) );
32
37
}
33
38
 
34
39
void IconButton::setIcon( const QImage &img, int steps )
72
77
    p.end();
73
78
}
74
79
 
75
 
void IconButton::reloadContent( const QSize &sz )
 
80
void IconButton::svgRetinted()
76
81
{
77
 
    setIcon( m_icon.scaled( sz, Qt::KeepAspectRatio, Qt::SmoothTransformation )  );
 
82
    reloadContent( size() );
78
83
}
79
84
 
80
85
void IconButton::resizeEvent( QResizeEvent *re )
81
86
{
82
 
    if ( width() != height() )
 
87
    if( width() != height() )
83
88
        resize( height(), height() );
84
89
    else
85
90
    {