spix icon indicating copy to clipboard operation
spix copied to clipboard

QML Popup and children are invisible to Spix name/id lookup

Open davidljung opened this issue 11 months ago • 1 comments

Spix's item lookup fails to find and QML Item of Popup type or children of it (even when it is visible/open). e.g.

Popup {
  id: mypopup
  Rectangle {
    id: myrect
  }
}

Spix isn't able to find mypopup or myrect.

We uses Popups for various kinds of dialog questions with buttons in our app and Spix isn't able to click on any of the dialog buttons or even find the Popup itself to determine visibility (when the popups are open), so we can't even add helper functions to click the buttons etc.

The Qt docs talk about some kind of dynamic re-parenting and there are properties contentItem, contentChildren and contentData (but no children as it inherits from QtObject not Item, which does have an objectName).

Any ideas where to look troubleshooting or seeing how to add support for that?

davidljung avatar Mar 11 '24 20:03 davidljung

We open our messages with a Loader. With Spix you can than open the popup with this loader.

Popup in Loader:

Loader {
    id: popupLoader
    active: false

    Popup {
      id: myPopup

      width: 200
      height: 200

      visible: popupLoader.active
      onClosed: popupLoader.active = false;

      Rectangle {
        id: myRect
        anchors.fill: parent

        color: "red"
      }
    }
}

Example how to open popup from a test case and change color of the rectangle:

 setStringProperty("mainWindow/popupLoader", "active", "true");
 wait(1500);
 setStringProperty("mainWindow/myRect", "color", "green");
 wait(1500);
 setStringProperty("mainWindow/popupLoader", "active", "false");

auxxos avatar Mar 12 '24 06:03 auxxos