9

Is it possible to pause/stop labeling temporarily in QGIS like in Arcmap for all layers at once?

The label toolbar offers no solution.

1 Answer 1

12

QGIS 3.x

You could use the following code in the Python Console to create a button on the toolbar which toggles the labels for all vector layers:

action = QAction(QIcon(""), "Turn labels" + "\n" + "ON/OFF", iface.mainWindow())
action.setCheckable(True)
iface.addToolBarIcon(action)

def label_control():
    for layer in QgsProject.instance().mapLayers().values():
        if layer.type() == QgsMapLayer.VectorLayer:
            if action.isChecked() == True:
                layer.setLabelsEnabled(True)
            else:
                layer.setLabelsEnabled(False)
        layer.triggerRepaint()

action.triggered.connect(label_control)
# Uncomment line below if you want to remove the icon yourself,
# otherwise it will be removed automatically when you restart QGIS
iface.removeToolBarIcon(action)

Code was based on the question: How to turn on/off all labels of all layers in QGIS.


QGIS 2.18.x

You can use the Deactivate/Active Labels plugin which has a button to switch on/off labels for all layers:

Invert labels

4
  • 1
    Thank you Joseph. That's what i was looking for. Too bad, it's not ported for Qgis 3 yet.
    – RolandG
    Commented Jun 26, 2018 at 12:48
  • 1
    @RolandG - Most welcome, added a possible method for QGIS 3 :)
    – Joseph
    Commented Jun 26, 2018 at 13:11
  • 1
    missing the Deactivate/Active labels plugin! Started a request on their repo to upgrade it.
    – Nikhil VJ
    Commented Aug 15, 2018 at 5:00
  • @nikhilvj - Nice one! :)
    – Joseph
    Commented Aug 15, 2018 at 9:12

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.