Commit 65a050d1 authored by Rafael Rosseto's avatar Rafael Rosseto Committed by Albert Astals Cid

Reveal cells by clicking on numbers

Added a new condition to emulate mid mouse buttom(left click on an open cell), this feature will allow the user to reveal cells by clicking on an already revealed number cell, which can be handy if the player is using a touchpad and/or a mouse without scroll button.
parent 009c55f1
......@@ -38,6 +38,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_ExploreWithLeftClickOnNumberCells">
<property name="text">
<string>Explore with Left Click on Number Cells</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
......@@ -17,6 +17,10 @@
<label></label>
<default>false</default>
</entry>
<entry name="ExploreWithLeftClickOnNumberCells" type="Bool" key="explore_with_left_click_on_number_cells">
<label>Left click on a number cell will have the same effect as mid click.</label>
<default>false</default>
</entry>
</group>
<group name="Options">
<entry name="CustomWidth" type="Int" key="custom width">
......
......@@ -25,6 +25,8 @@
#include "cellitem.h"
#include "borderitem.h"
#include "settings.h"
MineFieldItem::MineFieldItem(KGameRenderer* renderer)
: m_leftButtonPos(-1,-1), m_midButtonPos(-1,-1), m_gameOver(false),
m_emulatingMidButton(false), m_renderer(renderer)
......@@ -349,7 +351,8 @@ void MineFieldItem::mousePressEvent( QGraphicsSceneMouseEvent *ev )
return;
}
m_emulatingMidButton = ( (ev->buttons() & Qt::LeftButton) && (ev->buttons() & Qt::RightButton) );
bool useFastExplore = Settings::exploreWithLeftClickOnNumberCells();
m_emulatingMidButton = ( useFastExplore ? ( (ev->buttons() & Qt::LeftButton) && ( itemUnderMouse->isRevealed() ) ) : ( (ev->buttons() & Qt::LeftButton) && (ev->buttons() & Qt::RightButton) ) );
bool midButtonPressed = (ev->button() == Qt::MidButton || m_emulatingMidButton );
if(midButtonPressed)
......
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