Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QPowerSource class provides access to information about power sources on the device. More...
#include <QPowerSource>
Inherits QHardwareInterface.
Inherited by QPowerSourceProvider.
The QPowerSource class provides access to information about power sources on the device.
Power sources are components, either external or internal, such as batteries or wall sockets that provide power to a Qt Extended device. The QPowerSource API allows applications to query the status of such components.
To access a list of QPowerSource instances, applications can use the QHardwareManager class. For example, to print out the charge percentage of each power source:
QHardwareManager powerSources("QPowerSource"); QStringList sources = powerSources.providers(); foreach(QString source, sources) { QPowerSource powerSource(source); qWarning() << source << ":" << powerSource.charge() << "%"; }
If an application or system component wants to provide information about a new power source, it should use the QPowerSourceProvider API.
See also QPowerSourceProvider and QPowerStatus.
Represents whether the power source is available.
Constant | Value | Description |
---|---|---|
QPowerSource::Available | 0 | The power source is available. |
QPowerSource::NotAvailable | 1 | The power source is not available. |
QPowerSource::Failed | 2 | The power source has failed. |
Describes the type of the power source.
Constant | Value | Description |
---|---|---|
QPowerSource::Wall | 0 | This is a wall power source. Wall power sources are generally considered to provide infinite power, but are "unreliable" in that they may be disconnected at any time. |
QPowerSource::Battery | 1 | This is a battery power source. Battery power sources provide a finite amount of power, but are considered "reliable". |
QPowerSource::Virtual | 2 | This is a virtual power source. Virtual power sources do not correspond directly to a physical entity, but might, for example, be a virtual battery that consists of a weighted combination of other physical batteries. |
Construct a new power source object for id with the specified parent.
If id is empty, this class will use the default provider that supports the power source interface.
Destroys the QPowerSource instance.
Returns the power source availability.
This signal is emitted whenever the availability of the power source changes. The new value is passed along via availability.
See also QPowerSource::availability() and QPowerSourceProvider::setAvailability().
Returns the capacity, in milliamp-hours of the power source of -1 if the capacity is unavailable or invalid.
This signal is emitted whenever the power source capacity changes.
See also QPowerSource::capacity() and QPowerSourceProvider::setCapacity().
Returns the current charge of the source in percentage, or -1 if the charge is unavailable or invalid.
This signal is emitted whenever the power source charge changes.
See also QPowerSource::charge() and QPowerSourceProvider::setCharge().
Returns true if the power source is charging, false if not.
This signal is emitted whenever the power source changes the charging state. The new state is represented by isCharging.
See also QPowerSource::charging() and QPowerSourceProvider::setCharging().
Returns the time remaining, in minutes, of the power source, or -1 if the time remaining is unavailable or invalid.
This signal is emitted whenever the time remaining, in minutes, changes .
See also QPowerSource::timeRemaining() and QPowerSourceProvider::setTimeRemaining().
Returns the power source type.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |