Hi!
I have created this class that inherits from QThread for send data to the database server, what do you think about it? Could be impreved?
Thanks
#ifndef QUERYTHREAD_H
#define QUERYTHREAD_H
#include
class QSqlQuery;
class QueryThread : public QThread {
public slots:
bool exec(QSqlQuery *query, Priority priority=InheritPriority);
protected:
virtual void run();
private:
bool m_hasError;
QSqlQuery *q;
};
#endif // QUERYTHREAD_H
#include "querythread.h"
#include
#include
bool QueryThread::exec(QSqlQuery *query, Priority priority)
{
q=query;
start(priority);
while(isRunning()) qApp->processEvents();
return m_hasError;
}
void QueryThread::run()
{ m_hasError=q->exec(); }