after calling the function listWidget.removeItem() followed by 'connected' (listWidget.currentRowChangedSignal.connect) function is called with bad param currentRow.
also is question when the 'connected' function should be called - only at change as described.
I can see that after the last row is removed listWidgetRowChanged is called with -1 to indicate that no row is selected. This is the standard Qt behaviour. Maybe I should describe this in the manual.
Maybe you should add following lines to your script (to automatically stop the script if the user has closed the Dialog):
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-10-30
this is very simple script, i forgot dialogfinished->stopscript.
but, when I click on the fourth row (the value in row 3) and press the "delete current row" button, why is the process listWidgetRowChanged ("currentRow changed signal to 4, the current selected row is 3")? current row select line did not change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think what happens is:
- the selection is set to the row after the row to delete by QListWidget internally
- the signal currentRowChangedSignal is generated by QListWidget internally (but your function is not executed because the GUI element is executed in the main thread and not in your script thread)
- the row is deleted by QListWidget internally (and therefore the selected row changes)
- your script thread is executed and listWidgetRowChanged is called
You could to this to prevent this signal after you deleted a row:
after calling the function listWidget.removeItem() followed by 'connected' (listWidget.currentRowChangedSignal.connect) function is called with bad param currentRow.
also is question when the 'connected' function should be called - only at change as described.
Hi,
I can see that after the last row is removed listWidgetRowChanged is called with -1 to indicate that no row is selected. This is the standard Qt behaviour. Maybe I should describe this in the manual.
Maybe you should add following lines to your script (to automatically stop the script if the user has closed the Dialog):
Regards,
Stefan
Last edit: Stefan Zieker 2018-10-30
this is very simple script, i forgot dialogfinished->stopscript.
but, when I click on the fourth row (the value in row 3) and press the "delete current row" button, why is the process listWidgetRowChanged ("currentRow changed signal to 4, the current selected row is 3")? current row select line did not change.
I think what happens is:
- the selection is set to the row after the row to delete by QListWidget internally
- the signal currentRowChangedSignal is generated by QListWidget internally (but your function is not executed because the GUI element is executed in the main thread and not in your script thread)
- the row is deleted by QListWidget internally (and therefore the selected row changes)
- your script thread is executed and listWidgetRowChanged is called
You could to this to prevent this signal after you deleted a row:
thank you for the explanation. use blockSignals is possible to choose solution the problem.
but i also think that the solution should be internally and the signal should not be generated.
/ This signal is emitted if the current row selection has been changed /
but, if you use removeItem() signal is generated and param currentRow is bad.
Maybe I can implement a workaround. Thx for reporting this behaviour.
Last edit: Stefan Zieker 2018-10-30