Results 1 to 3 of 3

Thread: problem with connecting signals with slots"

  1. #1
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default problem with connecting signals with slots"

    I've been programming with signals and slots for several years with no problems, but now!!
    I am trying to put togather a standered user interface for several of my programs.
    I want to use both pushbuttons and the function keys
    See attachement (i hope it is there );
    Qt Code:
    1. connect( Pb1, SIGNAL( clicked() ), this, SLOT( slotPb1() ) );
    2. connect( Pb2, SIGNAL( clicked() ), this, SLOT( slotPb2() ) );
    3. connect( Pb3, SIGNAL( clicked() ), this, SLOT( slotPb3() ) );
    To copy to clipboard, switch view to plain text mode 
    and i have
    Qt Code:
    1. public slots:
    2. void slotPb1();
    3. void slotPb2();
    4. void slotPb3();
    To copy to clipboard, switch view to plain text mode 
    in the headerfile.The program compiles without a wimper, but when I run it I get the "image" ok, but no signal slot connection
    pete@myComputer:~/Desktop/straight/baseform/test$ ./test
    Object::connect: No such slot QWidget::slotPb1()
    Object::connect: No such slot QWidget::slotPb2()
    Object::connect: No such slot QWidget::slotPb3()
    the "keyPressEvent" won't even compile of course. I have compared it with a similar program that runs fine and can't find any descrepcies. I am at a total loss.

    any help would be most appreciated.
    thanks
    Attached Images Attached Images
    Last edited by impeteperry; 27th September 2007 at 06:10.

  2. #2
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with connecting signals with slots"

    Hi, Have you inserted Q_OBJECT macro in your classes declarations?
    Classes have to be derrived from QObject and have this macro defined to be able to work on signals/slots.

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

    impeteperry (27th September 2007)

  4. #3
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: problem with connecting signals with slots"

    Thanks
    I feel very stupid

Similar Threads

  1. Memory Problem with SIGNALS and SLOTS
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2007, 20:39
  2. Connecting signals & slots across different threads
    By jyoti kumar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 12:40
  3. Problem with signals and slots
    By conexion2000 in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2006, 10:20
  4. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 11:35

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.