I have added event filter which identify the wheel up/down and based on that I have manage to increase the 5 using setting variable m_pickPoint in the event and it work for normal condition.
if (sqrt( pow( (m_mark->xValue() - pos.x()), 2 )) <= m_pickPoint || sqrt( pow( (m_mark->yValue() - pos.y()), 2 )) <=m_pickPoint )
if (sqrt( pow( (m_mark->xValue() - pos.x()), 2 )) <= m_pickPoint || sqrt( pow( (m_mark->yValue() - pos.y()), 2 )) <=m_pickPoint )
To copy to clipboard, switch view to plain text mode
So here I'm unable to understand at what factor I should increase or decrease the value m_pickPoint, so that the above logic work properly and pick the exact line.
if(we->angleDelta().y()>0)
{
m_pickPoint = m_pickPoint + m_pickPoint*0.05;
qDebug()<<"Position"<<m_pickPoint;
}
else
{
m_pickPoint = m_pickPoint - m_pickPoint*0.05;
qDebug()<<"Negative"<<m_pickPoint;
}
case QEvent::Wheel:
QWheelEvent* we = static_cast<QWheelEvent*>(e);
if(we->angleDelta().y()>0)
{
m_pickPoint = m_pickPoint + m_pickPoint*0.05;
qDebug()<<"Position"<<m_pickPoint;
}
else
{
m_pickPoint = m_pickPoint - m_pickPoint*0.05;
qDebug()<<"Negative"<<m_pickPoint;
}
To copy to clipboard, switch view to plain text mode
Please provide your solution, where as this above solution looks kind of dirty, so if their is some elegant solution then please suggest.
Bookmarks