Unsolved QML mapCircle with data from database
-
Hello All
I have coordinates in the database, and i want to bind this coordinates with the mapcircle in qml. How could i realize this and how to backlight circle if i double-click on coordinate in QTableView?
In screenshot i read coordinates from database to QTableView.
Regards
Jasur -
Hi,
You might be interested by this wiki article about QML and QSqlTableModel.
-
Hello
But i didn't understand yet, how to bind with MapCircle.Regards
Jasur -
You would need to use the Map addMapItem method to add a new MapCircle if not already existing when clicking on the table view.
-
Hello SGaist
Thank you for links. I could do what i wanted. Below how i done it.
import QtQuick 2.9
import QtQuick.Window 2.3
import QtLocation 5.9
import QtPositioning 5.8Map {
id: myMapPlugin { id: mapPlugin name: "osm" } anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(41.2816234,69.206447) zoomLevel: 14 MapItemView { model: sqlModel delegate: MapCircle{ id: circles center { latitude: Lat; longitude: Lon; } radius: 50.0 color: 'yellow' border.width: 3 opacity: 0.5 Component.onCompleted: { console.count("Loaded a MapCircle") myMap.addMapItem(circles); } } }
}
About my second question. How to highlight(backlight) circle , when i select a row from the qtableview and this should work vice versa?
Regards,
Jasur -
I'd check with the ItemSelectionModel type.
-
Hello SGaist
In the below code i could not bind the ItemSelectionModel with the qtableview. What I am doing wrong, i could not highlight row in qtableview when click on circle?
ItemSelectionModel {
id: ism
model: sqlModel} MouseArea { anchors.fill: parent onClicked: { parent.border.color="blue" ism.select(sqlModel.index(index,index), ItemSelectionModel.Select | ItemSelectionModel.Current) console.log(ism.hasSelection) } }
Regards,
Jasur