Important: Please read the Qt Code of Conduct -

Settings and arrays

  • 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"
    . . . .
    Settings {
    category: "myPlugin"
    property alias textFieldContent: textField1.text
    property alias comboBoxContent: ???
    . . . .
    . . . .

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

  • Isn't the currentIndex property what you want?

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

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

  • @xargs1 It's intersting that when I set
      property alias testObj: comboBox.model
    . . .
    For ComboBox with 4 elements I get in .ini

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

Log in to reply