I have a code to open the layers of a SQLite database. When executing this code, the layers are loaded correctly (1 & 2). However i also need to connect to the database and show the connection in the browser toolbar.
How doe load the connection and let it show in the database browser (3)?
uri = QgsDataSourceUri()
uri.setDatabase(r'C:\\path_to_db\\andorra.sqlite')
schema = ''
tables = ['points', 'lines', 'multilinestrings', 'multipolygons', 'other_relations']
display_names = ['points', 'lines', 'multilinestrings', 'multipolygons', 'other relations']
geom_column = 'geometry'
for i in range(len(tables)):
uri.setDataSource(schema, tables[i], geom_column)
iface.addVectorLayer(uri.uri(), display_names[i], 'spatialite')