QBatteryInfo ClassThe QBatteryInfo class provides various information about the battery. More... #include <QBatteryInfo> Inherits: QObject. Public Types
Properties
Public Functions
Signals
Additional Inherited Members
Detailed DescriptionThe 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
|
Constant | Value | Description |
---|---|---|
QBatteryInfo::BatteryStatusUnknown | 0 | Battery level undetermined. |
QBatteryInfo::BatteryEmpty | 1 | Battery is considered be empty and device needs to shut down. |
QBatteryInfo::BatteryLow | 2 | Battery level is low and warnings need to be issued to the user. |
QBatteryInfo::BatteryOk | 3 | Battery level is Ok. It is above "Low" but not "Full". |
QBatteryInfo::BatteryFull | 4 | Battery is fully charged. |
This enum describes the type of charger used.
Constant | Value | Description |
---|---|---|
QBatteryInfo::UnknownCharger | 0 | The charger type is unknown, or no charger. |
QBatteryInfo::WallCharger | 1 | Using wall (mains) charger. |
QBatteryInfo::USBCharger | 2 | Using USB charger when the system cannot differentiate the current. |
QBatteryInfo::VariableCurrentCharger | 3 | Using variable current charger such as bicycle or solar. |
This enum describes the charging state:
Constant | Value | Description |
---|---|---|
QBatteryInfo::UnknownChargingState | 0 | The charging state is unknown or charging error occured. |
QBatteryInfo::NotCharging | 1 | The battery is not charging, i.e. too low charger power. |
QBatteryInfo::Charging | 2 | The battery is charging. |
QBatteryInfo::Discharging | 3 | The battery is discharging. |
QBatteryInfo::Full | 4 | The battery is fully charged. |
This enum describes the energy unit used by the system.
Constant | Value | Description |
---|---|---|
QBatteryInfo::UnitUnknown | 0 | Energy unit unknown. |
QBatteryInfo::UnitmAh | 1 | Energy described in milliamp-hour (mAh) |
QBatteryInfo::UnitmWh | 2 | Energy described in milliwatt-hour (mWh) |
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) |
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) |
This property holds the used energy unit.
Returns the energy unit that the system uses.
Access functions:
QBatteryInfo::EnergyUnit | energyUnit() const |
Constructs a QBatteryInfo object with the given parent.
Destroys the object
Returns the battery status of the given battery.
This signal is emitted when the battery status of the battery has changed to status.
Returns the charging state of the given battery.
This signal is emitted when the charging state of the battery has changed to state.
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.
This signal is emitted when the current flow of the battery has changed to flow, measured in milliamperes (mA).
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.
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.
This signal is emitted when the remaining capacity of the battery has changed to capacity, which is measured in QBatteryInfo::EnergyUnit.
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.
This signal is emitted when the remaining charging time of the battery has changed to seconds.
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.
This signal is emitted when the current voltage of the battery has changed to voltage, measured in millivolts (mV).