2017-12-14 7 views
0

Qt를 처음 사용하고 QML을 사용하여 새 GUI를 시작합니다. 지도가있어서 표식을 표시하고 싶습니다. 하지만 MapQuickItem을 사용하여 마커를 표시 할 수 없습니다.
아래 코드에서 제목,지도 및 MapCircle은 올바르게 표시되지만 MapQuickItem은 표시되지 않습니다.
이미지 "marker.png"가 존재하며 표시 할 수 있습니다. 도움 주셔서 감사합니다. 좋아
MapQuickItem이 표시되지 않습니다.

 
import QtQuick 2.0 
import QtLocation 5.6 
import QtPositioning 5.6 
import "../items" 
SimpleTile { 
    m_width : 300 
    m_height : 300 
    property double m_latitude; 
    property double m_longitude; 

    innerObject: Column { 
     id: colMap 
     anchors.fill: parent 

     Plugin { 
      id: mapPlugin 
      name: "esri" 
     } 

     Text { 
      id: title 
      width: colMap.width 
      height: 25 
      horizontalAlignment: TextInput.AlignHCenter 
      font.bold: true 
      font.pointSize: 15 
      text: "Position" 
     } 
     Map { 
      id: map 
      width: colMap.width 
      height: parent.height - title.height 
      plugin: mapPlugin 
      center: QtPositioning.coordinate(m_latitude, m_longitude) 
      zoomLevel: 14 

      MapQuickItem { 
       id: marker 
       anchorPoint.x: image.width/2 
       anchorPoint.y: image.height 

       coordinate { 
        latitude: m_latitude 
        longitude: m_longitude 
       } 
       sourceItem: Image { id: image; source: "qrc:/images/marker.png" } 
      } 
      MapCircle { 
       radius: 1000 
       color: "red" 
       opacity: 0.4 
       center { 
        latitude: m_latitude 
        longitude: m_longitude 
       } 
      } 
     } 
    } 
} 
+1

코드를 테스트하려면 'SimpleTile'등으로 무엇을해야합니까? 우리가 코드를 실행하고 테스트 할 수 있도록 mvce를 제공하고 이미지 자리 표시 자 (예 : [this] (https://placeimg.com))를 사용하십시오. – folibis

+0

죄송합니다. 기본적으로 SimpleTile은 '직사각형'입니다 (유니폼 l 및 f 사용). 이 모든 Rectangle은 'Flow'에 추가됩니다 – Fabrice

+0

나는 오류를 발견했다고 생각하지만 지금은 테스트 할 수 없습니다. 나는 변경했다 :

 MapQuickItem { id: marker anchorPoint.x: image.width/2 anchorPoint.y: image.height coordinate : QtPositioning.coordinate(m_latitude, m_longitude) sourceItem: Image { id: image; source: "qrc:/images/marker.png" } }
Fabrice

답변

0

, 나는 귀하의 답변

 
... 
MapQuickItem { 
... 
       coordinate: QtPositioning.coordinate(m_latitude, m_longitude) 
... 

덕분에

 
... 
MapQuickItem { 
... 
       coordinate { 
        latitude: m_latitude 
        longitude: m_longitude 
       } 
... 

을 변경하여 내 문제를 해결한다.