Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. editorEvent parent question
Forum Updated to NodeBB v4.3 + New Features

editorEvent parent question

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 682 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lukeQt
    wrote on last edited by
    #1

    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
    
    1 Reply Last reply
    0
    • L Offline
      L Offline
      lukeQt
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved