繁体   English   中英

使用QtGstreamer在connect()上编译错误

[英]Compiling error on connect() with QtGstreamer

我正在尝试查看通过QtGstreamer 管道传递的消息

这是有问题的代码:

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

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

但是QtCreator抱怨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)’

可能是什么原因?

解决了

就我而言, connect()指定的回调是我编写的类中的方法,因此问题在于MyClass需要从QObject继承:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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