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. QtDeviceUtilities.DisplaySettings, QML and screen brightness
Forum Updated to NodeBB v4.3 + New Features

QtDeviceUtilities.DisplaySettings, QML and screen brightness

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 3 Posters 1.1k 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.
  • V Offline
    V Offline
    VFCraig
    wrote on last edited by
    #1

    We have a commercial license. We are developing for Linux iMX8.

    But we cannot compile for Windows under MinGW 64 (not using 32).

    Code compiles and builds for the target system (Linux iMX8) and the function works. The GUI control works. All is well. Screen gets brighter, or dimmer, in response to the control.

    But we are developing on Windows and the 3 lines of code tied to this are not compiling on Windows.

    Any help configuring the build to work for Windows as well would be greatly appreciated.

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If these calls are system specific then use an ifdef to exclude them from other OS builds.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VFCraig
        wrote on last edited by
        #3

        Sorry, forgot to specify, the code for setting brightness, as it is relevant to the GUI, is in QML and therefore there is no #ifdef. Though there is also no reason this should not work with Windows as well.

        It is not clear from the documentation, but I am wondering if it is just QML that is crippled in this way and if it might require signaling the C++ code to set the brightness, once the user has defined a value using the QML GUI component.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          My bad, I somehow missed the QML part.

          Can you explain which compilation error you get ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • V Offline
            V Offline
            VFCraig
            wrote on last edited by
            #5

            DisplaySettings is just not found. Could be faked with an overlay in cases where the operating system (Windows in this case) is too clueless to make it happen. Would be better than just having the build crap out when doing cross-platform development. (Yes, our target is NOT Windows and, yes, it does work on the target. But we are developing on Windows and as there is no way to conditionally compile QML it makes things difficult. Maybe QML 7?)

            1 Reply Last reply
            0
            • GrecKoG Offline
              GrecKoG Offline
              GrecKo
              Qt Champions 2018
              wrote on last edited by GrecKo
              #6

              You could maybe use a QQmlFileSelector to include another file when developing on Windows.

              For example if you have a settings page with a your brightness controls you could do:

              Page {
              //...
                  BrightnessControls {}
              //...
              }
              

              Move your controls with the import QtDeviceUtilities.DisplaySettings in this new file at qrc:/<path>/BrightnessControls.qml

              Create another dummy file to be used for Windows without this import at qrc:/<path>/+windows/BrightnessControls.qml

              And then in your cpp where you have your qml engine, add an extra selector "windows" to the QQmlFileSelector of the engine::

              //QStringList extraSelectors;
              //#ifdef Q_OS_WINDOWS
              //extraSelectors.append("windows"):
              //#endif
              //QQmlFileSelector::::get(&engine)->setExtraSelector(extraSelectors);
              

              EDIT: There is already a selector depending on the OS, the above code is unnecessary.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                VFCraig
                wrote on last edited by
                #7

                Won't work. Not that sort of app. And I should note that, like Windows File Explorer, the QML file selector can result in the application taking several minutes to run on Windows as it goes out looking for the availability of all network connected drives. Yes, minutes, as in centuries to a modern computer.

                But I will be setting up a conditional in the project file and in the associated code to ignore Windows and just work for the target. This is far too much time wasted on something that should be a ten minute task.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Since you hold a commercial license do not hesitate to contact the Qt company about that matter.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1

                  • Login

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