Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to Install QSparql



  • Hi,
    Can anybody help on this that how I can install or configure QSparql. So that I can import it in QML file.

    Br,
    AKA



  • What did you try so far?



  • Thanks,
    I have been trying to get some data related to incoming phone call, caller info, alarm info from date-time settings etc.

    I have not find any API in Qt itself but probably possible from Sparql query language.



  • Don't know if this works for you but I can install QSparql with this command: sudo zypper install libqtsparql libqtsparql-devel.

    Or you can check out the code directly from git://gitorious.org/maemo-af/qsparql.git and then build it yourself.

    For using QSparql in QML, check it here: http://kdedevelopers.org/node/4340



  • Many Thanks,

    one more thing is any idea that how to update the SparqlResultsList in application runtime. For example if there is a Timer and it updates SparqlResultsList in every 5 sec.

    So, any method in SparqlResultsList to call to execute the query again. I have some situation that require to update UI when ever some new data arrive.

    Another question is in which OS environment did you try this command : sudo zypper install libqtsparql libqtsparql-devel



  • Well, as you can see when looking at the code of QSparqlResultsList, neither setQuery() nor reload() checks for query change, so, I think you can make it query again by setting the same query for every 5 sec. reload() is a public function but since it's not exported to QML then you can't use it inside your QML code.
    @
    QSparqlResultsList::setQuery(const QString &query)
    {
    d->query = query;
    reload();
    }

    void QSparqlResultsList::reload()
    {
    if (d->options == 0 || d->query.isEmpty())
    return;
    if (d->result != 0) {
    if (!d->result->isFinished())
    return;
    else
    delete d->result;
    }
    delete d->connection;
    d->connection = new QSparqlConnection(d->options->driverName(), d->options->options());
    d->result = d->connection->exec(QSparqlQuery(d->query));
    connect(d->result, SIGNAL(finished()), this, SIGNAL(finished()));
    connect(d->result, SIGNAL(finished()), this, SLOT(queryFinished()));
    connect(d->result, SIGNAL(dataReady(int)), this, SLOT(queryData(int)));
    }
    @

    sudo zypper install libqtsparql libqtsparql-devel is for meego sdk.



  • Thanks for sharing good knowledge, actually I was searching QML documentation for QSparqlResultsList element. Haven't seen any.

    But seems still possible to find from its implementation code.


Log in to reply