System Information Example |
QSystemDeviceInfo | Access to device information from the system |
---|---|
QSystemDisplayInfo | Access to display information from the system |
QSystemInfo | Access to various general information from the system |
QSystemNetworkInfo | Access to network information from the system |
QSystemScreenSaver | Access to screen saver and blanking |
QSystemStorageInfo | Access to memory and disk information from the system |
Here are some examples that show how the example application reads the device information.
The current language
systemInfo = new QSystemInfo(this); curLanguageLineEdit->setText( systemInfo->currentLanguage());
Device information, starting with the battery level
di = new QSystemDeviceInfo(this); ... batteryLevelBar->setValue(di->batteryLevel());
The manufacturer id and the product name
manufacturerLabel->setText(di->manufacturer()); ... productLabel->setText(di->productName());
And there are signals that can be used to update progress bars and other indicators. An example is when the battery level changes, the batteryLevelChanged() signal is emitted
connect(di,SIGNAL(batteryLevelChanged(int)), this,SLOT(updateBatteryStatus(int)));
Other information is stored as bitwise flags. The following code shows the input methods being determined using flags.
QSystemDeviceInfo::InputMethodFlags methods = di->inputMethodType(); QStringList inputs; if((methods & QSystemDeviceInfo::Keys)){ inputs << "Keys"; } if((methods & QSystemDeviceInfo::Keypad)) { inputs << "Keypad"; }
Various capabilities of the device can be found by testing for features. In the example a Feature combo box, on the General tab, has a hard coded list of features. When a listed feature is selected the getFeature() function is called with the index which is handled by applying a test to the corresponding feature.
QSystemInfo::Feature feature; switch(index) { ... case 1: feature = QSystemInfo::BluetoothFeature; ... QSystemInfo si; featuresLineEdit->setText((si.hasFeatureSupported(feature) ? "true":"false" ));
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 qtmobility-1.0 | |
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 ! |
Copyright © 2000-2012 - www.developpez.com