<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-forward-container"><br>
<br>
-------- Weitergeleitete Nachricht --------
<table class="moz-email-headers-table" border="0" cellspacing="0"
cellpadding="0">
<tbody>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Betreff:
</th>
<td>Re: [Eric] PyQt-Slot for QtWidget (QComboBox) created
during runtime</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Datum: </th>
<td>Sun, 23 Sep 2018 16:05:18 +0200</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Von: </th>
<td>GM <a class="moz-txt-link-rfc2396E" href="mailto:mossl@gmx.net"><mossl@gmx.net></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">An: </th>
<td>serge <a class="moz-txt-link-rfc2396E" href="mailto:gauthier.sg@gmail.com"><gauthier.sg@gmail.com></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Serge,
!!! THX !!!
it really works like a charm!
have a nice remaining weekend!
george
Am 23.09.2018 um 15:35 schrieb serge:
> Hi George,
>
> You have to derivate your own comboBox class like this:
>
> class comboBoxProduit(QComboBox):
> '''
> Classe dérivée pour combobox rang produit
> '''
> curIndexChanged = pyqtSignal(int, int)
>
> #
> ------------------------------------------------------------------------------------
> def __init__(self, parent, row):
> super(comboBoxProduit, self).__init__()
> self.parent = parent
> self.row = row # rangée de la table
> self.currentIndexChanged.connect(self.emetEvent)
>
> #
> ------------------------------------------------------------------------------------
> def emetEvent(self, index):
> self.curIndexChanged.emit(index, self.row)
>
> and after when you add the comboBox cb in the table:
>
> cb.curIndexChanged.connect(self.selectRangChange)
>
> and declare the function associated in the dialog file:
> #
> -----------------------------------------------------------------------------------
> def selectRangChange(self, index, row):
> .....
> ....
>
> Regards
> Serge
>
>
>
> Le 23/09/2018 à 14:39, GM a écrit :
>> Hi @all,
>>
>> I've created a dialog-window with an QTableWidget. Users can add a
>> row by using a pushbutton. In a cell of the new row appears a
>> QComboBox. How can changes of this QComboBox trigger a function?
>>
>> It's no problem for to text-only-cells (I can use:
>>
>> @pyqtSlot(int, int)
>> def on_tableWidgetX_cellChanged(self, row, column):
>> print("cell changed: ", row, column)
>>
>> which works as intended.)
>>
>> Functions like
>>
>> @pyqtSlot(QComboBox)
>> def on_tableWidgetX_itemChanged(self, item):
>> print("OK1")
>>
>> @pyqtSlot(QComboBox)
>> def on_tableWidgetX_itemClicked(self, item):
>> print("Ok2")
>>
>> never recieve a signal.
>>
>> I think the QComboBox can not send a aignal. Originally the "Generate
>> Dialog Code..."-dialog suggests to pass a "QTableWidgetItem*" to the
>> pyqtSlot, but this Item is created during runtime, so it can not be
>> found in the Ui_Dialog...
>>
>> Any suggestions?
>>
>>
>> george
>>
>> _______________________________________________
>> Eric mailing list
>> <a class="moz-txt-link-abbreviated" href="mailto:Eric@riverbankcomputing.com">Eric@riverbankcomputing.com</a>
>> <a class="moz-txt-link-freetext" href="https://www.riverbankcomputing.com/mailman/listinfo/eric">https://www.riverbankcomputing.com/mailman/listinfo/eric</a>
>
>
--
Georg Mößlacher
+43-664-735 69 327
</pre>
</div>
</body>
</html>