Added special check for tools those use free click.

When a user click on point the app show line between selected point and a mouse
cursor. This usefull when need to select an angle or length. But because
selection of a point also emit release event this particular event should be
ignored. In case of release inside of point circle all worked good, but not if
select point by label.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-29 13:09:49 +03:00
parent ebda4292a8
commit 33da692248
8 changed files with 59 additions and 7 deletions

View File

@ -56,8 +56,11 @@
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), formulaAngle(QString()),
formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogCurveIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -191,6 +194,14 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -88,6 +88,8 @@ private:
QString formulaAngle;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGCURVEINTERSECTAXIS_H

View File

@ -62,8 +62,13 @@
* @param parent parent widget
*/
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine),
formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogEndLine),
formulaLength(),
formulaAngle(),
formulaBaseHeight(0),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -298,6 +303,14 @@ void DialogEndLine::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if pointer is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -110,6 +110,8 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGENDLINE_H

View File

@ -60,8 +60,11 @@
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), formulaAngle(QString()),
formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogLineIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -220,6 +223,14 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -92,6 +92,8 @@ private:
QString formulaAngle;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGLINEINTERSECTAXIS_H

View File

@ -72,7 +72,8 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
formulaBaseHeightAngle(0),
objects(),
stage1(true),
m_suffix()
m_suffix(),
m_firstRelease(false)
{
ui->setupUi(this);
@ -200,6 +201,14 @@ void DialogRotation::ShowDialog(bool click)
}
else if (not stage1 && prepare && click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if pointer is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -109,6 +109,8 @@ private:
QString m_suffix;
bool m_firstRelease;
void EvalAngle();
};