Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QSystemBatteryInfo Class Reference

The QSystemBatteryInfo class provides access to battery and power information from the system. More...

 #include <QSystemBatteryInfo>

Inherits: QObject.

Note: All functions in this class are reentrant.

This class was introduced in Qt Mobility 1.2.

Public Types

enum BatteryStatus { BatteryUnknown, BatteryEmpty, BatteryCritical, BatteryVeryLow, ..., BatteryFull }
enum ChargerType { UnknownCharger, NoCharger, WallCharger, USBCharger, ..., VariableCurrentCharger }
enum ChargingState { NotCharging, Charging, ChargingError }
enum EnergyUnit { UnitUnknown, UnitmAh, UnitmWh }

Properties

  • 1 property inherited from QObject

Public Functions

QSystemBatteryInfo ( QObject * parent = 0 )
~QSystemBatteryInfo ()
QSystemBatteryInfo::BatteryStatus batteryStatus () const
QSystemBatteryInfo::ChargerType chargerType () const
QSystemBatteryInfo::ChargingState chargingState () const
int currentFlow () const
QSystemBatteryInfo::EnergyUnit energyMeasurementUnit () const
int maxBars () const
int nominalCapacity () const
int remainingCapacity () const
int remainingCapacityBars () const
int remainingCapacityPercent () const
int remainingChargingTime () const
int voltage () const
  • 29 public functions inherited from QObject

Signals

void batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus status )
void chargerTypeChanged ( QSystemBatteryInfo::ChargerType type )
void chargingStateChanged ( QSystemBatteryInfo::ChargingState state )
void currentFlowChanged ( int flow )
void nominalCapacityChanged ( int capacity )
void remainingCapacityBarsChanged ( int bars )
void remainingCapacityChanged ( int capacity )
void remainingCapacityPercentChanged ( int capacity )
void remainingChargingTimeChanged ( int time )

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QSystemBatteryInfo class provides access to battery and power information from the system.

Note: All functions in this class are reentrant.

Warning: On Symbian this class does not support QObject::moveToThread().

Member Type Documentation

enum QSystemBatteryInfo::BatteryStatus

This enum describes the status of the main battery.

ConstantValueDescription
QSystemBatteryInfo::BatteryUnknown-1Battery level undetermined.
QSystemBatteryInfo::BatteryEmpty0Battery level reported as 0, system will shutdown.
QSystemBatteryInfo::BatteryCritical1Battery level is critical 3% or less.
QSystemBatteryInfo::BatteryVeryLow2Battery level is very low, 10% or less.
QSystemBatteryInfo::BatteryLow3Battery level is low 40% or less.
QSystemBatteryInfo::BatteryOk4Battery level is above 40%.
QSystemBatteryInfo::BatteryFull5Battery level is 100%.

enum QSystemBatteryInfo::ChargerType

This enum describes the type of charger used.

ConstantValueDescription
QSystemBatteryInfo::UnknownCharger-1Charger type unknown, or error.
QSystemBatteryInfo::NoCharger0No charger.
QSystemBatteryInfo::WallCharger1Using wall (mains) charger.
QSystemBatteryInfo::USBCharger2Using USB charger when the system cannot differentiate the current.
QSystemBatteryInfo::USB_500mACharger3Using USB charger at 500 mA.
QSystemBatteryInfo::USB_100mACharger4Using USB charger at 100 mA.
QSystemBatteryInfo::VariableCurrentCharger5Using variable current charger such as bicycle or solar.

enum QSystemBatteryInfo::ChargingState

This enum describes the charging state:

ConstantValueDescription
QSystemBatteryInfo::NotCharging0Battery is not charging.
QSystemBatteryInfo::Charging1Battery is charging.
QSystemBatteryInfo::ChargingError-1Error.

enum QSystemBatteryInfo::EnergyUnit

This enum describes the energy unit used by the system.

ConstantValueDescription
QSystemBatteryInfo::UnitUnknown-1Energy unit unknown.
QSystemBatteryInfo::UnitmAh0Energy described in milli Amp hours (mAh)
QSystemBatteryInfo::UnitmWh1Energy described in milli watt hours (mWh)

Property Documentation

batteryStatus : const BatteryStatus

This property holds the battery status.

Returns the status of the battery.

Access functions:

QSystemBatteryInfo::BatteryStatus batteryStatus () const

Notifier signal:

void batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus status )

chargerType : const ChargerType

This property holds the charger type.

Returns the currently used charger type.

Access functions:

QSystemBatteryInfo::ChargerType chargerType () const

Notifier signal:

void chargerTypeChanged ( QSystemBatteryInfo::ChargerType type )

chargingState : const ChargingState

This property holds the charging state.

Returns the charging state.

