code.js Example File | Qt Script

Qt 5.9 | Qt Script | Default Prototypes Example | code.js Example File

Qt 5.9.2 Reference Documentation

# code.js Example File

script/defaultprototypes/code.js

      listWidget.addItem("Red");
      listWidget.addItem("Blue");
      listWidget.addItem("Green");
      listWidget.addItem("Cyan");
      listWidget.addItem("Yellow");
      listWidget.addItem("Purple");
      listWidget.addItems(["Orange", "Gray"]);

      listWidget.currentItemChanged.connect(
          function(item)
          {
              listWidget.setBackgroundColor(item.text);
          }
      );