Commit ec2382dd authored by Ian Wadham's avatar Ian Wadham

Add a double-click event handler and prevent scene items from receiving mouse...

Add a double-click event handler and prevent scene items from receiving mouse clicks. This is to allow very rapid sequences of digging operations.

svn path=/branches/work/kgoldrunner-qgv/; revision=1314413
parent a3afa468
......@@ -154,6 +154,7 @@ KGameRenderedItem * KGrRenderer::getTileItem
KGameRenderedItem * tile =
new KGameRenderedItem ((keyTable[index].picSource == Set) ?
m_setRenderer : m_actorsRenderer, key);
tile->setAcceptedMouseButtons (0);
m_scene->addItem (tile);
return tile;
}
......@@ -169,6 +170,7 @@ KGrSprite * KGrRenderer::getSpriteItem (const char picType, const int tickTime)
KGrSprite * sprite = new KGrSprite ((keyTable[index].picSource == Set) ?
m_setRenderer : m_actorsRenderer,
key, picType, tickTime);
sprite->setAcceptedMouseButtons (0);
// We cannot add the sprite to the scene yet: it needs a frame and size.
return sprite;
}
......@@ -183,6 +185,7 @@ KGameRenderedItem * KGrRenderer::getBackground
QString key = getBackgroundKey (level);
KGameRenderedItem * background = new KGameRenderedItem (m_setRenderer, key);
background->setAcceptedMouseButtons (0);
m_scene->addItem (background);
return background;
......@@ -201,6 +204,7 @@ KGameRenderedItem * KGrRenderer::getBorderItem
}
KGameRenderedItem * item = new KGameRenderedItem (m_setRenderer, spriteKey);
item->setAcceptedMouseButtons (0);
m_scene->addItem (item);
return item;
}
......
......@@ -83,6 +83,11 @@ void KGrView::mousePressEvent (QMouseEvent * mouseEvent)
emit mouseClick (mouseEvent->button());
}
void KGrView::mouseDoubleClickEvent (QMouseEvent * mouseEvent)
{
emit mouseClick (mouseEvent->button());
}
void KGrView::mouseReleaseEvent (QMouseEvent * mouseEvent)
{
emit mouseLetGo (mouseEvent->button());
......
......@@ -53,6 +53,7 @@ signals:
protected:
virtual void resizeEvent (QResizeEvent *);
virtual void mousePressEvent (QMouseEvent * mouseEvent);
virtual void mouseDoubleClickEvent (QMouseEvent * mouseEvent);
virtual void mouseReleaseEvent (QMouseEvent * mouseEvent);
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment