From c90c389a8a8d9d8661e9772ec4144c5cf2039f23 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kolf/canvasitem.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 kolf/canvasitem.cpp (limited to 'kolf/canvasitem.cpp') diff --git a/kolf/canvasitem.cpp b/kolf/canvasitem.cpp new file mode 100644 index 00000000..5e39257c --- /dev/null +++ b/kolf/canvasitem.cpp @@ -0,0 +1,48 @@ +#include + +#include + +#include "game.h" +#include "canvasitem.h" + +QCanvasRectangle *CanvasItem::onVStrut() +{ + QCanvasItem *qthis = dynamic_cast(this); + if (!qthis) + return 0; + QCanvasItemList l = qthis->collisions(true); + l.sort(); + bool aboveVStrut = false; + CanvasItem *item = 0; + QCanvasItem *qitem = 0; + for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) + { + item = dynamic_cast(*it); + if (item) + { + qitem = *it; + if (item->vStrut()) + { + //kdDebug(12007) << "above vstrut\n"; + aboveVStrut = true; + break; + } + } + } + + QCanvasRectangle *ritem = dynamic_cast(qitem); + + return aboveVStrut && ritem? ritem : 0; +} + +void CanvasItem::save(KConfig *cfg) +{ + cfg->writeEntry("dummykey", true); +} + +void CanvasItem::playSound(QString file, double vol) +{ + if (game) + game->playSound(file, vol); +} + -- cgit v1.2.1