Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Use QSqlQueryModel with Qt Remote Objects module



  • Hi everyone
    I have next .rep file:

    class CFooBar {
        MODEL credsModel(display);
    };
    

    On source side I call:

    QSqlQueryModel* model { new QSqlQueryModel };
    model->setQuery(
        QStringLiteral(
            "SELECT fname,lname "
            "FROM \"my_table\""
            ),
        *this
    );
    model->setHeaderData(0, Qt::Horizontal, QObject::tr("First name"), Qt::DisplayRole);
    model->setHeaderData(1, Qt::Horizontal, QObject::tr("Last name"), Qt::DisplayRole);
    setCredsModel(model);
    

    This emits credsModelChanged(model);, that I set to table view on replica side. But nothing happens. But if I'm using enableRemoting and acquireModel interfaces, it works.

    How to properly work with MODEL keyword of repc in this context?
    Thanks!


Log in to reply