Results 1 to 2 of 2

Thread: Please Help----->Basic question about "connect" command !

  1. #1
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Please Help----->Basic question about "connect" command !

    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: -
    Qt Code:
    1. Foo a, b;
    2. connect(&a, SIGNAL(valueChanged(int)), &b, SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Please Help----->Basic question about "connect" command !

    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.

  3. The following user says thank you to wysota for this useful post:

    Krish (29th February 2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.