looqs/gui/searchworker.cpp

28 baris
533 B
C++
Mentah Pandangan Normal Riwayat

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
}