Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to create this object dynamically?
Forum Updated to NodeBB v4.3 + New Features

How to create this object dynamically?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 207 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by
    #1

    Hi. I would like to dynamically create MapQuickItem, but I can't. My code:

    anotherItem = Qt.createQmlObject('import QtLocation 5.15; MapQuickItem {sourceItem: Image { id: xyz; source: "qrc:/abc.png"}}', map)
    

    I get error:

    Image is not a type
    
    jsulmJ 1 Reply Last reply
    0
    • Q qwe3

      Hi. I would like to dynamically create MapQuickItem, but I can't. My code:

      anotherItem = Qt.createQmlObject('import QtLocation 5.15; MapQuickItem {sourceItem: Image { id: xyz; source: "qrc:/abc.png"}}', map)
      

      I get error:

      Image is not a type
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @qwe3 Isn't "import QtQuick 2.0" missing in your QML string?
      https://doc.qt.io/qt-5/qml-qtquick-image.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved