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 :
def __init__(self, owner, itemslist):
self.itemslist = itemslist
@pyqtSlot(list)
def update_itemslist(self, itemslist):
editor.addItems(itemslist)
class ComboBoxDelegate(QItemDelegate):
def __init__(self, owner, itemslist):
QItemDelegate.__init__(self, owner)
self.itemslist = itemslist
@pyqtSlot(list)
def update_itemslist(self, itemslist):
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 :
class middleware_ui_arbiter
(QWidget):
# PyQT signals need to be declared outside __init__
signal = pyqtSignal(str)
def __init__(self, parent=None):
super(middleware_ui_arbiter, self).__init__(parent)
# Widget definition
# Model definition
# Set delegates
self.view.setItemDelegateForColumn(1, ComboBoxDelegate(self, ["In", "Out"]))
self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self, []))
class middleware_ui_arbiter(QWidget):
# PyQT signals need to be declared outside __init__
signal = pyqtSignal(str)
def __init__(self, parent=None):
super(middleware_ui_arbiter, self).__init__(parent)
# Widget definition
self.view = QTreeView()
# Model definition
self.model = QStandardItemModel(0,ARBITER_NB_COLUMNS)
# Set delegates
self.view.setItemDelegateForColumn(1, ComboBoxDelegate(self, ["In", "Out"]))
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 :
self.<something>.connect(self.<something>.update_itemslist)
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.
Bookmarks