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  · 

QPowerStatus Class Reference
[QtBaseModule]

The QPowerStatus class provides a simplified interface to the device's primary power sources. More...

    #include <QPowerStatus>

Inherits QObject.

Public Types

  • enum BatteryStatus { Normal, Low, VeryLow, Critical, NoBattery }
  • enum WallStatus { Available, NotAvailable, NoWallSource }

Public Functions

  • 29 public functions inherited from QObject

Signals

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public type 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 QPowerStatus class provides a simplified interface to the device's primary power sources.

Applications may use the QPowerStatus class to obtain a simplified view of the system's power status. A more complete view can be obtained by examining the supported QPowerSource providers.

Each device may contain two primary power sources - a primary wall power source and a primary battery power source. Both sources are optional, and a specific device may have one, both or neither.

The primary power source sources are selected from the list of available QPowerSource providers. The selection may be configured in the Trolltech/HardwareAccessories configuration file in the following way:

KeyDescription
PowerSources/PrimaryWallSourceName of the QPowerSource to use as the primary wall source.
PowerSources/PrimaryBatterySourceName of the QPowerSource to use as the primary battery source.

If the primary wall source is not configured, the PrimaryAC QPowerSource name is tried first, and, if not available, the first AC source is used. If the primary wall source is configured, but the specified provider does not exist, then no QPowerSource is used.

If the primary battery source is not configured, the DefaultBattery QPowerSource is tried first, and, if not available, the first battery source is used. If the primary battery source is configured, but the specified provider does not exist, then no QPowerSource is used.

The battery status level is determined by mapping a battery percentage to one the four defined levels. The configuration for the various battery status levels are also defined in the Trolltech/HardwareAccessories configuration file in the following way:

KeyDescription
PrimaryBattery/NormalStatusIf the battery charge is above this percentage level, it is considered Normal. The default is 30.
PrimaryBattery/LowStatusIf the battery charge is above this percentage level, but below the normal status level, it is considered Low. The default is 15.
PrimaryBattery/VeryLowStatusIf the battery charge is above this percentage level, but below the low status level, it is considered very Low. The default is 5.

If any one of these values is specified illegally (for example, the NormalStatus is lower than the LowStatus), the default values are used.

See also QPowerSource.


Member Type Documentation

enum QPowerStatus::BatteryStatus

Describes the status of the device's battery connection.

ConstantValueDescription
QPowerStatus::Normal0The battery level is within normal operational range.
QPowerStatus::Low1The battery is low.
QPowerStatus::VeryLow2The battery is very low.
QPowerStatus::Critical3The battery is at a critical level. The device should shut down to preserve data.
QPowerStatus::NoBattery4There is no battery in the device.

enum QPowerStatus::WallStatus

Describes the status of the device's wall connection.

ConstantValueDescription
QPowerStatus::Available0The device is connected to a wall power supply.
QPowerStatus::NotAvailable1The device is not connected to a wall power supply, but connection is supported.
QPowerStatus::NoWallSource2The device is not connected to a wall power supply, and no such connection is supported.


Member Function Documentation

QPowerStatus::QPowerStatus ( QObject * parent = 0 )

Construct a new QPowerStatus instance with the specified parent.

QPowerStatus::~QPowerStatus ()   [virtual]

Destroy the QPowerStatus instance.

bool QPowerStatus::batteryCharging () const

Returns true if the primary battery is charging, false if not. If there is no primary battery, false is returned.

void QPowerStatus::batteryChargingChanged ( bool charging )   [signal]

This signal is emitted when the batteries charging flag changes.

See also QPowerStatus::batteryCharging().

QPowerSource * QPowerStatus::batterySource () const

Returns a pointer to the QPowerSource instance representing the primary battery power source, or null if there is no primary battery power source.

BatteryStatus QPowerStatus::batteryStatus () const

Returns the status of the primary battery power source, or NoBattery if there is no primary battery source.

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

This signal is emitted whenever the battery status changes.

See also QPowerStatus::batteryStatus().

QPowerSource * QPowerStatus::wallSource () const

Returns a pointer to the QPowerSource instance representing the primary wall power source, or null if there is no primary wall power source.

WallStatus QPowerStatus::wallStatus () const

Return the status of the primary wall power source, or NoWallSource if there is no primary wall power source.

void QPowerStatus::wallStatusChanged ( QPowerStatus::WallStatus status )   [signal]

This signal is emitted whenever the wall status changes.

See also QPowerStatus::wallStatus().

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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 48
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

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