Hi again,
I'm having problems connecting to a class that does not have a pointer.
I created an instance of a class and I thought that I didn't need it to be a pointer, so I will just create the object in my header file. But when I attempt to connect a signal from that instance the compiler throws an error:
xBeeComms comms(); // Object
...
connect( &comms,
SIGNAL( dataReceived
( QbyteArray
* ) ),
this,
SLOT( receivedData
( QByteArray * ) ) );
// In the constructor
xBeeComms comms(); // Object
...
connect( &comms, SIGNAL( dataReceived( QbyteArray * ) ), this, SLOT( receivedData( QByteArray * ) ) ); // In the constructor
To copy to clipboard, switch view to plain text mode
The error I get is:
ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&messageGenerator::comms’
ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&messageGenerator::comms’
To copy to clipboard, switch view to plain text mode
So I change the code to:
connect( &messageGenerator
::comms,
SIGNAL( dataReceived
( QbyteArray
* ) ),
this,
SLOT( receivedData
( QByteArray * ) ) );
connect( &messageGenerator::comms, SIGNAL( dataReceived( QbyteArray * ) ), this, SLOT( receivedData( QByteArray * ) ) );
To copy to clipboard, switch view to plain text mode
And I now get the error:
error: no matching function for call to ‘messageGenerator::connect(xBeeComms (messageGenerator::*)(), const char [30], messageGenerator* const, const char [30])’
error: no matching function for call to ‘messageGenerator::connect(xBeeComms (messageGenerator::*)(), const char [30], messageGenerator* const, const char [30])’
To copy to clipboard, switch view to plain text mode
Any idea's how to get it working?
Bookmarks