Results 1 to 6 of 6

Thread: QObject::connect: No such signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Exclamation QObject::connect: No such signal

    Hi,

    I am a newbie to qt... I thought I followed the obvious steps to define "signal" for a customized widget (in my example, BinaryButtonWg). i.e.,

    1. declare the signal in BinaryButtonWg.h
    2. connect signal and slot with same arguments
    3. emit signal

    ... But, somehow, there is always a complain of QObject::connect No such signal, when I try to connect the signal in my application of the BinaryButtonWg class.

    And, when I use dumpObjectInfo(), it showed

    OBJECT BinaryButtonWg::mask
    SIGNALS OUT
    <None>
    SIGNALS IN
    QHButtonGroup::unnamed



    I believe I could have missed out something fundamental.. I will appreciate your help.. Following are my codes of BinaryButtonWg:

    BinaryButtonWg.h
    Qt Code:
    1. #ifndef BINARYBUTTONWG_H
    2. #define BINARYBUTTONWG_H
    3.  
    4. #include <qwidget.h>
    5. #include <qhbuttongroup.h>
    6. #include <qvbox.h>
    7. #include <qsize.h>
    8.  
    9. class BinaryButtonWg : public QWidget
    10. {
    11. Q_OBJECT
    12. public:
    13. BinaryButtonWg(QSize bsize, unsigned int bitsize=8, QWidget *parent = 0, const char *name = 0 , const char *title = 0);
    14. ~BinaryButtonWg() {};
    15.  
    16.  
    17. public slots:
    18. void enableBits(unsigned int bits);
    19.  
    20. private slots:
    21. void buttonPressed(int buttonId);
    22. signals:
    23. void bbChanged(unsigned int newValue);
    24. private:
    25. QHButtonGroup* _bg;
    26. QVBox* _vb;
    27. unsigned int _value;
    28. unsigned int _bitsize;
    29.  
    30. };
    31.  
    32. #endif
    To copy to clipboard, switch view to plain text mode 

    In BinaryButtonWg.cpp,

    Qt Code:
    1. BinaryButtonWg::BinaryButtonWg(QSize bsize, unsigned int bitsize, QWidget *parent, const char *name , const char* title ): QWidget(parent, name, 0)
    2. {
    3. _bg = new QHButtonGroup(_vb);
    4. .
    5. .
    6. // this one work fine
    7. connect( _bg, SIGNAL( clicked(int) ), this, SLOT( buttonPressed(int)));
    8. }
    9.  
    10. void BinaryButtonWg::buttonPressed( int buttonId)
    11. {
    12. _value ^= (1 << buttonId);
    13. printf("buttonPressed! new value: 0x%02X\n", _value);
    14. emit this->bbChanged(_value);
    15. }
    To copy to clipboard, switch view to plain text mode 


    Rgds

    Casey
    Last edited by marcel; 18th February 2008 at 09:15. Reason: missing [code] tags

Similar Threads

  1. Possible signal mapper problem
    By MarkoSan in forum Qt Programming
    Replies: 13
    Last Post: 25th January 2008, 13:11
  2. Replies: 6
    Last Post: 21st September 2007, 13:51
  3. Replies: 2
    Last Post: 17th May 2006, 21:01
  4. no such signal QListBox::currentChanged()
    By jopie bakker in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 15:17

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
  •  
Qt is a trademark of The Qt Company.