简体   繁体   中英

Compiling error on connect() with QtGstreamer

I'm trying to watch messages that are passing through a QtGstreamer pipeline .

Here is the code in question:

//pipeline is of type: QGst::PipelinePtr
pipeline->bus()->enableSyncMessageEmission(); 

QGlib::connect(pipeline->bus(), "sync-message", this, &MyClass::_msg_handler);

But QtCreator complains of connect() :

/usr/include/QtGStreamer/QGlib/connectimpl.h:-1: In function 
‘bool QGlib::connect(void*, const char*, T*, R (T::*)(A0), QGlib::ConnectFlags) 
[with T = MyClass, R = void, A0 = const QGlib::RefPointer<QGst::Message>&, 
QGlib::ConnectFlags = QFlags<QGlib::ConnectFlag>]’:

/usr/include/QtGStreamer/QGlib/connectimpl.h:330: error: invalid initialization
of reference of type ‘const QGlib::Private::DestroyNotifierIfacePtr&’ from 
expression of type ‘QGlib::Private::GetDestroyNotifier<MyClass, void>’

/usr/include/QtGStreamer/QGlib/connect.h:259: error: in passing argument 5 of 
‘ulong QGlib::Private::connect(void*, const char*, QGlib::Quark, void*, const
QGlib::Private::DestroyNotifierIfacePtr&, uint, QGlib::Private::ClosureDataBase*, 
QGlib::ConnectFlags)’

What might be the cause?

Solved .

In my case, the callback specified in connect() was a method from a class I wrote, so the problem was that MyClass needed to inherit from QObject :

class MasterSink : public QObject
{
   // ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM