[Kde-games-devel] KMahjongg frameworks branch

Frederik Schwarzer schwarzer at kde.org
Mon Nov 30 00:36:39 UTC 2015


Hi Ian,

since you are familiar with the QGraphics stuff...
When I removed KDELibs4Support (some functionality just commented out 
so not ready for business) QGraphicsScene broke.
    itemAt(qreal, qreal)
is now deprecated, so I had to use
    itemAt(qreal, qreal, const QTransform&)
and I do not know how to use this properly.
Now I just added QTransform() as the third parameter and it seems to 
work. Although, if this had been a no-brainer for the Qt devs, it 
would have become a default parameter, I guess. So I would like to 
hear your opinion on this. This overload exists in Qt 4.8 so you 
should be able to play around with it.

Regards,
Frederik

diff --git a/GameScene.cpp b/GameScene.cpp
index 39d7743..f1cf2dd 100644
--- a/GameScene.cpp
+++ b/GameScene.cpp
@@ -191,7 +191,7 @@ bool GameScene::isSelectable(const GameItem * 
const pGameItem) const
 void GameScene::mousePressEvent(QGraphicsSceneMouseEvent * 
pMouseEvent)
 {
     GameItem * pGameItem = dynamic_cast <GameItem 
*>(itemAt(pMouseEvent->scenePos().x(),
-        pMouseEvent->scenePos().y()));
+        pMouseEvent->scenePos().y(), QTransform()));
 
     // No item was clicked.
     if (pGameItem != NULL) {
@@ -200,7 +200,7 @@ void 
GameScene::mousePressEvent(QGraphicsSceneMouseEvent * pMouseEvent)
         if (pGameItem->isShadow(pMouseEvent->scenePos() - pGameItem-
>pos())) {
             pGameItem = dynamic_cast <GameItem *>(itemAt(pMouseEvent-
>scenePos().x() +
                 pGameItem->getShadowDeltaX(), pMouseEvent-
>scenePos().y() +
-                pGameItem->getShadowDeltaY()));
+                pGameItem->getShadowDeltaY(), QTransform()));
         }
     }
 



More information about the kde-games-devel mailing list