Results 1 to 6 of 6

Thread: Dynamically change QComboBox delegate values ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2014
    Posts
    9
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamically change QComboBox delegate values ?

    Well, the thing I don't know is : how do I connect a signal to all my ComboBox delegates ?

    Imagine I have a ComboBoxDelegate class with a update_itemslist slot :

    Qt Code:
    1. class ComboBoxDelegate(QItemDelegate):
    2. def __init__(self, owner, itemslist):
    3. QItemDelegate.__init__(self, owner)
    4. self.itemslist = itemslist
    5.  
    6. @pyqtSlot(list)
    7. def update_itemslist(self, itemslist):
    8. editor.addItems(itemslist)
    To copy to clipboard, switch view to plain text mode 

    I would like to emit a signal from my middleware_ui_arbiter class defined below :

    Qt Code:
    1. class middleware_ui_arbiter(QWidget):
    2.  
    3. # PyQT signals need to be declared outside __init__
    4. signal = pyqtSignal(str)
    5.  
    6. def __init__(self, parent=None):
    7. super(middleware_ui_arbiter, self).__init__(parent)
    8.  
    9. # Widget definition
    10. self.view = QTreeView()
    11.  
    12. # Model definition
    13. self.model = QStandardItemModel(0,ARBITER_NB_COLUMNS)
    14.  
    15. # Set delegates
    16. self.view.setItemDelegateForColumn(1, ComboBoxDelegate(self, ["In", "Out"]))
    17. self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self, []))
    To copy to clipboard, switch view to plain text mode 

    Is there a way to connect a signal to, let's say, all the ComboBoxDelegate of column 2 ?

    I imagine a call like this :

    Qt Code:
    1. self.<something>.connect(self.<something>.update_itemslist)
    To copy to clipboard, switch view to plain text mode 

    The thing is I don't know what <something> is in the code beneath.
    Last edited by enter; 19th March 2014 at 07:16.

Similar Threads

  1. Replies: 1
    Last Post: 22nd April 2013, 23:42
  2. Replies: 1
    Last Post: 22nd February 2012, 12:32
  3. Replies: 7
    Last Post: 3rd November 2010, 23:18
  4. Item delegate displaying enumerated values
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2010, 16:31
  5. QComboBox values?
    By dbrmik in forum Newbie
    Replies: 8
    Last Post: 9th January 2009, 08:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.