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  · 

QPowerSource Class Reference
[QtBaseModule]

The QPowerSource class provides access to information about power sources on the device. More...

    #include <QPowerSource>

Inherits QHardwareInterface.

Inherited by QPowerSourceProvider.

Public Types

  • enum Availability { Available, NotAvailable, Failed }
  • enum Type { Wall, Battery, Virtual }

Public Functions

Signals

Additional Inherited Members


Detailed Description

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.


Member Type Documentation

enum QPowerSource::Availability

Represents whether the power source is available.

ConstantValueDescription
QPowerSource::Available0The power source is available.
QPowerSource::NotAvailable1The power source is not available.
QPowerSource::Failed2The power source has failed.

enum QPowerSource::Type

Describes the type of the power source.

ConstantValueDescription
QPowerSource::Wall0This 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::Battery1This is a battery power source. Battery power sources provide a finite amount of power, but are considered "reliable".
QPowerSource::Virtual2This 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.


Member Function Documentation

QPowerSource::QPowerSource ( const QString & id = QString(), QObject * parent = 0 )

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.

QPowerSource::~QPowerSource ()   [virtual]

Destroys the QPowerSource instance.

Availability QPowerSource::availability () const

Returns the power source availability.

void QPowerSource::availabilityChanged ( QPowerSource::Availability availability )   [signal]

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().

int QPowerSource::capacity () const

Returns the capacity, in milliamp-hours of the power source of -1 if the capacity is unavailable or invalid.

void QPowerSource::capacityChanged ( int capacity )   [signal]

This signal is emitted whenever the power source capacity changes.

See also QPowerSource::capacity() and QPowerSourceProvider::setCapacity().

int QPowerSource::charge () const

Returns the current charge of the source in percentage, or -1 if the charge is unavailable or invalid.

void QPowerSource::chargeChanged ( int charge )   [signal]

This signal is emitted whenever the power source charge changes.

See also QPowerSource::charge() and QPowerSourceProvider::setCharge().

bool QPowerSource::charging () const

Returns true if the power source is charging, false if not.

void QPowerSource::chargingChanged ( bool isCharging )   [signal]

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().

int QPowerSource::timeRemaining () const

Returns the time remaining, in minutes, of the power source, or -1 if the time remaining is unavailable or invalid.

void QPowerSource::timeRemainingChanged ( int minutes )   [signal]

This signal is emitted whenever the time remaining, in minutes, changes .

See also QPowerSource::timeRemaining() and QPowerSourceProvider::setTimeRemaining().

Type QPowerSource::type () const

Returns the power source type.

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 qtextended4.4
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