PDA

View Full Version : how to display batter power meter



qtnewbie
11th October 2007, 21:51
I need to display a battery power meter using QT 4.3. Using the QProgressBar or QPainter to draw a rectangle and fill it according to the current battery level are the two solutions I've thought of.

Are there simpler ways to display a battery power meter image?

marcel
11th October 2007, 22:55
You can subclass QWidget and override paintEvent. In there you can do custom painting like gradients, images and other more complex drawing to make your meter look good.

Tux-Slack
16th October 2007, 21:54
You would set up a max point to a progressbar, I don't know, let's say 100 for 100% and then supply the current battery value with QProgressBar::value().