Results 1 to 6 of 6

Thread: Object::connect: Parentheses expected, slot...

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Object::connect: Parentheses expected, slot...

    I am trying to connect a QSpinBox to a slot:

    Qt Code:
    1. connect(Layer_spinBox, SIGNAL(valueChanged(int)),this, SLOT(setLayer(int)));
    2.  
    3. void
    4. JDFWindow::setLayer(int lyr)
    5. {
    6. active_layer_number = lyr;
    7. redraw();
    8. }
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. class JDFWindow : public QWidget, public Ui::JDFView
    2. {
    3. Q_OBJECT
    4. public:
    5. JDFWindow( QWidget * parent = 0, Qt::WFlags f = 0 );
    6. ~JDFWindow();
    7. void redraw();
    8.  
    9.  
    10. signals:
    11. void valueChanged(int);
    12. private slots:
    13. void setLayer(int);
    14.  
    15. private:
    16.  
    17. protected:
    18. QRectF screct;
    19. myQGraphicsScene *scene;
    20. JOB *Job;
    21. int active_layer_number;
    22. };
    To copy to clipboard, switch view to plain text mode 

    I get this strange message from the console:
    Object::connect: Parentheses expected, slot JDFWindow::
    Object::connect: (sender name: 'Layer_spinBox')
    Object::connect: (receiver name: 'JDFView')
    The slot works, I get the correct value form the QSpinBox, but the context of the JDFWindow object is lost when setLayer() is entered , the content of my object "Job" is garbage when enter the slot, while it was ok before I triggered the QSpinBox..

    The console message tells me soething is wrong with my syntax, but I cannot figure out what.

    Can someone enlighten me?
    Last edited by bnilsson; 2nd April 2008 at 23:06.
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Object::connect: Parentheses expected, slot...

    Apparently, I had a duplicate slot/signal defined in the Designer UI file that interfered with the written code.
    The error message is eliminated, but the object context corruption remains. I have not a clue. Anyone?
    MacOSX user dabbling with Linux and Windows.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Object::connect: Parentheses expected, slot...

    It must be some other connect statement because the receiver is JDFView. There is no ')' character in method name inside SLOT() macro.
    J-P Nurmi

  4. #4
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Object::connect: Parentheses expected, slot...

    It must be some other connect statement because the receiver is JDFView. There is no ')' character in method name inside SLOT() macro.
    Exactly.
    This is now eliminated, so now my problem is the data loss.
    Maybe I should put this question in a new thread?
    MacOSX user dabbling with Linux and Windows.

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Object::connect: Parentheses expected, slot...

    Quote Originally Posted by bnilsson View Post
    so now my problem is the data loss.
    I'm not exactly sure if I understand the problem. Perhaps you used a local Job pointer variable by accident so when you later access the member variable, it's uninitialized? Where do you allocate the job and how?
    J-P Nurmi

  6. #6
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Object::connect: Parentheses expected, slot...

    Well, it is solved.
    The "Job" data structure was accidentally deleted outside the Display method.
    Case closed, thanks for the attention.
    MacOSX user dabbling with Linux and Windows.

Similar Threads

  1. Replies: 21
    Last Post: 5th January 2008, 16:44
  2. Need help integrating sigc++ with a KDE3/Qt3 app
    By Valheru in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2007, 16:39
  3. Replies: 2
    Last Post: 8th October 2007, 16:02
  4. Program crashes (SIGSEGV)
    By Voldemort in forum Qt Programming
    Replies: 47
    Last Post: 21st May 2007, 21:09

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.