[SOLVED]Error while using signal slots with arrays.



  • I have two classes:

    class Details : public QWidget
    

    and

    class Viewport : public QMainWindow
    

    Inside my Viewport constructor I initialise

    m_details = new Details;
    

    and connect them using signals/slots

    connect(this, SIGNAL(thisUpdated(int, int, int)), m_details, SLOT(update(int, int, int)));
    

    I have declared the signal for the Viewport

    signals:
        void thisUpdated(int, int, int);
    

    and the slot for my Details class

    private slots:
        void update(int, int, int);
    

    I emit my signal in this manner

    thisUpdated(*vals1, *vals2, length);
    

    vals1 and 2 are arrays

    int * vals1;      
    vals1 = new int[length];
    

    and inside my Details view the slot is implemented like this

    void Details::update(int val1, int val2, int length)
    {
        // some operations.
    }
    

    If I run the program though I get

    QObject::connect: No such slot QWidget::update(int, int, int) in
    

    Does anyone know what I am doing wrong here?



  • Hi ealione,

    do you have the Q_OBJECT macro in your Details class?



  • Hi sneubert,
    No I had forgotten to add that.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.