Hi all,
I'm developing a plugin and I need to check if some features of the input
vector layer are selected or not. If not I'd like to show an error message
without closing the plugin gui:

This is the code at the moment:

            if self.dlg.checkBox.isChecked():
                check_sel = selectedLayer2.selectedFeatureCount()
                if check_sel > 0:
                    intersec_layer =
QgsProcessingFeatureSourceDefinition(selectedLayer2.id(), True)
                else:
                    self.iface.messageBar().pushCritical("Error", "No
features selected in layer {}.".format(selectedLayer2.name()))
                    return

Any idea?

Thanks
Roberta
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to