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;
query.exec("INSERT INTO motorista (nome, id)" "VALUES ('name', 'idade')");
}
}
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')");
}
}
To copy to clipboard, switch view to plain text mode
I also have a class Ui_Moto:
class Ui_moto
{
public:
(...)
(...)
}
class Ui_moto
{
public:
QLineEdit *name2;
QLineEdit *idade2;
(...)
(...)
}
To copy to clipboard, switch view to plain text mode
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)
}
void Ui_moto::cad()
{
Motorista* moto = new Motorista();
moto->insertMotorista(name2, idade2); // (LineEdit *name2, QLineEdit *idade2)
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks