Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Error while using signal slots with arrays.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Error while using signal slots with arrays.

Scheduled Pinned Locked Moved General and Desktop
signalslot
3 Posts 2 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ealioneE Offline
    ealioneE Offline
    ealione
    wrote on last edited by ealione
    #1

    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?

    1 Reply Last reply
    0
    • sneubertS Offline
      sneubertS Offline
      sneubert
      wrote on last edited by
      #2

      Hi ealione,

      do you have the Q_OBJECT macro in your Details class?

      1 Reply Last reply
      0
      • ealioneE Offline
        ealioneE Offline
        ealione
        wrote on last edited by
        #3

        Hi sneubert,
        No I had forgotten to add that.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved