Status of a connected Signal.



  • Hi all,

    I have a strange issue, well strange for me..

    I have a signal connected to activate buttons.

    connect(ui->employeeTableWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotSelectionChange(QItemSelection,QItemSelection)));
    
    

    Works great until I edit the data and resubmit it to the database, then the signal stops firing. My fix is to call this code again after the database update at which point everything starts working again. However I don't think that's the right way to do it.

    I did find the isSignalConnected method but when I pass it the selectionChanged() signal it states that it was not declared in this scope.

    any ideas? or does reconnecting the signal after everytime I do a database update hurt things?

    Thanks..



  • Hi! The selection model object will be replaced with a new one under certain circumstances, e.g. on calls to setModel. Then the object you're referring to in your connection statement becomes invalid (for more, see: setModel). That's probably what happens when you "edit the data and resubmit it to the database". Better connect your slot to the itemSelectionChanged signal instead.



  • Thanks, works great!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.