I created a QGIS Plugin (dialog)
with Qt Creator
. The dialog contains several tabs and additonal content and widgets on each tab. On one of these tabs I created a QLineEdit
, a QPushButton
and a QTableWidget
.
I would like to load locally saved geojson's
into a QTableWidget
(optional into a QTreeWidget).
I can load the geojsons via the button and show the file in QLineEdit but i am not able to show the dict(data)
within the QTableWidget
and load other geojson files
into the QTableWidget
.
class Dialog:
"""QGIS Plugin Implementation."""
def __init__(self, iface):
def tr(self, message):
def add_action(
def initGui(self):
def unload(self):
def select_file(self):
filename, _filter = QFileDialog.getOpenFileName(
self.dlg, "Open File", "", '*.geojson')
self.dlg.lineEditInput.setText(filename)
with open(filename,"r") as geojson:
data = json.load(geojson)
def run(self):
if self.first_start == True:
self.dlg = DialogDialog(parent=self.iface.mainWindow())
self.dlg.pushButtonFile.clicked.connect(self.select_file)
self.dlg.open()
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
35.39314,
72.479306
]
},
"properties": {
"Street": "Text",
"City": "Text",
"Country": "Text"
}
}
]
}