Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PySide: Issue using ItemDelegate
Forum Update on Monday, May 27th 2025

PySide: Issue using ItemDelegate

Scheduled Pinned Locked Moved Language Bindings
4 Posts 2 Posters 5.1k Views
  • 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.
  • N Offline
    N Offline
    Nightwish
    wrote on 20 Oct 2010, 15:23 last edited by
    #1

    I'm doing a simple app while learning Qt, and I've hit a brick wall with QItemDelegate. I'm using a button on a column to do something with it at a later point, but when setEditorData is called, the editor parameter is a QWidget, not the QPushButton I've created. Every single example I've seen has the call being made with the proper widget, so I'm stumped.
    I'd like to change the text on the button, but if i cache the button somewhere i get
    @RuntimeError: Internal C++ object already deleted.@

    The delegate is
    @class PlayButtonDelegate(QtGui.QItemDelegate):

    def init(self, parent=None, *args):
    QtGui.QItemDelegate.init(self, parent)

    def createEditor(self, parent, styleOption, index):
    button=QtGui.QPushButton(QtGui.QPixmap('Play-Normal-icon.png'), index.data(), parent)
    return button

    def updateEditorGeometry(self,editor, styleOption, index):
    editor.setGeometry(styleOption.rect);

    def setEditorData(self, editor, index):
    print 'setEditorData...', index.data(), editor.class
    editor.setText(index.data())@
    The delegate setup is made with
    @
    self.table.setItemDelegateForColumn (2, PlayButtonDelegate(self))
    for row in range(0, self.tableModel.rowCount()):
    self.table.openPersistentEditor(self.tableModel.createIndex(row,2))@

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nightwish
      wrote on 20 Oct 2010, 15:44 last edited by
      #2

      Ah... a wasted afternoon...

      Updating to 4.2 should fix it.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        renato.filho
        wrote on 20 Oct 2010, 16:44 last edited by
        #3

        I created a small example here and apparently this work fine with 0.4.2.

        Could you test and if the bug persist on 0.4.2 use our "bugzilla":http://bugs.openbossa.org/ to report this, with a full example attached.

        Thanks

        1 Reply Last reply
        0
        • N Offline
          N Offline
          Nightwish
          wrote on 20 Oct 2010, 17:03 last edited by
          #4

          Yeah, it's a fixed bug, I did not have the latest PySide. In my defense, it was only released two days after I started.

          1 Reply Last reply
          0

          1/4

          20 Oct 2010, 15:23

          • Login

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