When I open QGIS, the Layers Panel defaults to a width that doesn't show the "Remove Layer/Group" button. So I have to resize the panel to show the button every time I open QGIS.

Is it possible to set a default width for this panel so I don't have to resize it?

I am using QGIS 2.18.5 on Windows 10.

  • I add another panel (in my case Advanced Digitizing Tool or Value Tool). Some of these panels try to keep their width. But I agree, would be nice if a default width can be set.
    – Kazuhito
    Commented Apr 28, 2017 at 5:30
  • It would be nice for the project to remember, but you don't need that button as the function is available via the layer-right-click popup menu, so there's no need to resize (i.e. it's exactly the same number of button clicks - one on the layer and one to remove). If you still want to use the button, you still don't need to resize as you can click the >> button at the edge of the pane and any hidden buttons appear in a popup (this applies to all QGIS menus). Commented Apr 28, 2017 at 7:02

2 Answers 2


Using a bit of Python, we could create a startup.py script which sets the width of the layers panel by using the following:

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

for x in iface.mainWindow().findChildren(QDockWidget): 
    if x.objectName() == 'Layers':

Save the script in your /.qgis2/python/ directory. Now whenever you load QGIS, the width of the layers panel will be set accordingly.

  • 1
    Thank you Joseph this is a good solution. However I did find that setting a lower minimumWidth after the fixedWidth made the fixedWidth redundant. So for my purposes I only used x.setMinimumWidth(250), 250 was the magic number for me, this still allowed me to make the panel wider if needed.
    – balex
    Commented May 1, 2017 at 0:08
  • @balex - Most welcome, glad it helped! Funny, when I remove setFixedWidth, it doesn't resize accordingly. Perhaps because I'm using 2.18.2 but atleast it works for you :)
    – Joseph
    Commented May 3, 2017 at 9:11

For reference: there is Bug report #15479 Layers panel does not remember size which is related to your issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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