There are two errors (at least) in your code snippets:
Your
connect2SQL
class is declared based on
QObject:
class connect2SQL : public QObject
But in the constructor you are calling the
QWidget
constructor:
connect2SQL::connect2SQL(QObject *parent=0) :
QWidget(parent)
{
};
The
new
operator returns an address to an allocated object. So this line should result in a compiler error like "conversion from 'connect2SQL*' to non-scalar type 'connect2SQL' requested":
connect2SQL mconnect2SQL = new connect2SQL(this);
Instead it must be a pointer:
connect2SQL *mconnect2SQL = new connect2SQL(this);
mconnect2SQL->server="localhost";