PDA

View Full Version : signal



mickey
21st February 2006, 11:38
Hi,
my connect in mainForm fail because says that there is no signal! Why?


connect( fileSaveAction, SIGNAL(statusMessage(const QString&)),
statusBar(), SLOT(message(const QString&)) );


I have declared signal from qtDesigner....

wysota
21st February 2006, 11:59
Is fileSaveAction a QAction? Then it doesn't have such signal. You can't declare a signal for an already existing class. You probably declared that signal in your form and not in the QAction object.

mickey
21st February 2006, 17:31
how to declare a signal from QT designer...I don't understand...fileSave is a QAction. I have insert statusMessage(const QString&) as signal in "members" from qt designer..
is not ok?

wysota
21st February 2006, 21:06
how to declare a signal from QT designer...I don't understand...fileSave is a QAction. I have insert statusMessage(const QString&) as signal in "members" from qt designer..
is not ok?

You have declared a signal for your form and not for the QAction object. You can't add signals to already existing classes. You have to subclass them to do that.

It'll be better if you connect the activated() signal from your QAction to a custom slot in the form and implement the functionality there:


connect(fileSaveAction, SIGNAL(activated()), this, SLOT(onActivated()));
//...

void myclass::onActivated(){
statusBar()->message(varHoldingCustomMessage);
}