Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Status of a connected Signal.
Qt 6.11 is out! See what's new in the release blog

Status of a connected Signal.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chrisw01
    wrote on last edited by
    #1

    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..

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      2
      • C Offline
        C Offline
        Chrisw01
        wrote on last edited by
        #3

        Thanks, works great!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved