Nominate our 2022 Qt Champions!

How to test qml listview with qml TestCase.

  • Hi,
    2 questions about testing lisview :

    • When using QAbstractModel, how is the role accessible ? I meann, if I have a listview instance, how can I access for example the display value of the currentItem ? Which is obejct is the parent of display ?

    • I have this kind of conditional delegate : how can I access the current delegate to test if the good type Is created. I tried myListView.currentItem.item but It returns undefined.

    delegate: Component {
        Loader {
          sourceComponent: switch (display.classtype) {
            case "ImageSection": {
              return imageDelegate
            case "TextSection" : {
              return textDelegate


Log in to reply