[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Plasma::Applet eats cpu
From: Christophe Thommeret <hftom () free ! fr>
Date: 2008-11-14 10:52:42
Message-ID: 200811141152.43056.hftom () free ! fr
[Download RAW message or body]
Hi all,
I'm trying to write a little applet that redraws each 100ms.
The problem is that plasma then eats a lot of cpu (~20% of athlonxp@2.2GHz)!
I do it this way:
MyApplet::MyApplet( QObject *parent, const QVariantList &args )
:Plasma::Applet(parent, args)
{
setBackgroundHints(DefaultBackground);
resize(200, 200);
rCol = 0;
startTimer( 100 );
}
void timerEvent( QTimerEvent* ) {
if ( ++rCol > 255 )
rCol = 0;
update();
}
void MyApplet::paintInterface( QPainter *p, const QStyleOptionGraphicsItem*,
const QRect &contentsRect )
{
p->save();
p->setBrush( QColor(rCol,128,128) );
p->drawRect( contentsRect );
p->restore();
}
I guess it's not the right way, so if anybody can give me a hint..
--
Christophe Thommeret
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic