I am trying to use signals and slots to read data from a digitizer and then update a window upon the reading of the data. I am trying to generate a signal that is emitted from a method in one of my classes. The slot is a member function of a class derived from TGMainFrame.
Here are the specifics:
I have a class called digitizer that is derived from TQObject. The digitizer class has a method called Acquire, which performs the functions of acquiring the data from the digitizer and then emits a signal.
I also have a class called TestMainFrame that is derived from TGMainFrame. TestMainFrame has a member function called updatewindow that is supposed to update the window with new data received from the digitizer.
In my main program I have the following commands:
TestMainFrame mainWindow(gClient->GetRoot(), 400, 220);
digitizer *dig = new digitizer;
dig->Connect(“Acquire(void”), “digitizer”, &MainWindow, "update_window(void)"
I also used rootcint to generate a dictionary fror the TestMainFrame.h file.
I compile and link against the TestmainFramedict.o file.
I run the application and get the following error:
Error in TQObject::CheckConnectArgs: signal TQObject::Acquire(void) does not exist
What am I doing wrong. Any help would be greatly appreciated.
Thanks in advance.
you have several errors in
dig->Connect(“Acquire(void”), “digitizer”, &MainWindow, “update_window(void)”
Try without "void"
dig->Connect(“Acquire()”, "TestMainFrame ",&MainWindow, “update_window()”);
I am still having the same problem after I made the change you suggested. I get the following error:
Error in TQObject::CheckConnectArgs: signal TQObject::Acquire() does not exist
The class I am using (digitizer) inherits from TQObject. I am wondering why the error message reports that the signal does not exist in TQObject, when my class is an inherited class from TQObject.
Any help you can provide would be greatly appreciated. Thanks so much in advance.
digitizer class must
- be inherited from TQObject
- contain ClassDef
- have LinkDef file
Check as an example
I am still having the same problem. Below is my class definition for digitizer. After that, I provide my digitizerLinkDef.h file.
Any help would be greatly appreciated.
class digitizer : public TQObject
Double_t *waveFormArray0, *waveFormArray1;
char * dataArrayP;
#progma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class digitizer;
do not use "void Acquire(void); ".
This is C++ not C.
HTH. Regards. Valeriy
I have changed void Acquire(void) to void Acquire() in my class definition. Still no luck. The error message is that TQObject::Acquire() does not exist. However, my class is digitizer, which is derived from TQObject. Note that Acquire is new member function that I am defining in my derived class and which does not exist in TQObject. I don’t understand what is wrong. I really hope to get this to work as it will help our experiment. Is there anything else you can recommend.
do the same as $ROOTSYS/test/guiviewer.cxx
or send me the code (simplified as possible).
Sorry for all the questions. I am really hoping to get this to work. I am attaching my code. In the meantime, I am looking at guiviewer.cxx.
Thank you so much for all of your kind patience.
code.txt (9.14 KB)
code.txt (9.14 KB)
I am glad to see, that I am not the only one working with acqiris and root. here are some hints, that I found very helpfull:
put the ClassDef Macro in the TestMainFrame class, too. Create a LinkDef file for this class, as well.
Put the ClassDef macro at the end of the class declaration. (see root users guide for that)
Make sure, that rtti is turned on. I don’t know about linux, but in windows you have to add the /GR switch to the compiler.
digitizerdict.C : digitizer.h digitizerLinkDef.h
@echo “Generating dictionary . . .”
@rootcint digitizerdict.C -c digitizer.h
@echo "done . . . "
TestMainFramedict.C : TestMainFrame.h
@echo “Generating dictionary for TestMainFrame. . .”
@rootcint TestMainFramedict.C -c TestMainFrame.h
@echo "done . . .
I think the rootcint command has to be something like this:
rootcint -f digitizerdict.c -c digitizer.h digitizerLinkDef.h
same thing for the dict for testmainframe.
one more thing. You do not need to include
RQ_OBJECT macro to your class when it is inherited from
With recomendations from Lutz it should work.