looqs/gui/searchworker.cpp

26 líneas
504 B
C++
Original Vista normal Histórico

2018-09-02 12:27:23 +02:00
#include <QRegularExpression>
#include <QDebug>
2018-09-02 12:27:23 +02:00
#include <QSqlError>
#include <QStack>
#include "searchworker.h"
#include "../shared/sqlitesearch.h"
SearchWorker::SearchWorker()
{
}
SearchWorker::SearchWorker(const QString &dbpath)
{
2018-09-02 12:27:23 +02:00
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dbpath);
if(!db.open())
{
qDebug() << "failed to open database";
}
}
2018-09-02 12:27:23 +02:00
void SearchWorker::search(const QString &query)
{
SqliteSearch searcher(db);
emit searchResultsReady(searcher.search(query));
2018-09-02 12:27:23 +02:00
}