Re: about signals and slots
I think there is object problem .....because which signal you are emiting is not receive by your own slot because it treats as different object ...........
So you have to think in different way to use that object ............;)
Re: about signals and slots
Can we see the exact connect() statements?
Re: about signals and slots
Yaa, sure!
Here, I have pasted the main code.
If you want it in more details then let me know I will drop the complete code.
In QMyToolbar class file.
Code:
{
m_action
= addAction
(QIcon(tr
("image.png")),tr
("Start/Stop"));
connect(m_action, SIGNAL(toggled(bool )), this, SIGNAL(workingToggle(bool)));
}
In MyWidget class file.
Code:
QMyToolbar * MyWidget::m_spClockToolbar = NULL;
MyWidget
::MyWidget(QWidget *parent
){
if(m_spClockToolbar == NULL)
{
m_spClockToolbar = new QClockToolBar();
}
connect(m_spClockToolbar, SIGNAL(workingToggle(bool)), this, SLOT(startWork(bool )));
}
m_spClockToolbar is a static member;
Re: about signals and slots
Hi wysota,
I got answer in different way.
I changed one line.
Code:
m_action
= addAction
(QIcon(tr
("image.png")),tr
("Start/Stop"),
this,
SIGNAL(workingToggle
(bool)));
But may I know what was the wrong with my previous code.
I look me correct. Please let me know if something is wrong.
Thanks for immediate reply.
Regards,
Sandip
Re: about signals and slots
Probably you were using a wrong signal - toggled() .
Try trigerred() instead of toggled() and see if it works :)
Re: about signals and slots
toggled() works only for checkable (two-state) actions and yours seems to be a single-state one.
Re: about signals and slots
I don't think that this is the reason. Because I tried with
changed signal and my slot which doesn't take any arguments.
it was similar to
Code:
connect(m_action, SIGNAL(changed( )), this, SIGNAL(checkslot()));
i should have tried with triggered()
is there any special case with changed signal? if yes please let me know so that I can take care of it next time
thanks all of you for helping me.
Re: about signals and slots
changed() signal is for something completely different...
Re: about signals and slots
Yaa, you are right.
Thanks a lot!
Sorry that was my mistake.
Regards,
Sandip