I am working on a big GIS project and not being able to sort the items in the Layers panel is giving me hard time. I can have up to 250 layers in the Layers panel.
I have a special naming scheme for all the TIFF raster files I import and geo-reference in QGIS. But when I import them I can't import them one by one in alphabetical order, because my co-workers are working on some of the files and I am working on others. So the items in the Layers panel are all over the place. The program is not intelligent enough to sort them in alphabetical order. Instead it sorts them in the order I import them.
Here, take a look at this screenshot.
Is there no built-in option in QGIS that would allow me to sort these items? If not, is there a plugin I can install that would allow me to do this?
Edit: I found this and the first few lines of code seem to do the trick.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.utils import iface
mw = iface.mainWindow()
lgd = mw.findChild(QTreeWidget, "theMapLegend") # get ref to object by type/objectName
lgd.sortItems(0, Qt.AscendingOrder) # sort first column (Qt.DescendingOrder to reverse)
But I'm not a fluent C++ or a Python programmer. Seriously?... Do I have to pick up a programming cook book to sort the layers in QGIS? Could it be any more difficult?...
Is there no plugin that can do the same job? I'm afraid to use code that I don't understand on an important project.