1

I want to modify the initial configuration of QGIS. I read what can be done with the environment variable PyQGIS_STARTUP, but I do not know how to do it.

What I want is to remove some QToolBar, but before I start QGIS.

I know I can remove it using:

main_window.removeDockWidget ([i for i in main_window.findChildren (QDockWidget) if i.windowTitle () == 'Panels'] [0])
2

Instead of playing around with variables, you could consider using a startup.py script which executes your code to hide panels or perform other actions. You could use something like the following:

from qgis.utils import iface
from PyQt4.QtGui import QDockWidget

panels = ['Layers Panel', 'Layer Styling', 'Layer Order Panel']

def hidePanels():
    for i in iface.mainWindow().findChildren(QDockWidget):
        if i.windowTitle() in panels:
            i.hide()

iface.initializationCompleted.connect(hidePanels)

And save this in your /.qgis2/python/ directory. Now when you start QGIS, it will immediately hide your panels.

  • @MarisolPrado - Most welcome, glad it helped :) – Joseph Nov 16 '17 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.