Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Low Battery
Forum Updated to NodeBB v4.3 + New Features

Low Battery

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    benjiii
    wrote on last edited by
    #1

    Hi All

    In my QT dialog application I need to show low battery information.
    As soon as battery low I need to display low battery Icon in my application
    How do I get this information in my program.

    thanks in advance
    :)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      akrynski
      wrote on last edited by
      #2

      Clear enough?:
      In .h file:
      @Q_PROPERTY(int batteryLevel READ batteryLevel WRITE setBatteryLevel NOTIFY charging)@

      And somewhere in class constructor
      @si = new QSystemDeviceInfo(this);@
      @
      int myClass::getBattery()
      {
      this->setBatteryLevel(si->batteryLevel());
      return m_batteryLevel;
      }
      @
      [Edit: Code formatting; mlong]

      --
      Pozdrawiam i do następnego...
      Greetings and till next...

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        Here is the documentation of the QSystemDeviceInfo class: http://doc.qt.nokia.com/qtmobility-1.0-tp/qsystemdeviceinfo.html

        I would just use that class directly in favor of using the code suggested earlier.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          benjiii
          wrote on last edited by
          #4

          In my application I am getting

          • error: QSystemDeviceInfo: No such file or directory*

          I have included QSystemDeviceInfo in my header file

          @#include <QSystemDeviceInfo>@

          1 Reply Last reply
          0
          • A Offline
            A Offline
            akrynski
            wrote on last edited by
            #5

            I do @#include <QSystemDeviceInfo>@

            twice - in header and in .cpp file.
            Be sure to have correct .pro file:
            @CONFIG += mobility
            MOBILITY += systeminfo @

            Learn the basis!

            --
            Pozdrawiam i do następnego...
            Greetings and till next...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved