Important: Please read the Qt Code of Conduct -

Extra blank headers when using QSQLite compiled with FTS3 support

  • i compiled the Qt 4.8 SQLite with the latest SQLite version to support FTS3/FTS4
    so i could do full text search . the problem is that when im getting result from the query im There is more headers created blank ones , they added to the existing headers i have , it all mess . when i preform simple query every thing works file and i dont get new headers created now here is my setup:

    @when the application starting i create the table like this :
    // when application start
    bool SqlManager::CreateListTable()
    bool ret = false;

    QString q = "CREATE VIRTUAL TABLE list_tbl USING fts3 ("
                        "from_user , " 
                        "from_id , "
                        "created_time , "
                        "info , "
                        "created_time_formated )";
    QSqlQuery query;
    ret = query.exec(q);
        LOG_MSG("SqlManager: "+query.lastError().text().toStdString())
    return ret;

    //this is the QSqlQueryModel subclass im using set into QTableView , here is where i set the headers
    QVariant ListSqlModel::headerData(int section, Qt::Orientation orientation, int role) const

    if(orientation == Qt::Vertical && role == Qt::DisplayRole){
        return section;
    if (role == Qt::DisplayRole)
        if (orientation == Qt::Horizontal) {
            switch (section)
            case 0:
                return QString("From");
            case 1:
                return QString("Created Time");
            case 2:
                 return QString("info");             
    return QVariant();

    // here i call the query to preform text search on the table , it is working but messing the headers the result is not ordered right extra headers created

    ListSqlModel::ListSqlModel( QObject *parent ) :QSqlQueryModel(parent)
    queryDB = SqlManager::getInstance()->getDB(); // getting from SqlManager

    void ListSqlModel::setFullTextSearchListQuery(const QString &query)
    QString tbl = LIST_TBL;
    QString queryFullTextSearch = "SELECT * FROM "+tbl +" WHERE "+tbl+" MATCH '"+query+"'";
    QSqlQueryModel::setQuery(queryFullTextSearch, queryDB);

    what im doing wrong here in this setup?

Log in to reply