editorEvent parent question



  • Hi Everyone,

    I have a question with the editorEvent method. From my understanding this allows the QPushButton in the delegate to do something on the pushbutton event. This allows one to embed pushbuttons in a model and have the button do something. I am using a QtGui.QStyledItemDelegate and a QtCore.QAbstractItemModel. The goal is to make a tree of buttons and then have each button call a different script.

    How do you pass the self in the class though? I want the new window to be a child of the main dialog, but this is in the delegate class not the gui class. Self would be the delegate not the main window gui.

    How do you pass the parent widget in the delegate?

    def editorEvent(self, event, model, option, index):
        if event.type() == QtCore.QEvent.MouseButtonPress:
                if index.data() == "tool 2":
                     self._o_grittool2 = tool2.Tool2(database=self._dbfname,
                            plan_table="plan", cfr_table="cfr", parent=self)
                        self._o_grittool2.exec_()
                        tool_executed = True


  • I need the new dialog to be a child of the parent dialog not the delegate. How do I do that within the delegate though?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.