I have data for a PostgreSQL connection. After writing the data in QgsSettings. The connection works but in the Data Source Manager under PostgreSQL connections is nothing documented. After I restart QGIS, the Data Source Manager shows me my connection.
qs = QgsSettings()
qs.beginGroup('/PostgreSQL/connections')
geo_data = "/"+ database_name
qs.setValue(geo_data +"/sslmode","SslDisable")
qs.setValue(geo_data +'/savePassword',"true")
qs.setValue(geo_data +'/saveUsername',"true")
qs.setValue(geo_data + '/username',"user")
qs.setValue(geo_data + '/password',"Password")
qs.setValue(geo_data + '/host',"Data Source")
qs.setValue(geo_data + '/database',"database")
qs.setValue(geo_data + '/port',"5432")
qs.sync()
I thought that the settings getting saved automatically and for safety, I also used the sync() function. Maybe someone has an idea of what is wrong.