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. Settings class causes an application to fail to start after it is published
Qt 6.11 is out! See what's new in the release blog

Settings class causes an application to fail to start after it is published

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 3 Posters 745 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.
  • HyEISNH Offline
    HyEISNH Offline
    HyEISN
    wrote on last edited by
    #1

    Hi, all:

    In order to prove this problem, i spent a lot of time, the situation is this:
    If I use the following in any.qml file of my project:

    import QtCore
    

    or

    import Qt.labs.settings
    

    statement, after publishing my application using windeployqt.exe or windeployqt6.exe, I can't start the application, there will be no display content and console information after starting, but if I use QtCreator to start the program, it still works.

    If I run my application using QtCreator, the Settings class works fine, and it correctly saves what I need to save.

    Windeployqt6.exe does not add QtCore or Qt.labs.settings to the distribution folder after it is published, but I did manually and it still doesn't work.

    If I don't import the QtCore or Qt.labs.settings package into my project's qml file, it will work fine again, running the released application or using QtCreator.

    What both packages have in common is that they contain a class called Settings. I checked the Qt documentation, and I needed it to save my user settings.

    Now, because of this problem, I have to rely on the QSettings class to complete this function.

    However, if I can use the Settings class in Qml, then I think it is very convenient, because I do not need to do extra work to complete this functionality.

    Qt information I use:
    Qt 6.5.0
    QtCreator 10.0.0
    Compiler: MSVC2019 64bit

    Operating system
    Operating System Name: Microsoft Windows 11 Pro
    Operating system kernel type: Multiprocessor Free (64-bit)
    Operating system version: 10.0.22631.1972
    Operating System Version Upgrade (SP): -
    Operating system root directory: C:\WINDOWS

    Component Version
    Common Controls: 6.16
    .NET Framework: 4.8.9166.0 built by: NET481REL1LAST_B
    DirectX: DirectX 12.0
    OpenGL: 10.0.22621.1465 (WinBuild.160101.0800)

    Thank you for reading my question, if you need more information, I can continue to provide!

    sierdzioS 1 Reply Last reply
    0
    • HyEISNH HyEISN

      Hi, all:

      In order to prove this problem, i spent a lot of time, the situation is this:
      If I use the following in any.qml file of my project:

      import QtCore
      

      or

      import Qt.labs.settings
      

      statement, after publishing my application using windeployqt.exe or windeployqt6.exe, I can't start the application, there will be no display content and console information after starting, but if I use QtCreator to start the program, it still works.

      If I run my application using QtCreator, the Settings class works fine, and it correctly saves what I need to save.

      Windeployqt6.exe does not add QtCore or Qt.labs.settings to the distribution folder after it is published, but I did manually and it still doesn't work.

      If I don't import the QtCore or Qt.labs.settings package into my project's qml file, it will work fine again, running the released application or using QtCreator.

      What both packages have in common is that they contain a class called Settings. I checked the Qt documentation, and I needed it to save my user settings.

      Now, because of this problem, I have to rely on the QSettings class to complete this function.

      However, if I can use the Settings class in Qml, then I think it is very convenient, because I do not need to do extra work to complete this functionality.

      Qt information I use:
      Qt 6.5.0
      QtCreator 10.0.0
      Compiler: MSVC2019 64bit

      Operating system
      Operating System Name: Microsoft Windows 11 Pro
      Operating system kernel type: Multiprocessor Free (64-bit)
      Operating system version: 10.0.22631.1972
      Operating System Version Upgrade (SP): -
      Operating system root directory: C:\WINDOWS

      Component Version
      Common Controls: 6.16
      .NET Framework: 4.8.9166.0 built by: NET481REL1LAST_B
      DirectX: DirectX 12.0
      OpenGL: 10.0.22621.1465 (WinBuild.160101.0800)

      Thank you for reading my question, if you need more information, I can continue to provide!

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @HyEISN Can you post command line you use to run windeployqt?

      (Z(:^

      HyEISNH 1 Reply Last reply
      0
      • sierdzioS sierdzio

        @HyEISN Can you post command line you use to run windeployqt?

        HyEISNH Offline
        HyEISNH Offline
        HyEISN
        wrote on last edited by
        #3

        @sierdzio Well, here, I use it like this, without any other options:

        C:\Qt\6.5.0\msvc2019_64\bin\windeployqt6.exe appTTZDLuncher.exe
        

        5a7d8c07-27eb-4338-bd75-d8280522087b-image.png

        J.HilkJ 1 Reply Last reply
        0
        • HyEISNH HyEISN

          @sierdzio Well, here, I use it like this, without any other options:

          C:\Qt\6.5.0\msvc2019_64\bin\windeployqt6.exe appTTZDLuncher.exe
          

          5a7d8c07-27eb-4338-bd75-d8280522087b-image.png

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @HyEISN said in Settings class causes an application to fail to start after it is published:

          without any other options:

          and thats the problem, you're clearly using QML so you need to provide the path to your qml files via --qmldir <directory>


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          HyEISNH 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            @HyEISN said in Settings class causes an application to fail to start after it is published:

            without any other options:

            and thats the problem, you're clearly using QML so you need to provide the path to your qml files via --qmldir <directory>

            HyEISNH Offline
            HyEISNH Offline
            HyEISN
            wrote on last edited by
            #5

            @J-Hilk Thank you, it works! Before that, i tried to manually copy the library files that the qml package depends on, like this:
            903c4e8e-609e-4781-b29b-d24f34b5d169-image.png
            This didn't work, and I found that--qmldir and the file I copied manually seemed to be the same. So can I ask you a question? What does the--qmldir option do when used? It's not just a simple file copy, is it?

            J.HilkJ 1 Reply Last reply
            0
            • HyEISNH HyEISN

              @J-Hilk Thank you, it works! Before that, i tried to manually copy the library files that the qml package depends on, like this:
              903c4e8e-609e-4781-b29b-d24f34b5d169-image.png
              This didn't work, and I found that--qmldir and the file I copied manually seemed to be the same. So can I ask you a question? What does the--qmldir option do when used? It's not just a simple file copy, is it?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @HyEISN it is in essence a simple copy, but its more thorough and catches stuff that don't generate a missing dll warning.

              In fact it is usually too thorough and you can potentially reduce the folder size by removing unneeded parts, but thats there very very last step in a release process :D


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              HyEISNH 1 Reply Last reply
              1
              • J.HilkJ J.Hilk

                @HyEISN it is in essence a simple copy, but its more thorough and catches stuff that don't generate a missing dll warning.

                In fact it is usually too thorough and you can potentially reduce the folder size by removing unneeded parts, but thats there very very last step in a release process :D

                HyEISNH Offline
                HyEISNH Offline
                HyEISN
                wrote on last edited by
                #7

                @J-Hilk Thank you for your answer, I learned some more!

                1 Reply Last reply
                0
                • HyEISNH HyEISN has marked this topic as solved on

                • Login

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