PDA

View Full Version : Signals/Slots stopped working



Jimmy2775
31st March 2006, 20:03
Hello,

I'm working on an application that uses signals and slots. We are writing our app using Qt 4.1.0 in MS Visual Studio 2003.

My application was working well last week. I had one class that emitted signals that were recieved by another class's slots. It was all very cool and I was happy.

This week our project got split so that my two classes are in different Visual Studio project (.vcproj) files. Now when my one class emits a signal, the other does not pick it up.

If anyone has any ideas about what may have happened and how I could fix this, I would certainly appreciate it.

Thanks in advance,
Jimmy

jacek
31st March 2006, 20:11
Add "CONFIG += console" to your .pro file, compile in debug mode and check if there are some messages on the console.

Jimmy2775
31st March 2006, 20:18
adding that line to the .pro file does not seem to make a difference. there are no additional messages in the output window

Does the .pro file even get used when compiling within Visual Studio?

GreyGeek
31st March 2006, 20:34
adding that line to the .pro file does not seem to make a difference. there are no additional messages in the output window

Does the .pro file even get used when compiling within Visual Studio?

After you modified the .pro file you did regenerate the Makefiles, didn't you?

Jimmy2775
31st March 2006, 20:34
Fixed the problem.

In case anyone else encounters this: My signals were in a dll project and slots in the exe. I changed the dll's project config to a static library (.lib) instead and the slots were able to pick up the signals again.

Jimmy

Jimmy2775
31st March 2006, 20:36
I'm not certain if .pro and makefile are applicable or relavent in this case when the VS compiler is using the .sln and .vcproj files for the build. Am I wrong in that assumption?

jpn
31st March 2006, 20:44
Does the .pro file even get used when compiling within Visual Studio?

Modifying the .pro file has no effect unless you re-import the project from the .pro file (the Qt-menu in visual studio).
It's profitable to maintain the .pro file, anyway. I don't ever store any visual studio files in version control. I always keep the .pro file up-to-date and keep only "a clean Qt-project" in version control. Actually, I always even open the project in visual studio through the Qt-menu. This way I have a fully working project nevertheless I check it out to a different platform.. You don't have much use for visual studio project files in Linux. ;)

How did you create the connection in the first place?
These aforementioned two classes are now in different projects, but same solution?

Jimmy2775
31st March 2006, 20:55
That is a good point about maintaining the .pro file. At this point we are only building for Windows, but that will change in time. It is probably wise to be prepared for that :)

Origionally the two files were in the same solution, same project. Now they are in different projects but the same solution. I create the connection between the two in the constructor of the class with the slots. I take a pointer to the signal class as a parameter of the constructor of the slot class.

jpn
31st March 2006, 21:11
Ok nevermind, as the problem was already solved while I was still tapping my first post.. :)