Diffstat (limited to 'core/applets/batteryapplet/battery.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 078ce8d..15eb762 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp | |||
@@ -34,7 +34,10 @@ BatteryMeter::BatteryMeter( QWidget *parent ) | |||
34 | { | 34 | { |
35 | ps = new PowerStatus; | 35 | ps = new PowerStatus; |
36 | startTimer( 10000 ); | 36 | startTimer( 10000 ); |
37 | |||
38 | setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) ); | ||
37 | setFixedHeight( AppLnk::smallIconSize() ); | 39 | setFixedHeight( AppLnk::smallIconSize() ); |
40 | |||
38 | chargeTimer = new QTimer( this ); | 41 | chargeTimer = new QTimer( this ); |
39 | connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); | 42 | connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); |
40 | timerEvent(0); | 43 | timerEvent(0); |
@@ -51,7 +54,7 @@ BatteryMeter::~BatteryMeter() | |||
51 | 54 | ||
52 | QSize BatteryMeter::sizeHint() const | 55 | QSize BatteryMeter::sizeHint() const |
53 | { | 56 | { |
54 | return QSize(10, height() ); | 57 | return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() ); |
55 | } | 58 | } |
56 | 59 | ||
57 | void BatteryMeter::mousePressEvent( QMouseEvent* e ) | 60 | void BatteryMeter::mousePressEvent( QMouseEvent* e ) |
@@ -116,14 +119,15 @@ void BatteryMeter::chargeTimeout() | |||
116 | 119 | ||
117 | void BatteryMeter::paintEvent( QPaintEvent* ) | 120 | void BatteryMeter::paintEvent( QPaintEvent* ) |
118 | { | 121 | { |
122 | qWarning("paint"); | ||
119 | if ( style == 1 ) | 123 | if ( style == 1 ) |
120 | { | 124 | { |
121 | QPainter p(this); | 125 | QPainter p(this); |
122 | QFont f( "Fixed", AppLnk::smallIconSize()/2 ); | 126 | QFont f( "Fixed", AppLnk::smallIconSize()/2 ); |
123 | QFontMetrics fm( f ); | 127 | QFontMetrics fm( f ); |
124 | p.setFont( f ); | 128 | p.setFont( f ); |
125 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); | 129 | p.drawText( 0, height()/2, QString::number( percent ) ); |
126 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); | 130 | p.drawText( width()/4, height(), "%" ); |
127 | return; | 131 | return; |
128 | } | 132 | } |
129 | 133 | ||