Menu

listWidget currentRowChangedSignal

Anonymous
2018-10-30
2018-10-30
  • Anonymous

    Anonymous - 2018-10-30

    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.

     
  • Stefan Zieker

    Stefan Zieker - 2018-10-30

    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):

    function UI_DialogFinished(e)
    {
        scriptThread.stopScript()
    }
    
    UI_Dialog.finishedSignal.connect(UI_DialogFinished);
    

    Regards,
    Stefan

     

    Last edit: Stefan Zieker 2018-10-30
    • 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.

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-30

    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:

    UI_listWidget.blockSignals(true);
    UI_listWidget.removeItem( currentRow);
    UI_listWidget.blockSignals(false);
    
     
    • Anonymous

      Anonymous - 2018-10-30

      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.

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-30

    Maybe I can implement a workaround. Thx for reporting this behaviour.

     

    Last edit: Stefan Zieker 2018-10-30

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.