Mouse Hover Problem Sporadically
-
Hi,
That does not help much more.
You need to provide a clear explanation about what you do, what is happening and what you expect.
Also, reduce your code to the bare minimal so you can provide a minimal compilable example.
Also, post your code between coding tags, that will make it readable unlike the first post in this thread (you can edit it to fix it).
About that code, beside some Qt types here and there, it looks like you either are using some native functionality or some other framework. That's the kind of stuff that you should explain.
-
As already requested, provide a minimal compilable example that shows your issue.
Nobody can help you with the small amount of information you gave.
-
code for mousepress
bool EventHandler::handleMousePressEvent(QPointF pos, Qt::MouseButton mouseButton)
{
std::shared_ptr<EventInfo> pEventInfo = nullptr;m_bMousePressed = true; m_bMouseMoveReleased = false; m_timerTap.start(); // Used incase of mouseMove event, to trigger Up event when the mouse pressed is moved outside screen item boundary. m_mousePressedPos = pos; if (getEventInfo(EventInfo::RHEventId::Down, pos, pEventInfo, mouseButton)) { TRACE_OUT_F(F::EVENT_HANDLER, _MF("EventInfo is updated with point = %1 , point.y =%2, pEventInfo->m_nElementId = %3") << pos.x() << pos.y() << pEventInfo->m_nElementId); m_pScreenObjectVisualProxy->onTriggerMouseEvent(pEventInfo); TRACE_OUT_F(F::EVENT_HANDLER, _M("Event Triggered: Down")); return true; } return false;}
-
code for mouse release
bool EventHandler::handleMouseReleaseEvent(QPointF pos, Qt::MouseButton mouseButton)
{
bool bRet = false;
std::shared_ptr<EventInfo> pEventInfo = nullptr;
// After the right/left mouse button has been released then the system triggers "up" event.
if (!m_bMouseMoveReleased)
{
if (getEventInfo(EventInfo::RHEventId::Up, pos, pEventInfo, mouseButton))
{
m_pScreenObjectVisualProxy->onTriggerMouseEvent(pEventInfo);
TRACE_OUT_F(F::EVENT_HANDLER, _M("Event Triggered: Up"));
m_bMousePressed = false;
m_bMouseMoveReleased = true;
m_timerTap.elapsed();
bRet = true;
}
}
else if (m_bMousePressed)
{
pEventInfo.reset();
pEventInfo = nullptr;
// IF the left left button is released within 1000 ms , tapped event will be triggered.
// else context tapped will be triggered.
// If the right button release is released irrespective of the time, context tapped event will be triggered.
if ((mouseButton == Qt::LeftButton) && (m_timerTap.elapsed() < TAP_THRESHOLD_TIME) &&
getEventInfo(EventInfo::RHEventId::Tapped, pos, pEventInfo, mouseButton))
{
m_pScreenObjectVisualProxy->onTriggerMouseEvent(pEventInfo);
TRACE_OUT_F(F::EVENT_HANDLER, _M("Event Triggered: Mouse Tapped"));
bRet = true;
}
// After the right/left mouse button has been released then the system triggers "ContextTapped".
else if ((mouseButton == Qt::RightButton || mouseButton == Qt::LeftButton) &&
getEventInfo(EventInfo::RHEventId::ContextTapped, pos, pEventInfo, mouseButton))
{
m_pScreenObjectVisualProxy->onTriggerMouseEvent(pEventInfo);
TRACE_OUT_F(F::EVENT_HANDLER, _M("Event Triggered: Mouse Context Tapped"));
bRet = true;
}m_bMousePressed = false; } return bRet;}
-
Can you please provide what was requested and not some snippet of code from your application ?
-
Do you realize that we are running in circles ?
I have already asked you several time to provide a minimal compilable example that shows your issue.
-
void DFQuickItem::hoverEnterEvent(QHoverEvent* pEvent)
{
if ((pEvent == nullptr) || (nullptr == m_pEventHandler))
{
TRACE_OUT_F(F::INFO, _M("pEvent or m_pEventHandler is nullptr "));
return;
}if (!m_pEventHandler->handleHoverEnterEvent(pEvent->pos())) { TRACE_OUT_F(F::INFO, _M("hoverEnter Event is not present for Rete element " "at position x: %1 y: %2") << pEvent->pos().x() << pEvent->pos().y()); }}
-
void DFQuickItem::hoverEnterEvent(QHoverEvent* pEvent)
{
if ((pEvent == nullptr) || (nullptr == m_pEventHandler))
{
TRACE_OUT_F(F::INFO, _M("pEvent or m_pEventHandler is nullptr "));
return;
}if (!m_pEventHandler->handleHoverEnterEvent(pEvent->pos())) { TRACE_OUT_F(F::INFO, _M("hoverEnter Event is not present for Rete element " "at position x: %1 y: %2") << pEvent->pos().x() << pEvent->pos().y()); }}