Łukasz Przeniosło
Łukasz Przeniosło

Reputation: 2949

New way of connecting signals and slots

I am having a problems with the following line of code:

connect(m_uaProxy, CUaProxy::uaItemChanged,this, CUaHandler::onUaMsgReceived);

I am using Qt 5.11.1. On windows this compiles and works but yields the following "Issue":

error: call to non-static member function without an object argument

Running the same code on linux is not possible, because this exact line is terminating the compilation. I think I am running the code correctly using the new signal/slot connection method. What could be the case in here?

The method definitions are: The signal in the connection creating class:

void uaItemChanged(const MsgType msgt,
                   const QVariant& index,
                   const QVariant& value);

The slot in the CUaProxy class:

void onUaMsgReceived(const CUaProxy::MsgType msgt,
                     const QVariant& index,
                     const QVariant& value);

Upvotes: 0

Views: 175

Answers (1)

Łukasz Przeniosło
Łukasz Przeniosło

Reputation: 2949

I got the syntax wrong, this is the correct one (address of the function is needed):

connect(m_uaProxy, &CUaProxy::uaItemChanged, this, &CUaHandler::onUaMsgReceived);

No idea why it worked on windows platform.

Upvotes: 4

Related Questions