[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QComboBox in QTableWidget: Determining which was changed
From:       Kyle Altendorf <sda () fstab ! net>
Date:       2017-08-25 20:27:26
Message-ID: 1397fb43a8101c340fa68f37c7687be8 () fstab ! net
[Download RAW message or body]

On 2017-08-25 16:11, Eugene Mallay wrote:
> I have a QTableWidget that has a QComboBox in each row (with text in
> the other columns). I've connected a callback to the comboboxes that
> is triggered whenever the combobox is changed. All comboboxes are
> connected to the same method.
> 
> The problem I am having is figuring out how to determine *which*
> specific combobox in the table was triggered. Is there a way to
> determine the cell the user was interacting with which triggered the
> callback?

I work with views and delegates instead of the corresponding 'widget'
widgets.  In my case I use the delegate feature of the views for my
combo boxes.  I think they feed back into the regular path of setting
data via the view.  Does that not apply to QTableWidget?  Do you really
have to have a callback or will it set the value back into the table
item itself?

If not, I do in various places use lambdas, functions, and
functools.partial to attach identifier sorts of information in the path
of signals->slots.

Instead of:
     the_signal.connect(the_slot)

You can:
     p = functools.partial(the_slot, from=the_relevant_object)
     the_signal.connect(p)

And add `from` as a parameter on `the_slot`.

Cheers,
-kyle
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic