summaryrefslogtreecommitdiff
path: root/core/applets/batteryapplet/battery.cpp
Side-by-side diff
Diffstat (limited to 'core/applets/batteryapplet/battery.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp10
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
@@ -33,9 +33,12 @@ BatteryMeter::BatteryMeter( QWidget *parent )
: QWidget( parent ), charging(false)
{
ps = new PowerStatus;
startTimer( 10000 );
+
+ setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) );
setFixedHeight( AppLnk::smallIconSize() );
+
chargeTimer = new QTimer( this );
connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
timerEvent(0);
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
@@ -50,9 +53,9 @@ BatteryMeter::~BatteryMeter()
}
QSize BatteryMeter::sizeHint() const
{
- return QSize(10, height() );
+ return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() );
}
void BatteryMeter::mousePressEvent( QMouseEvent* e )
{
@@ -115,16 +118,17 @@ void BatteryMeter::chargeTimeout()
}
void BatteryMeter::paintEvent( QPaintEvent* )
{
+ qWarning("paint");
if ( style == 1 )
{
QPainter p(this);
QFont f( "Fixed", AppLnk::smallIconSize()/2 );
QFontMetrics fm( f );
p.setFont( f );
- p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) );
- p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" );
+ p.drawText( 0, height()/2, QString::number( percent ) );
+ p.drawText( width()/4, height(), "%" );
return;
}
QPainter p(this);