i will try it and i'll let you know!
Added after 1 30 minutes:
That's the code in the parent's file:
Properties = new properties(this);
connect(this,
SIGNAL(filename
(QString)),Properties,
SLOT(filename_sent
(QString)));
Properties->show();
emit filename(ui->listWidget->currentItem()->text());
Properties = new properties(this);
connect(this,SIGNAL(filename(QString)),Properties,SLOT(filename_sent(QString)));
Properties->show();
emit filename(ui->listWidget->currentItem()->text());
To copy to clipboard, switch view to plain text mode
The signal works fine, but what it actually does is to pass a variable from the parent to the child, but this variable is needed by the constructor of the child already. So, in the code of the child I have a global QString variable named 'image', so, the local child's slot (filename_sent(QString)) is:
image = img;
}
void filename_sent(QString img){
image = img;
}
To copy to clipboard, switch view to plain text mode
As you may understood, I need the signal to be sent before the constructor runs, so as 'image' to be a valid variable. How can I accomplish this?
It seems that in Properties->show(); it waits for the constructor to finish execution and then it sends the message. On the other hand I cannot place the emit signal before the ->show(); because there's nobody to receive the message, right?
Bookmarks