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. [Solved] QSettings key issue

[Solved] QSettings key issue

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.0k Views
  • 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.
  • M Offline
    M Offline
    moravas
    wrote on last edited by moravas
    #1

    Hi Folks,

    I would like to use QSettings in my application where I store some resources in .ini file like the following format:
    [request]
    log="/host/log"

    Reading the resource file has been done by the following code:

    @
    Settings("://cfg.ini", QSettings::IniFormat).value("request/log");
    @

    The problem is that is works on Windows properly, but on Linux I'm getting the "QVariant(Invalid)" if I print out by qDebug macro.

    Can anybody help me, what do I wrong?

    Regards,
    Norbert

    R 1 Reply Last reply
    0
    • M moravas

      Hi Folks,

      I would like to use QSettings in my application where I store some resources in .ini file like the following format:
      [request]
      log="/host/log"

      Reading the resource file has been done by the following code:

      @
      Settings("://cfg.ini", QSettings::IniFormat).value("request/log");
      @

      The problem is that is works on Windows properly, but on Linux I'm getting the "QVariant(Invalid)" if I print out by qDebug macro.

      Can anybody help me, what do I wrong?

      Regards,
      Norbert

      R Offline
      R Offline
      raf924
      wrote on last edited by
      #2

      @moravas
      try

      Settings(":/cfg.ini", ...
      
      1 Reply Last reply
      0
      • M Offline
        M Offline
        moravas
        wrote on last edited by
        #3

        Hi,

        it could not solve the problem. The behaviour is the same as before.

        Regards,
        Norbert

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

          Hi,

          Strange, just tested it on OS X and it's working fine. What version of Qt are you using ? On what distribution ?

          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
          • M moravas

            Hi,

            it could not solve the problem. The behaviour is the same as before.

            Regards,
            Norbert

            R Offline
            R Offline
            raf924
            wrote on last edited by
            #5

            @moravas do you check if the file exists or if the key exists ?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              moravas
              wrote on last edited by moravas
              #6

              Hi,

              I'm using Qt 5.5. I thing, the file exist because its compiled to the binary trough the Qt resource management (this .ini file had been added to a .qrc file).
              Additionally, I checked the behavioural, and if I put the absolute file path to the constructor of a QSettings, everything work well (e.g.: QSettings("/absolute/path/cfg.ini", QSettings::IniFormat)... ), but trough .qrc file I cannot access any resources in the .ini file.

              Regads,
              Norbert

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

                What Linux distribution are you using ?

                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
                • M Offline
                  M Offline
                  moravas
                  wrote on last edited by
                  #8

                  Hi SGaist,

                  sorry for the late reply! The problem seems to be solved. I used same resource file names (for the .qrc) and same names for .ini files.
                  Additionaly, I managed my work trough subporojects, and I supposed that there won't be any problem with the same file naming because of the different project names. I was wrong.

                  Thank you for your help.

                  Regards,
                  Norbert

                  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