Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [solved]is it a correction
QtWS25 Last Chance

[solved]is it a correction

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 2.4k 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.
  • A Offline
    A Offline
    alfah
    wrote on last edited by
    #1

    everybody,

    in the docs for QSettings,
    @
    void QSettings::beginWriteArray ( const QString & prefix, int size = -1 )
    @
    Adds prefix to the current group and starts writing an array of size size. If size is -1 (the default), it is automatically determined based on the indexes of the entries written.
    If you have many occurrences of a certain set of keys, you can use arrays to make your life easier. For example, let's suppose that you want to save a variable-length list of user names and passwords. You could then write:
    @
    struct Login {
    QString userName;
    QString password;
    };
    QList<Login> logins;
    ...

    QSettings settings;
    settings.beginWriteArray("logins");
    for (int i = 0; i < logins.size(); ++i) {
    settings.setArrayIndex(i);
    settings.setValue("userName", list.at(i).userName);
    settings.setValue("password", list.at(i).password);
    }
    settings.endArray
    @

    in the for loop is it list.at(i).userName?? or logins.at(i).userName

    alfah

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

      It should indeed be logins, not list.

      Please either (in order of preference):

      Fix in the source code in a Gitorious repository and request a merge for your fix, or

      At least report it in "Jira":http://bugreports.qt.nokia.com so your fix will not be lost.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alfah
        wrote on last edited by
        #3

        andre ,

        :) could you tell me how fix source code?? :) ive no cluee . This is the first time i found something like this :)

        alfah

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          :-)

          Go to the Qt sources from on "Gitorious":https://qt.gitorious.org/qt and create your own repository clone. Check out your own clone (you need to have Git for that), and find the sources for the QSettings class. The documentation you are looking for will be in the source file. Fix the mistake, and commit your changes (using Git, again). Then, do a merge request for your changes (button in Gitorious). Those are generally not picked up all that will, so best to then start bugging devs in the #qt-labs IRC channel to make someone there accept your changes :-)

          Good luck!

          Meanwhile, I have added your correction as a doc note for [[Doc:QSettings]].

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

            ahhh

            :) looks like i got somethin else to study :)

            Thanks for adding the correction:) i would have taken longer:)

            alfah

            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