Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Extra blank headers when using QSQLite compiled with FTS3 support
Forum Updated to NodeBB v4.3 + New Features

Extra blank headers when using QSQLite compiled with FTS3 support

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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);
    if(!ret)
    {
        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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved