2011-11-22 78 views
0

我正在嘗試觀看消息正在通過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)’ 

可能是什麼原因?

回答

0

已解決

在我的情況下,在connect()指定的回調是從類我寫了一個方法,所以問題是,MyClass需要從QObject繼承:

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