Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Cannot include QSystemDeviceInfo
Forum Updated to NodeBB v4.3 + New Features

[Solved] Cannot include QSystemDeviceInfo

Scheduled Pinned Locked Moved QML and Qt Quick
26 Posts 6 Posters 12.9k 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.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #1

    how to include QSystemDeviceInfo in Qt 4.7.3? i am using windows 7 and doing a mobile project

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TobbY
      wrote on last edited by
      #2

      "Your text to link here...":http://doc.qt.nokia.com/qtmobility-1.2/qsystemdeviceinfo.html

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        Add the following to your .pro file:

        @
        CONFIG += mobility
        MOBILITY += systeminfo
        @

        and re-run qmake.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • S Offline
          S Offline
          spode
          wrote on last edited by
          #4

          and what about QtQuick project?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            thisisbhaskar
            wrote on last edited by
            #5

            I gave a comment on DevNet Documentation review that each API documentation should also carry any .pro file changes that are required to include that header file and use it inside the code. That should remove lot of confusions.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thisisbhaskar
              wrote on last edited by
              #6

              [quote author="spode" date="1310117532"]and what about QtQuick project?[/quote]

              For Qt Quick, above mentioned .pro file changes are good enough.

              And you need to have @import QtMobility.systeminfo 1.1@ in your .qml file

              And DeviceInfo is the qml element name.

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #7

                They are listed. See this "quickstart guide":http://doc.qt.nokia.com/qtmobility-1.2/quickstart.html for mobility.

                @spode What do you mean? You can still use C++ in a QtQuick project. If you wan tto display it you just need to bind to the respective properties and possibly expose the info you need as properties if they are not already available.

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  ZapB
                  wrote on last edited by
                  #8

                  @Vijay Ah that's even better then. I have not looked into using mobility directly in QML yet.

                  Nokia Certified Qt Specialist
                  Interested in hearing about Qt related work

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    changsheng230
                    wrote on last edited by
                    #9

                    @
                    import Qt 4.7
                    import QtMobility.systeminfo 1.1

                    Rectangle{
                    ....

                    DeviceInfo {
                        id: deviceinfo;
                        //        onBatteryStatusChanged : doBatteryStatusChange(status);
                        onPowerStateChanged : getPowerState(/*powerState*/);
                        onBatteryLevelChanged: doBatteryLevelChange(level)
                        property int battlevel: batteryLevel;
                    
                        monitorBatteryLevelChanges: true
                        monitorBatteryStatusChanges: true
                        monitorPowerStateChanges: true
                        monitorCurrentProfileChanges: true
                        monitorBluetoothStateChanges: true
                    }
                    ...
                    

                    }
                    @

                    Chang Sheng
                    常升

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      spode
                      wrote on last edited by
                      #10

                      0k, but what about .cpp? why can not i include QSystemDeviceInfo.h?

                      1 Reply Last reply
                      0
                      • Z Offline
                        Z Offline
                        ZapB
                        wrote on last edited by
                        #11

                        Have you tried:

                        @
                        #include <QSystemDeviceInfo>
                        @

                        ie without the ".h" suffix. Can you post the exact command line passed to the compiler and error msg please? That way we can see if it has the correct -I arguments or not.

                        Nokia Certified Qt Specialist
                        Interested in hearing about Qt related work

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          spode
                          wrote on last edited by
                          #12

                          on .cpp:
                          error: QSystemDeviceInfo: No such file or directory
                          althought i am using windows 7 and Qt 4.7.3

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            ZapB
                            wrote on last edited by
                            #13

                            And the command line passed to the compiler please? Which target are you trying to build for?

                            Nokia Certified Qt Specialist
                            Interested in hearing about Qt related work

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              TobbY
                              wrote on last edited by
                              #14

                              "Try this...":http://www.developer.nokia.com/Community/Wiki/Working_with_QSystemDeviceInfo_-System_Information_API-_Part_1

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                spode
                                wrote on last edited by
                                #15

                                all right. perhaps it was because i wrote "mobility" instead of "MOBILITY" in CONFIG and did not write "symbian:TARGET.CAPABILITY = ReadDeviceData" in .pro file.
                                thank everybody!

                                1 Reply Last reply
                                0
                                • Z Offline
                                  Z Offline
                                  ZapB
                                  wrote on last edited by
                                  #16

                                  Yes the MOBILITY variable in the .pro file needs to be in uppercase. The missing symbian capabilities flag would have caused errors later on in the compilation (or maybe at runtime).

                                  Glad to see you hav eit working now. Good luck with the rest of your project.

                                  Nokia Certified Qt Specialist
                                  Interested in hearing about Qt related work

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    spode
                                    wrote on last edited by
                                    #17

                                    thank you! :)

                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      rishygupta
                                      wrote on last edited by
                                      #18

                                      I am making a desktop app and not able to include QSystemDeviceInfo all the above steps i have tried but it dosnt work its giving error no such QSystemDeviceInfo file.i m using qt 4.7

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        spode
                                        wrote on last edited by
                                        #19

                                        Did you try to reinstall qt?

                                        1 Reply Last reply
                                        0
                                        • R Offline
                                          R Offline
                                          rishygupta
                                          wrote on last edited by
                                          #20

                                          ya i have tried in 3 system but it didnt worked i am compiling it by desktop compiler not Symbian or etc...

                                          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