rahulch

Untitled

Oct 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.73 KB | None | 0 0
  1. Rectangle {
  2.                 width: r.width / 2
  3.                 height: 40
  4.                 TextInput {
  5.                     id: textInput
  6.                     text: "Enter " + name
  7.                 }
  8.                 ComboBox {
  9.                     id: comboBox
  10.                     width: r.width / 2
  11.                     height: 40
  12.                     model : ListModel {}
  13.                     delegate: ItemDelegate {
  14.                         width: comboBox.width
  15.                         contentItem: Text {
  16.                             text: modelData
  17.                             color: "green"
  18.                             font.bold: true
  19.                             font.pointSize: height * 0.4
  20.                         }
  21.                     }
  22.                     Component.onCompleted: {
  23.                         console.log("model = ", multiple_values);
  24.                         console.log("typeof model = ", typeof(multiple_values));
  25.                         console.log(JSON.stringify(multiple_values));
  26.                         for (var i in multiple_values) {
  27.                             console.log("VALUE = ", multiple_values[i]);
  28.                             if (multiple_values[i])
  29.                                 model.append({"mul_val": multiple_values[i]});
  30.                         }
  31.                     }
  32.                 }
  33.                 Loader {
  34.                     id: inputLoader
  35.                     sourceComponent: (multiple_values == undefined) ? textInput : comboBox
  36.                     Component.onCompleted: {
  37.                         console.log("loader multiple_values = ", multiple_values);
  38.                         console.log("sourceComponent = ", sourceComponent);
  39.                     }
  40.                 }
  41.             }
Add Comment
Please, Sign In to add comment