No matching signal for on_currentChanged with QItemSelectionModel

  • Running Qt 4.8 on CentOS. This message is displayed when the dialog is displayed:
    QMetaObject::connectSlotsByName: No matching signal for on_currentChanged(QModelIndex,QModelIndex)

    However, the dialog operates as expected. When an item is selected with keyboard or mouse, the correct slot is called with the correct data.

    In dialog.h:

    QStandardItemModel* scenarioListModel;
    QItemSelectionModel* selectionModel;
    private slots:
    void on_currentChanged ( const QModelIndex& current, const QModelIndex& previous );

    In dialog.cpp:

    selectionModel = ui.scenarioListTableView->selectionModel();

    connect (selectionModel, SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
    this, SLOT(on_currentChanged( const QModelIndex&, const QModelIndex& )));
    void OpenScenarioDialog::on_currentChanged ( const QModelIndex& current, const QModelIndex& previous )
    QString selectedScenario =; // this has the current selection

    Other signals and slots on this dialog (and others) work fine. Selection mode is set to SingleSelection. Selection Behavior is SelectRows. QTableView has three columns.

    What am I missing? Thanks for your time and assistance.

    [EDIT: code formatting, please use @-tags, Volker]


    So don't create slots in such pattern

    If you do not intend to use "auto connection".

  • Would like to use the auto connection, but without the connect, the slot doesn't get called. Other auto connection slots on other dialogs work fine. Is there something else to do to get auto connect to work with the QItemSelectionModel?

Log in to reply

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