vinny gracindo
28th October 2009, 00:26
Hello
I have the following class:
class Motorista() {
protected:
string name; //or char* name;
string idade;
public:
void insertMotorista(string _name, string _idade) {
name = _name;
idade = _idade;
QSqlQuery query;
query.exec("INSERT INTO motorista (nome, id)" "VALUES ('name', 'idade')");
}
}
I also have a class Ui_Moto:
class Ui_moto
{
public:
QLineEdit *name2;
QLineEdit *idade2;
(...)
(...)
}
Now I want to use the QLineEdit constructor of the class Motorista:
void Ui_moto::cad()
{
Motorista* moto = new Motorista();
moto->insertMotorista(name2, idade2); // (LineEdit *name2, QLineEdit *idade2)
}
In other words, what I'm wanting is to put parameters in the data that the User writes in the form to register a Motorista.
Can be done?
Thx
I have the following class:
class Motorista() {
protected:
string name; //or char* name;
string idade;
public:
void insertMotorista(string _name, string _idade) {
name = _name;
idade = _idade;
QSqlQuery query;
query.exec("INSERT INTO motorista (nome, id)" "VALUES ('name', 'idade')");
}
}
I also have a class Ui_Moto:
class Ui_moto
{
public:
QLineEdit *name2;
QLineEdit *idade2;
(...)
(...)
}
Now I want to use the QLineEdit constructor of the class Motorista:
void Ui_moto::cad()
{
Motorista* moto = new Motorista();
moto->insertMotorista(name2, idade2); // (LineEdit *name2, QLineEdit *idade2)
}
In other words, what I'm wanting is to put parameters in the data that the User writes in the form to register a Motorista.
Can be done?
Thx