[FSO] problem connect Dbus signals with Qt4

macebre macebre at web.de
Tue Nov 25 18:33:49 CET 2008


thanks,

i declared a new Metatype GPSSatellite with << and >> operators. 

struct GPSSatellite
{
    		int ID;
		bool InUse;
		unsigned int Elevation;
		unsigned int Azimuth;
		unsigned int SNR;
};

Q_DECLARE_METATYPE(GPSSatellite);
Q_DECLARE_METATYPE(QList<GPSSatellite>);


They work fine with the dBus method GetSatellites().


QDBusMessage SatelliteReply;
	SatelliteReply = GPSInterface->call("GetSatellites");
	QList<GPSSatellite> satList = qdbus_cast<QList<GPSSatellite> 
>(SatelliteReply.arguments()[0]);



my problem is that i can not connect to the SatellitesChanged signal like:

connect(GPSInterface, SIGNAL( SatellitesChanged(QDBusMessage) ) ,this, SLOT( 
handleSatellitesChanged(QDBusMessage) ) );

I have tried many Types and every time there's the error like:

Object::connect: No such signal local::Merged::SatellitesChanged(QDBusMessage)

which Type / Metatype shoud i use here?? 
(



On Sunday 23 November 2008 22:41:39 Michael 'Mickey' Lauer wrote:
> Am Sunday 23 November 2008 22:24:18 schrieb macebre:
> > Does somebody know which type I have to use there or where I could find
> > more information about this?
> > Is there a command to find out which Qt type  is send by a signal?
>
> Please consult the Qt DBus documentation, e.g.
> http://doc.trolltech.com/4.2/qdbusargument.html
>
> IIRC it says there that you have to use the >> operator to extract
> arguments out of arrays and structs.

*******************************************************************
for Interested the my GPSSatellite operators:


 QDBusArgument &operator<<(QDBusArgument &argument, const GPSSatellite &sat)
 {
     argument.beginStructure();
     argument << sat.ID << sat.InUse << sat.Elevation << sat.Azimuth << 
sat.SNR;
     argument.endStructure();
     return argument;
 }


 const QDBusArgument &operator>>(const QDBusArgument &argument, GPSSatellite 
&sat)
 {
     argument.beginStructure();
     argument >> sat.ID >> sat.InUse >> sat.Elevation >> sat.Azimuth >> 
sat.SNR;
     argument.endStructure();
     return argument;
 }



and somewhere in code:

	qDBusRegisterMetaType<GPSSatellite>();
	qDBusRegisterMetaType<QList<GPSSatellite> >();






More information about the community mailing list