Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Using an image in an AppListView

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17080

    Lorne

    I am trying to use an image instead of an icon in an AppListView but I’m getting the following error:

    QML AppImage: Cannot open: qrc:///qml/VPlayApps/assets/vplay-logo.png

    Here’s the AppListView.  This is taken from the SimpleRow documentation.  The only thing changes is instead of using setting the icon in the model, I’m setting image instead.

        AppListView {
          id: listView;
          objectName: "listView";
          anchors.fill: parent;
          model: [
            { text: "Widget test",
              detailText: "Some of the widgets available in Felgo AppSDK",
              image: "../assets/vplay-logo.png",
            },
            { text: "Shown are:",
              detailText: "ListPage, NavigationBar with different items, Switch",
              image: "../assets/vplay-logo.png",
            }
          ]      
          delegate: SimpleRow { }
        }

     

    #17086

    Günther
    Felgo Team

    Hi Lorne!

    The relative path of the image source (“../assets/vplay-logo.png”) does not work in this case, as Qt tries to resolve the Image path relative to the AppListView component of Felgo SDK.

    You can use Qt.resolvedUrl(…) to correctly resolve the relative path within your project like this:

    AppListView {
        id: listView;
        objectName: "listView";
        anchors.fill: parent;
        model: [
          { text: "Widget test",
            detailText: "Some of the widgets available in Felgo AppSDK",
            image: Qt.resolvedUrl("../assets/vplay-logo.png")
          },
          { text: "Shown are:",
            detailText: "ListPage, NavigationBar with different items, Switch",
            image: Qt.resolvedUrl("../assets/vplay-logo.png")
          }
        ]
        delegate: SimpleRow { }
      }

    Best,
    Günther

    #17092

    Lorne

    Qt.Resolved() worked like a charm.  Thank you

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded