PDA

View Full Version : Please Help----->Basic question about "connect" command !



Krish
29th February 2008, 14:34
Hello! Everybody,
I am planning to use Qt3.3.3 for a GUI design. I have read the Signal & Slot doc related to Qt3.3. I got one doubt in connecting the signals as shown: -


Foo a, b;
connect(&a, SIGNAL(valueChanged(int)), &b, SLOT(setValue(int)));


They have used "&a" and "&b" for connecting them. What is its significant i mean can't i use just"a" and "b" in the same way. If No why? or Yes why?

Thanks in advance.:)

wysota
29th February 2008, 14:43
connect() expects pointers, thus you need to pass a pointer and not an object. If you have objects and not pointers to objects, you need to dereference them with the ampersand. This has nothing to do with connect(), it's a strictly C++ rule.