PDA

View Full Version : Data type parameters.



vinny gracindo
28th October 2009, 01: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

jano_alex_es
28th October 2009, 10:00
I feel sorry, but I barely understand what you want to do :P


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.

did you mean QLineEdit::setText()??