[Kde-games-devel] KsirK porting
Kleag
kleag at free.fr
Fri Jan 5 00:28:26 CET 2007
Hello!
Just a note to say that KsirK is nearly completely ported to KDE4+QGV. The
only remaining big task is to port graphics to SVG !
I also had to make a little patch on the libkdegames/kgame library to be able
to use the KGameIO through KGraphicsView. Here it is for review.
Regards,
Kleag
--
KsirK - a turn-based strategy game for KDE
http://gna.org/projects/ksirk
KGraphViewer - a GraphViz dot graphs viewer
http://extragear.kde.org/apps/kgraphviewer
-------------- next part --------------
Index: libkdegames/kgame/kgameio.h
===================================================================
--- libkdegames/kgame/kgameio.h (révision 619576)
+++ libkdegames/kgame/kgameio.h (copie de travail)
@@ -27,6 +27,7 @@
#include <QObject>
//Added by qt3to4:
#include <QMouseEvent>
+#include <QGraphicsScene>
#include <QKeyEvent>
#include <QEvent>
#include <libkdegames_export.h>
@@ -270,6 +271,7 @@
* @param trackmouse enables mouse tracking (gives mouse move events)
*/
explicit KGameMouseIO(QWidget *parent,bool trackmouse=false);
+ explicit KGameMouseIO(QGraphicsScene *parent,bool trackmouse=false);
virtual ~KGameMouseIO();
/**
Index: libkdegames/kgame/kgameio.cpp
===================================================================
--- libkdegames/kgame/kgameio.cpp (révision 619576)
+++ libkdegames/kgame/kgameio.cpp (copie de travail)
@@ -182,6 +182,17 @@
}
}
+KGameMouseIO::KGameMouseIO(QGraphicsScene *parent,bool trackmouse)
+ : KGameIO()
+{
+ if (parent)
+ {
+ //kDebug(11001) << "Mouse Event filter installed tracking=" << trackmouse << endl;
+ parent->installEventFilter(this);
+// parent->setMouseTracking(trackmouse);
+ }
+}
+
KGameMouseIO::~KGameMouseIO()
{
if (parent())
@@ -209,14 +220,19 @@
{
return false;
}
-// kDebug(11001) << "KGameMouseIO " << this << endl ;
+ //kDebug(11001) << "KGameMouseIO " << this << " " << e->type() << endl ;
// mouse action
if ( e->type() == QEvent::MouseButtonPress ||
e->type() == QEvent::MouseButtonRelease ||
e->type() == QEvent::MouseButtonDblClick ||
e->type() == QEvent::Wheel ||
- e->type() == QEvent::MouseMove
+ e->type() == QEvent::MouseMove ||
+ e->type() == QEvent::GraphicsSceneMousePress ||
+ e->type() == QEvent::GraphicsSceneMouseRelease ||
+ e->type() == QEvent::GraphicsSceneMouseDoubleClick ||
+ e->type() == QEvent::GraphicsSceneWheel ||
+ e->type() == QEvent::GraphicsSceneMouseMove
)
{
QMouseEvent *k = (QMouseEvent*)e;
Index: libkdegames/kgame/kgamepropertylist.h
===================================================================
--- libkdegames/kgame/kgamepropertylist.h (révision 619576)
+++ libkdegames/kgame/kgamepropertylist.h (copie de travail)
@@ -39,7 +39,7 @@
* Typedefs
*/
typedef QListIterator<type> Iterator;
- typedef QListConstIterator<type> ConstIterator;
+// typedef QListConstIterator<type> ConstIterator;
KGamePropertyList() :QList<type>(), KGamePropertyBase()
{
More information about the kde-games-devel
mailing list