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 and arrays
Qt 6.11 is out! See what's new in the release blog

Settings and arrays

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.3k 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.
  • O Offline
    O Offline
    oivanov
    wrote on last edited by
    #1

    I have written a plugin for one program. It is dialog-type and has TextField and ComboBox. I need to save/restore with Settings the contents of TextField and ComboBox. For TextField it is easy. For ComboBox (or any string array) it would be also easy with QSettings, but I can't guess how to make this with Settings.
    Can anybody help?

    pluginType: "dialog"
    id:myPluginWindow
    . . . .
    Settings {
    category: "myPlugin"
    property alias textFieldContent: textField1.text
    property alias comboBoxContent: ???
    . . . .
    . . . .

    TextField {
    id: textField1
    text:
    . . . .
    ComboBox {
    id: comboBox
    . . . .

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on last edited by
      #2

      Isn't the currentIndex property what you want?

      O 1 Reply Last reply
      0
      • X xargs1

        Isn't the currentIndex property what you want?

        O Offline
        O Offline
        oivanov
        wrote on last edited by
        #3

        No, I mean the string array, contents of ComboBox - not only currently selected Item.

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xargs1
          wrote on last edited by
          #4

          The model is available as a property. I don't know what Settings would do with a model, though.

          O 1 Reply Last reply
          0
          • X xargs1

            The model is available as a property. I don't know what Settings would do with a model, though.

            O Offline
            O Offline
            oivanov
            wrote on last edited by oivanov
            #5

            @xargs1 It's intersting that when I set
              property alias testObj: comboBox.model
            . . .
            For ComboBox with 4 elements I get in .ini
              comboBoxContent=@Variant(\0\0\0\x7f\0\0\0\xfQQmlListModel*\0)

            And, of course, after plugin restart I have empty ComboBox.
            I still have no idea what to do with this...

            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