Forums

OverviewFelgo 2 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support