Access functions:

QSystemBatteryInfo::ChargingState chargingState () const

Notifier signal:

void chargingStateChanged ( QSystemBatteryInfo::ChargingState state )

currentFlow : const int

This property holds the battery current flow.

Returns the amount of current flowing out from the battery, in milliapmeres (mA). A positive flow means discharging, a negative flow means charging, and 0 is returned if on error or information is not available.

Access functions:

int currentFlow () const

Notifier signal:

void currentFlowChanged ( int flow )

energyMeasurementUnit : const EnergyUnit

This property holds the energy unit used by the system.

Returns the energy unit that the system uses.

Access functions:

QSystemBatteryInfo::EnergyUnit energyMeasurementUnit () const

See also QSystemBatteryInfo::EnergyUnit.

maxBars : const int

This property holds the maximum number of bars the system uses.

Returns the maximum number of bars the system uses. If this information is not available or on error, -1 is returned.

Access functions:

int maxBars () const

nominalCapacity : const int

This property holds the nominal battery capacity.

Returns the nominal (maximum) capacity of the battery, measured in QSystemBatteryInfo::EnergyUnit. If no battery is found or on error, -1 is returned.

Access functions:

int nominalCapacity () const

Notifier signal:

void nominalCapacityChanged ( int capacity )

remainingCapacity : const int

This property holds the battery level in QSystemBatteryInfo::EnergyUnit.

Returns the remaining battery level of the battery, measured in QSystemBatteryInfo::EnergyUnit. If no battery is found or on error, -1 is returned.

Access functions:

int remainingCapacity () const

Notifier signal:

void remainingCapacityChanged ( int capacity )

See also QSystemBatteryInfo::energyMeasurementUnit().

remainingCapacityBars : const int

This property holds the remaining capacity in number of bars.

Returns the remaining capacity in number of bars.

Access functions:

int remainingCapacityBars () const

Notifier signal:

void remainingCapacityBarsChanged ( int bars )

remainingCapacityPercent : const int

This property holds the battery level in percent.

Returns the remaining battery level of the battery in percent. If no battery is found or on error, -1 is returned.

Access functions:

int remainingCapacityPercent () const

Notifier signal:

void remainingCapacityPercentChanged ( int capacity )

remainingChargingTime : const int

This property holds the remaining time of charging.

Returns the remaining charging time in seconds. 0 is returned if the battery is full or not charging. If no battery is found or on error, -1 is returned.

Access functions:

int remainingChargingTime () const

Notifier signal:

void remainingChargingTimeChanged ( int time )

voltage : const int

This property holds the battery voltage.

Returns the voltage of the battery, in millivolts (mV). If no battery is found or on error, -1 is returned.

Access functions:

int voltage () const

Member Function Documentation

QSystemBatteryInfo::QSystemBatteryInfo ( QObject * parent = 0 )

Constructs a QSystemBatteryInfo object with the given parent.

QSystemBatteryInfo::~QSystemBatteryInfo ()

Destroys the QSystemBatteryInfo object.

void QSystemBatteryInfo::batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus status ) [signal]

This signal is emitted when battery status has changed to status.

See also QSystemBatteryInfo::ChargingState.

void QSystemBatteryInfo::chargerTypeChanged ( QSystemBatteryInfo::ChargerType type ) [signal]

This signal is emitted when the charger type has changed to type.

void QSystemBatteryInfo::chargingStateChanged ( QSystemBatteryInfo::ChargingState state ) [signal]

This signal is emitted when charging state has changed to state.

void QSystemBatteryInfo::currentFlowChanged ( int flow ) [signal]

This signal is emitted when the current battery current has changed to flow.

On some systems, listening to this signal would lead to a CPU intensive process, so you should disconnect from this signal when finished.

void QSystemBatteryInfo::nominalCapacityChanged ( int capacity ) [signal]

This signal is emitted when nominal (maximum) battery level has changed to capacity.

void QSystemBatteryInfo::remainingCapacityBarsChanged ( int bars ) [signal]

This signal is emitted when the remaining capacity in the number of bars has changed to bars.

void QSystemBatteryInfo::remainingCapacityChanged ( int capacity ) [signal]

This signal is emitted when battery's remaining capacity has changed to capacity, which is reported in QSystemBatteryInfo::EnergyUnit.

See also QSystemBatteryInfo::energyMeasurementUnit.

void QSystemBatteryInfo::remainingCapacityPercentChanged ( int capacity ) [signal]

This signal is emitted when battery capacity in percent has changed to capacity.

void QSystemBatteryInfo::remainingChargingTimeChanged ( int time ) [signal]

This signal is emitted when remianing charge time has changed to time.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Combiner licence, à propos et fermer d'une autre manière

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web