Is it possible to close the QGIS welcome page with Python?
I have a permanently docked Python plugin, that uses showRubberBand to directly write into map canvas. Therefor I have to close/remove the welcome page first.
Answer
There are a couple of different approaches to that:
Start a new project
iface.newProject()
Add a layer
Whenever a new layer gets added to the mapcanvas, the welcome page will disappear
Change the configuration
In contrast to the other two approaches, this changes the configuration of the QGIS installation permanently.
# 0: Welcome page
# 1: Most recent
# 2: Specific (specify with '/qgis/projOpenAtLaunchPath')
# 3: New
QSettings().setValue('/qgis/projOpenAtLaunch', 3)
No comments:
Post a Comment