Important: Please read the Qt Code of Conduct -

QSortFilterProxyModel* as signal argument is undefined in QML

  • Hi,
    I have the following class to be used as model for a QML TableView

    class ProcessProxyModel : public QSortFilterProxyModel {
    void procModelReady(const ProcessProxyModel* procmodel);
    ProcessProxyModel* m_procModel;

    The class is registered as:

        qmlRegisterUncreatableType<ProcessProxyModel>("com.dirac", 1, 0, "ProcessProxyModel", "Type is not allowed to be instantiated");

    When the model is ready, I emit a signal as follows:

    emit procModelReady(m_procModel);

    In QML however, the object passed is not recognized and reported as undefined.

    On the other hand, if I explicitly query for the model via:

    Q_INVOKABLE ProcessProxyModel* getProcProxy() const {
       return m_procModel;

    it works.

    To summarize, in QML:

    Connections {
            target: sysmon
            function onProcModelReady(model)    {
                console.debug(model)                                 // <--- prints undefined
                console.debug(sysmon.getProcProxy()) //<-- Works correctly

    Why is the signal argument's type not recognized?

  • Lifetime Qt Champion


    Don't you have any runtime message about an unknown type being used in your signal ?

  • @SGaist
    Thanks, but no such message appears.

  • The problem was due to the const specifier.

    void procModelReady(const ProcessProxyModel* procmodel);

    Changing it to:

    void procModelReady(ProcessProxyModel* procmodel);


Log in to reply