Important: Please read the Qt Code of Conduct -

QML Signal connect to C++ Signal

  • I have a signal that is emitted by a C++ object that is of "QItemSelectionModel" type. The signal I connect to is "selectionChanged". I have a slot connected to this signal in C++ and can verify that the signal is firing as it updates a C++ function that prints to the console.

    I am trying to connect a QML signal to this signal as the documentation says I can do:

    ListView {
      id: cell_list
      // update current selection
      signal selectionChanged
      onSelectionChanged: {
      Component.onCompleted: {

    I don't get any errors when running this code, but I never see "onSelectionChanged" fire.

    To clarify:

    • cell_list is the ListView in QML
    • cells_selectionmodel is the QItemSelectionModel exposed to QML

  • It would help if I were doing it right:

    So not doing the other QML and doing this works:

    Connections {
      target: cells_selectionmodel
      onSelectionChanged: {
        console.log("selectionChanged from C++");

Log in to reply