diff options
author | Miikka Heikkinen <[email protected]> | 2023-10-06 17:46:25 +0300 |
---|---|---|
committer | Miikka Heikkinen <[email protected]> | 2023-10-10 08:25:17 +0000 |
commit | 32b68b296a862bcfd1c17f2bf1a5765043dd6fe3 (patch) | |
tree | 21da7823464f6b0abe989c2ccd8932c9c4995c6e /src/libs/qmlpuppetcommunication | |
parent | 55039d69750396086eb7e9b50833a984c8fb3cf9 (diff) |
QmlDesigner: Add enter and leave event support to 3D view
Fixes: QDS-10917
Change-Id: Iefcf92bd4a747d35f44e47c438548338fccfc4a2
Reviewed-by: Mahmoud Badri <[email protected]>
Reviewed-by: Qt CI Patch Build Bot <[email protected]>
Diffstat (limited to 'src/libs/qmlpuppetcommunication')
-rw-r--r-- | src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp | 17 | ||||
-rw-r--r-- | src/libs/qmlpuppetcommunication/commands/inputeventcommand.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp index 0dc669406af..2ba1a651228 100644 --- a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp +++ b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp @@ -10,10 +10,16 @@ namespace QmlDesigner { InputEventCommand::InputEventCommand() = default; -InputEventCommand::InputEventCommand(QInputEvent *e) - : m_type(e->type()), - m_modifiers(e->modifiers()) +InputEventCommand::InputEventCommand(QEvent *e) + : m_type(e->type()) { + // Leave events are not actual input events + if (m_type == QEvent::Leave) + return; + + auto ie = static_cast<QInputEvent *>(e); + m_modifiers = ie->modifiers(); + if (m_type == QEvent::Wheel) { auto we = static_cast<QWheelEvent *>(e); #if QT_VERSION <= QT_VERSION_CHECK(5, 15, 0) @@ -28,6 +34,11 @@ InputEventCommand::InputEventCommand(QInputEvent *e) m_key = ke->key(); m_count = ke->count(); m_autoRepeat = ke->isAutoRepeat(); + } else if (m_type == QEvent::Enter) { + auto spe = static_cast<QSinglePointEvent *>(e); + m_pos = spe->position().toPoint(); + m_button = spe->button(); + m_buttons = spe->buttons(); } else { auto me = static_cast<QMouseEvent *>(e); m_pos = me->pos(); diff --git a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h index e0a220cd693..7cd2c898fe4 100644 --- a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h +++ b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h @@ -18,7 +18,7 @@ class InputEventCommand public: InputEventCommand(); - explicit InputEventCommand(QInputEvent *e); + explicit InputEventCommand(QEvent *e); QEvent::Type type() const { return m_type; } QPoint pos() const { return m_pos; } |