Get widget when item in a combobox is clicked (model view)

python

#1

I’m using model-view style coding for the first time. I’ve a combobox in which I’ve applied a model. Added some items in the model. I’ve connected PRESSED signal of view of combox to a function like this.

cmb.view().pressed.connect(self.udimCheck)

self.udimCheck() is like this

def udimCheck(self, index)
    widget = self.sender()

This widget which I’m getting is an AbstractItemView object, But I need to get the combobox widget not the view. I looked the documentation. I didn’t find a way to get the combobox when I’ve the view.


#2

Typically, you simply set the model on the combobox and connect the signals to the combobox itself. I don’t think you need to access it’s view… unless you want to do something rather fancy.

Try this:

cmb.activated.connect(self.uimCheck)