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  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QBatteryInfo Class

The QBatteryInfo class provides various information about the battery. More...

 #include <QBatteryInfo>

Inherits: QObject.

Public Types

enum BatteryStatus { BatteryStatusUnknown, BatteryEmpty, BatteryLow, BatteryOk, BatteryFull }
enum ChargerType { UnknownCharger, WallCharger, USBCharger, VariableCurrentCharger }
enum ChargingState { UnknownChargingState, NotCharging, Charging, Discharging, Full }
enum EnergyUnit { UnitUnknown, UnitmAh, UnitmWh }

Properties

  • 1 property inherited from QObject

Public Functions

QBatteryInfo(QObject * parent = 0)
virtual ~QBatteryInfo()
int batteryCount() const
QBatteryInfo::BatteryStatus batteryStatus(int battery) const
QBatteryInfo::ChargerType chargerType() const
QBatteryInfo::ChargingState chargingState(int battery) const
int currentFlow(int battery) const
QBatteryInfo::EnergyUnit energyUnit() const
int maximumCapacity(int battery) const
int remainingCapacity(int battery) const
int remainingChargingTime(int battery) const
int voltage(int battery) const
  • 31 public functions inherited from QObject

Signals

void batteryCountChanged(int count)
void batteryStatusChanged(int battery, QBatteryInfo::BatteryStatus status)
void chargerTypeChanged(QBatteryInfo::ChargerType type)
void chargingStateChanged(int battery, QBatteryInfo::ChargingState state)
void currentFlowChanged(int battery, int flow)
void remainingCapacityChanged(int battery, int capacity)
void remainingChargingTimeChanged(int battery, int seconds)
void voltageChanged(int battery, int voltage)

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QBatteryInfo class provides various information about the battery.

Note that on some platforms, listening to the signals could lead to a heavy CPU usage. Therefore, you are strongly suggested to disconnect the signals when no longer needed in your application.

Member Type Documentation

enum QBatteryInfo::BatteryStatus

This enum describes the status of the battery.

ConstantValueDescription
QBatteryInfo::BatteryStatusUnknown0Battery level undetermined.
QBatteryInfo::BatteryEmpty1Battery is considered be empty and device needs to shut down.
QBatteryInfo::BatteryLow2Battery level is low and warnings need to be issued to the user.
QBatteryInfo::BatteryOk3Battery level is Ok. It is above "Low" but not "Full".
QBatteryInfo::BatteryFull4Battery is fully charged.

enum QBatteryInfo::ChargerType

This enum describes the type of charger used.

ConstantValueDescription
QBatteryInfo::UnknownCharger0The charger type is unknown, or no charger.
QBatteryInfo::WallCharger1Using wall (mains) charger.
QBatteryInfo::USBCharger2Using USB charger when the system cannot differentiate the current.
QBatteryInfo::VariableCurrentCharger3Using variable current charger such as bicycle or solar.

enum QBatteryInfo::ChargingState

This enum describes the charging state:

ConstantValueDescription
QBatteryInfo::UnknownChargingState0The charging state is unknown or charging error occured.
QBatteryInfo::NotCharging1The battery is not charging, i.e. too low charger power.
QBatteryInfo::Charging2The battery is charging.
QBatteryInfo::Discharging3The battery is discharging.
QBatteryInfo::Full4The battery is fully charged.

enum QBatteryInfo::EnergyUnit

This enum describes the energy unit used by the system.

ConstantValueDescription
QBatteryInfo::UnitUnknown0Energy unit unknown.
QBatteryInfo::UnitmAh1Energy described in milliamp-hour (mAh)
QBatteryInfo::UnitmWh2Energy described in milliwatt-hour (mWh)

Property Documentation

batteryCount : const int

This property holds the number of the batteries available.

Returns the number of batteries available, or -1 on error or the information is not available.

Access functions:

int batteryCount() const

Notifier signal:

void batteryCountChanged(int count)

chargerType : const ChargerType

This property holds the type of the charger.

Returns the type of the charger currently used.

Access functions:

QBatteryInfo::ChargerType chargerType() const

Notifier signal:

void chargerTypeChanged(QBatteryInfo::ChargerType type)

energyUnit : const EnergyUnit

This property holds the used energy unit.

Returns the energy unit that the system uses.

Access functions:

QBatteryInfo::EnergyUnit energyUnit() const

Member Function Documentation

QBatteryInfo::QBatteryInfo(QObject * parent = 0)

Constructs a QBatteryInfo object with the given parent.

QBatteryInfo::~QBatteryInfo() [virtual]

Destroys the object

QBatteryInfo::BatteryStatus QBatteryInfo::batteryStatus(int battery) const

Returns the battery status of the given battery.

void QBatteryInfo::batteryStatusChanged(int battery, QBatteryInfo::BatteryStatus status) [signal]

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

QBatteryInfo::ChargingState QBatteryInfo::chargingState(int battery) const

Returns the charging state of the given battery.

void QBatteryInfo::chargingStateChanged(int battery, QBatteryInfo::ChargingState state) [signal]

This signal is emitted when the charging state of the battery has changed to state.

int QBatteryInfo::currentFlow(int battery) const

Returns the current flow of the given battery, measured in milliamperes (mA). A positive returned value means discharging, and a negative value means charging. In case of error, or the information if not available, 0 is returned.

void QBatteryInfo::currentFlowChanged(int battery, int flow) [signal]

This signal is emitted when the current flow of the battery has changed to flow, measured in milliamperes (mA).

int QBatteryInfo::maximumCapacity(int battery) const

Returns the maximum capacity of the given battery, measured in QBatteryInfo::EnergyUnit. If the battery is not found, or the information is not available, -1 is returned.

int QBatteryInfo::remainingCapacity(int battery) const

Returns the remaining level of the given battery, measured in QBatteryInfo::EnergyUnit. If the battery is not found, or the information is not available, -1 is returned.

void QBatteryInfo::remainingCapacityChanged(int battery, int capacity) [signal]

This signal is emitted when the remaining capacity of the battery has changed to capacity, which is measured in QBatteryInfo::EnergyUnit.

int QBatteryInfo::remainingChargingTime(int battery) const

Returns the remaining charging time needed for battery, measured in seconds. If the battery is full or not charging, 0 is returned. If the battery is not found or the information is not available, -1 is returned.

void QBatteryInfo::remainingChargingTimeChanged(int battery, int seconds) [signal]

This signal is emitted when the remaining charging time of the battery has changed to seconds.

int QBatteryInfo::voltage(int battery) const

Returns the voltage of the given battery, measured in millivolts (mV). If the battery is not found, or the information is not available, -1 is returned.

void QBatteryInfo::voltageChanged(int battery, int voltage) [signal]

This signal is emitted when the current voltage of the battery has changed to voltage, measured in millivolts (mV).

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 5.0-snapshot
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