This is the code:

def formOpen(dialog, layer, feature):
   """Function called when a connec is identified in the map"""

   global feature_dialog
   # Create class to manage Feature Form interaction
   feature_dialog = ParentDialog(dialog, layer, feature)

def init_config():

class ParentDialog():
   def __init__(self, dialog, layer, feature):
   """ Constructor class """

       self.dialog = dialog
       self.layer = layer
       self.feature = feature
       self.iface = iface

I want to show message when button X(of QgsAttributeForm) is clicked ,something like:

    def closeEvent(self, event):

        reply = QtGui.QMessageBox.question(self, 'Message',
        "Are you sure to quit?", QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)

        if reply == QtGui.QMessageBox.Yes:

Is there any way to relate dialog (QgsAttributeForm) with closeEvent, or is there any other solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.