[Qgis-user] force data type in QTableWidget in QGIS plugin
matteo
matteo.ghetta at gmail.com
Thu Mar 3 07:19:31 PST 2016
Hi Matthias,
thanks to your input I solved with a try-except loop.
Just for information:
test_dict = {}
test_dict = dd.fromkeys(dd) # test_dict has the same keys of dd but
values are all empty
for i, k in enumerate(dd.keys()):
try:
map(int, dd.values()[i])
test_dict[k] = QVariant.Int
except:
try:
map(float, dd.values()[i])
test_dict[k] = QVariant.Double
except:
map(str, dd.values()[i])
test_dict[k] = QVariant.String
Thanks again!
Cheers
Matteo
More information about the Qgis-user
mailing list