4#include <QtCore/private/qohoscommon_p.h>
6#include <render/qohoshovereventsgenerator.h>
19 QtOhos::QThreadSafeRef<QWindow> qWindowRef,
20 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef);
26 void sendQtHoverEvent(
bool isHover);
28 QtOhos::QThreadSafeRef<QWindow> m_qWindowRef;
29 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> m_imEventHandlerRef;
31 std::optional<QPointF> m_optCurrentLocalPosition;
32 std::optional<QPointF> m_optCurrentGlobalPosition;
37 QtOhos::QThreadSafeRef<QWindow> qWindowRef,
38 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef)
47 m_optCurrentLocalPosition = mouseEvent.localPosition;
48 m_optCurrentGlobalPosition = mouseEvent.globalPosition;
51 sendQtHoverEvent(
true);
58 const auto localPosition = m_optCurrentLocalPosition.value_or(fallbackLocalPositionWhenUnknown);
59 const auto globalPosition = m_optCurrentGlobalPosition.value_or(fallbackGlobalPositionWhenUnknown);
61 m_imEventHandlerRef.visitInQtThreadIfAlive(
62 [isHover, localPosition, globalPosition, qWindowRef = m_qWindowRef](QOhosInputMethodEventHandler &imEventHandler) {
63 QWindow *qWindow = qWindowRef.data();
64 if (qWindow !=
nullptr) {
65 imEventHandler.onHoverEvent(
67 .targetWindow = qWindow,
68 .localPosition = localPosition,
69 .globalPosition = globalPosition,
78 if (!hovered && m_hovered) {
79 sendQtHoverEvent(
false);
91 QtOhos::QThreadSafeRef<QWindow> qWindowRef,
92 QtOhos::QThreadSafeRef<QOhosInputMethodEventHandler> imEventHandlerRef)
94 return std::make_shared<QOhosHoverEventsGeneratorImpl>(qWindowRef, imEventHandlerRef);
virtual ~QOhosHoverEventsGenerator()
QOhosHoverEventsGenerator()
void handleQOhosMouseEvent(const QOhosMouseEvent &mouseEvent) override
QOhosHoverEventsGeneratorImpl(QtOhos::QThreadSafeRef< QWindow > qWindowRef, QtOhos::QThreadSafeRef< QOhosInputMethodEventHandler > imEventHandlerRef)
void handleQOhosHoverEvent(bool hovered) override
Combined button and popup list for selecting options.
const QPointF fallbackGlobalPositionWhenUnknown
const QPointF fallbackLocalPositionWhenUnknown
std::shared_ptr< QOhosHoverEventsGenerator > makeQOhosHoverEventsGenerator(QtOhos::QThreadSafeRef< QWindow > qWindowRef, QtOhos::QThreadSafeRef< QOhosInputMethodEventHandler > imEventHandlerRef)