[Kde-games-devel] KGame/KPlayer API usability in kdegames
Andreas Beckermann
b_mann at gmx.de
Wed Jul 12 09:37:00 CEST 2006
On Wednesday 12 July 2006 09:17, Dmitry Suzdalev wrote:
> > Why hack? It's the correct solution to a situation where a predefined
> > class can't be used.
>
> Yes, but when the class usage becomes not evident and I have to place
> a workarounds like this here and there, I call it a hack.
> In my terminology at least :).
>
> > I have no idea what you are talking about.
>
> That's because I didn't go into details. Don't know whether you're
> interested, but to be brief:
>
> to emulate signalMouseEvent(KGameIO*, QDataStream&, QMouseEvent*, bool*)
> from QGraphicsView::mouse*Event() i need KGameIO* and QDataStream.
> And there's no way to know something about KGameIO* object within that
> QGraphicsView-derived class because KGameIO* is created and maintained
> internally by KWin4Doc class...
Actually you need a KPlayer pointer only. By looking at the KGameMouseIO code
you'll see that this code does only the following:
QByteArray buffer;
QDataStream msg(buffer, IO_WriteOnly);
if (eatevent) {
kplayer->sendInput(msg);
}
where "eatevent" is the boolean parameter of the signal (and is false by
default, i.e. nothing is sent unless the slot connected to the signals wants
to) and "msg" is the datastream that replaces the datastream parameter.
CU
Andi
More information about the kde-games-devel
mailing list