def showDocumentForm(self): if self._currentDocumentId is None: return layer = self.relation().referencingLayer() if self.nmRelation().isValid(): layer = self.nmRelation().referencedLayer() showDocumentFormDialog = QgsAttributeDialog( layer, layer.getFeature(self._currentDocumentId), False, self, True) showDocumentFormDialog.exec() self.updateUi()
def actionShowFormTriggered(self): if self.mFeaturesTreeWidget.currentItem() is None: QMessageBox.critical(self, self.tr("No feature selected"), self.tr("Please select a feature.")) return if self.mFeaturesTreeWidget.currentItem().data( 0, TreeWidgetItemRole.Type) != TreeWidgetItemType.Feature: QMessageBox.critical(self, self.tr("Selected item is not a feature"), self.tr("Please select a feature.")) return showDocumentFormDialog = QgsAttributeDialog( self.mFeaturesTreeWidget.currentItem().data( 0, TreeWidgetItemRole.Layer), self.mFeaturesTreeWidget.currentItem().data( 0, TreeWidgetItemRole.Feature), False, self, True) showDocumentFormDialog.exec() self.updateUi()