Last active
August 24, 2018 22:42
-
-
Save Karry/af0e7f4d6a9da42f472da8adfd070db5 to your computer and use it in GitHub Desktop.
Example howto use LocationInfoModel from libosmscout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.2 | |
import QtQuick.Controls 1.1 | |
import QtQuick.Layouts 1.1 | |
import QtQuick.Controls.Styles 1.1 | |
import QtQuick.Window 2.0 | |
import QtQml.Models 2.2 | |
import net.sf.libosmscout.map 1.0 | |
DelegateModel { | |
id: delegateModel | |
} | |
LocationInfoModel { | |
id: locationInfoModel | |
Component.onCompleted: { | |
locationInfoModel.setLocation(50.08923, 14.49837); | |
} | |
onReadyChanged: { | |
if (!ready){ | |
console.log("Loading objects around..."); | |
return; | |
} | |
console.log("objects around: " + locationInfoModel.rowCount()); | |
delegateModel.model = locationInfoModel; | |
for (var row = 0; row < locationInfoModel.rowCount(); row++) { | |
var item = delegateModel.items.get(row).model; | |
console.log(" " + row + ":"); | |
console.log(" label: " + item.label); | |
console.log(" region: " + item.region); | |
console.log(" address: " + item.address); | |
console.log(" inPlace: " + item.inPlace); | |
console.log(" distance: " + item.distance); | |
console.log(" bearing: " + item.bearing); | |
console.log(" poi: " + item.poi); | |
console.log(" type: " + item.type); | |
console.log(" postalCode: " + item.postalCode); | |
console.log(" website: " + item.website); | |
console.log(" phone: " + item.phone); | |
console.log(" addressLocation: " + item.addressLocation); | |
console.log(" addressNumber: " + item.addressNumber); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
possible output: