PDA

View Full Version : Signals And Slots problem



ldiamond
22nd March 2008, 22:00
I'm trying to send a vector<string> to my GUI using signals and slots. I defined a signal SetWindowList(vector<string>) in class A and a slot SetWindowList(vector<string>) in class B.

I emit SetWindowList(somevectorhere), but the slot is never executed. If I change all the vectors for int, it works perfectly.

How do I send my vector to my GUI?


Thanks!

wysota
22nd March 2008, 23:29
Enable the console and see what error message you get there.

ldiamond
22nd March 2008, 23:35
How do I do that?

wysota
22nd March 2008, 23:36
Add "CONFIG+=console" to your project file, rerun qmake and build the project.

ldiamond
22nd March 2008, 23:39
Well, I'm using VS integration I got no .pro file

ldiamond
22nd March 2008, 23:49
I found something in the output window in debug mode:
QObject::connect: Cannot queue arguments of type 'std::vector<std::string>'

However, I had another error that I fixed by adding std:: namespace (eventho im using namespace std already)

wysota
23rd March 2008, 00:07
Good. Now go and read about Q_DECLARE_METATYPE(). Or better yet, use QStringList instead of std::vector<std::string>.

ldiamond
23rd March 2008, 00:11
QStringList looks nice, thx