| 1 | //! [0] |
| 2 | listWidget.addItem("Red"); |
| 3 | listWidget.addItem("Blue"); |
| 4 | listWidget.addItem("Green"); |
| 5 | listWidget.addItem("Cyan"); |
| 6 | listWidget.addItem("Yellow"); |
| 7 | listWidget.addItem("Purple"); |
| 8 | listWidget.addItems(["Orange", "Gray"]); |
| 9 | //! [0] |
| 10 | |
| 11 | //! [1] |
| 12 | listWidget.currentItemChanged.connect( |
| 13 | function(item) |
| 14 | { |
| 15 | listWidget.setBackgroundColor(item.text); |
| 16 | } |
| 17 | ); |
| 18 | //! [1] |