Janek
29th December 2009, 18:00
1) I have 2 classes, first is MyForm, and second classTwo. MyForm have private object of type classTwo named objTwo - Is that a good idea? or better to create both of it in main.c as coexistent?
2) In MyForm constructor I try to connect SIGNAL from MyForm to SLOT from classTwo - it's not working, why?
connect(widget.buttonX, SIGNAL(clicked()), objTwo, SLOT(slotX(widget.edit->text())));
As a workaround I declared new SLOT in MyForm which call objTwo.slotX() - this way it works, but Im sure this is bad practice, or isn't it?
The real problem comes when I want to connect SIGNAL from classTwo to MyForm class (in MyForm constructor). The only way I see is to cross include class headers, but I do want to make it properly, so obviously i miss something, as cross including is bad practice?
I need to send something to classTwo from MyForm and then wait for signal to read answer back.
Please help.
2) In MyForm constructor I try to connect SIGNAL from MyForm to SLOT from classTwo - it's not working, why?
connect(widget.buttonX, SIGNAL(clicked()), objTwo, SLOT(slotX(widget.edit->text())));
As a workaround I declared new SLOT in MyForm which call objTwo.slotX() - this way it works, but Im sure this is bad practice, or isn't it?
The real problem comes when I want to connect SIGNAL from classTwo to MyForm class (in MyForm constructor). The only way I see is to cross include class headers, but I do want to make it properly, so obviously i miss something, as cross including is bad practice?
I need to send something to classTwo from MyForm and then wait for signal to read answer back.
Please help.