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. MapParameter QML
Qt 6.11 is out! See what's new in the release blog

MapParameter QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • AlienA Offline
    AlienA Offline
    Alien
    wrote on last edited by
    #1

    Hi,
    How to create MapParameter dynamically in java script and invoke
    addMapParameter(MapParameter xxx)?

    raven-worxR 1 Reply Last reply
    0
    • AlienA Alien

      Hi,
      How to create MapParameter dynamically in java script and invoke
      addMapParameter(MapParameter xxx)?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Alien
      untested:

      Map {
          id: map
      
          Component.onCompleted: {
              map.addMapParameter( MapParameter {
                     ...
                }
             );
          }
      }
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      AlienA 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @Alien
        untested:

        Map {
            id: map
        
            Component.onCompleted: {
                map.addMapParameter( MapParameter {
                       ...
                  }
               );
            }
        }
        
        AlienA Offline
        AlienA Offline
        Alien
        wrote on last edited by Alien
        #3

        @raven-worx ,
        unfortunately it doesn't work!
        Qt complains :
        Expected token `)'
        but I'm sure that I check the parentheses

          Component.onCompleted:
                {
                    mapID.addMapParameter(
                                        MapParameter
                                        {
                                            type:"layer";
                                            property var layerName: "this is my var";
                                        }
                   );
                }
        
        
        raven-worxR 1 Reply Last reply
        0
        • AlienA Alien

          @raven-worx ,
          unfortunately it doesn't work!
          Qt complains :
          Expected token `)'
          but I'm sure that I check the parentheses

            Component.onCompleted:
                  {
                      mapID.addMapParameter(
                                          MapParameter
                                          {
                                              type:"layer";
                                              property var layerName: "this is my var";
                                          }
                     );
                  }
          
          
          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @Alien
          sry, i always get trapped by the same mistake.
          try the following:

          var param = Qt.createQmlObject('import QtQuick 2.2; \
                  MapParameter { \
                       type:"layer"; \
                       property var layerName: "this is my var"; \
                  }',
                  parentId
          );
          mapID.addMapParameter( param );
          
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          AlienA 1 Reply Last reply
          1
          • raven-worxR raven-worx

            @Alien
            sry, i always get trapped by the same mistake.
            try the following:

            var param = Qt.createQmlObject('import QtQuick 2.2; \
                    MapParameter { \
                         type:"layer"; \
                         property var layerName: "this is my var"; \
                    }',
                    parentId
            );
            mapID.addMapParameter( param );
            
            
            AlienA Offline
            AlienA Offline
            Alien
            wrote on last edited by
            #5

            @raven-worx ,
            Thanks for your solution.
            Merely you forgot to add

            import QtLocation 5.9;
            

            into your code for MapParameter.

            I appreciate your help.

            1 Reply Last reply
            0

            • Login

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