camptocamp / QGIS-SpreadSheetLayers

QGIS plugin to load layers from spreadsheet files (*.ods, *.xls, *.xlsx)
GNU General Public License v3.0
21 stars 7 forks source link

Using QgsSettings() instead of QSettings() to consider global QGIS config #53

Open danceb opened 6 months ago

danceb commented 6 months ago

Hi there, I would reccommend to use QgsSettings() from qgis.core (https://github.com/qgis/QGIS/commit/e1ede700a897c899be8aabf20abe7f953209cb10) instead of QSettings() from PyQt5.QtCore as this consider the use of global configuration via the qgis_global_settings.ini (https://docs.qgis.org/3.34/en/docs/user_manual/introduction/ qgis_configuration.html#deploying-qgis-within-an-organization) in: https://github.com/camptocamp/QGIS-SpreadSheetLayers/blob/master/SpreadsheetLayers/SpreadsheetLayersPlugin.py#L51.

So this would take this into account:

from qgis.core import Qgis, QgsVectorLayer, QgsProject, QgsSettings
[...]
locale = QgsSettings().value("locale/userLocale")[0:2]

instead of

from qgis.core import Qgis, QgsVectorLayer, QgsProject
[...]
locale = QtCore.QSettings().value("locale/userLocale")[0:2]