I am novice but my way is:
principal.cpp
void Principal::on_pushButton_facturacion_clicked()
{
Facturacion *form_factu = new Facturacion; //Create new form with other class
form_factu->show();
QObject::connect(form_factu,
SIGNAL(cambia
(str_remote
)),
this,
SLOT(muestramenu
(str_local
)));
//Connect when is emit signal cambia in the child form and pass the string to local function }
void Principal
::muestramenu(QString str_local
) {
qDebug() << "Back to main" << str_local;
}
void Principal::on_pushButton_facturacion_clicked()
{
Facturacion *form_factu = new Facturacion; //Create new form with other class
form_factu->show();
QObject::connect(form_factu, SIGNAL(cambia(str_remote)), this, SLOT(muestramenu(str_local))); //Connect when is emit signal cambia in the child form and pass the string to local function
}
void Principal::muestramenu(QString str_local)
{
qDebug() << "Back to main" << str_local;
}
To copy to clipboard, switch view to plain text mode
facturacion.h
class Facturacion....
{
....
signals:
}
class Facturacion....
{
....
signals:
void cambia(QString);
}
To copy to clipboard, switch view to plain text mode
facturacion.cpp
void Facturacion::on_edit_onchange()
{
name = f_ui->edit->Text();
emit cambia(name);
}
void Facturacion::on_edit_onchange()
{
QString name;
name = f_ui->edit->Text();
emit cambia(name);
}
To copy to clipboard, switch view to plain text mode
Sorry for errors and my bad english.
Bookmarks