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 dynamically add map objects to QML MAP element? Or how to create customised Map widget?

How to dynamically add map objects to QML MAP element? Or how to create customised Map widget?

Scheduled Pinned Locked Moved QML and Qt Quick
25 Posts 6 Posters 19.7k 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.
  • C Offline
    C Offline
    conny
    wrote on 6 Jul 2011, 18:56 last edited by
    #21

    Thanks Till,
    what problems do you have with scaling? If I anchor the map to the QML root item and then scale the window the map size is increased. What's the result you get?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      harbaum
      wrote on 6 Jul 2011, 18:59 last edited by
      #22

      The map just doesn't scale with the window. These are my very first minutes with qml, so i may just be missing something. What do you e.g. mean by anchoring? Would you mind changing the appropriate parts in the wiki page?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        conny
        wrote on 6 Jul 2011, 19:04 last edited by
        #23

        Ah ok, just try this:

        @
        Rectangle {
        id: page
        anchors.fill: parent

        Map {
        anchors.fill: parent
        }
        }
        @

        Ok, now you won't see the rectangle anymore, but you get the point.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          conny
          wrote on 6 Jul 2011, 19:06 last edited by
          #24

          Also you might need the following in main.cpp:
          @
          view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
          @

          That will always scale the root QML item to the size of the QDeclarativeView.

          1 Reply Last reply
          0
          • H Offline
            H Offline
            harbaum
            wrote on 7 Jul 2011, 07:05 last edited by
            #25

            Thanks, Conny. With these two changes, the map scales nicely!

            And feel free to do changes/extensions to the wiki yourself :-)

            1 Reply Last reply
            0

            21/25

            6 Jul 2011, 18:56

            • Login

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