Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Event Problems caused by qCursor::setPos
Forum Updated to NodeBB v4.3 + New Features

Event Problems caused by qCursor::setPos

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    geforcefan
    wrote on last edited by
    #1

    Hello Guys,

    I posted this problem also on another forum. After that, I thought it could be better to ask on an official qt forum.

    I am developing since few months a CAD application based on OpenGL view and camera perspective. Since finishing my camera implementation, there is a bug in my code, but did´t fixed it due its low priority.
    After finishing most of my core development, I decided to fix the bug.

    So here is my Problem:

    To move arround the camera with the mouse movement, I am doing "installEventFilter()" on the Main Window, and pass those events in my camera event handler.
    During the mousemovement event, I am calculating the offset of movement by substracting currentCursorPosition with lastCursorPosition and set the position of the cursor to {x=widgetWidth/2, y=widgetHeight/2}, that the cursor stay in the center of widget.

    While I am moving my cursor, there is no keypress/release (or other input event) events passed. I figured out, that using the qCursor::setPos method causes a "losing the event focus or whatever". Because of this "event losing in that moment I set a new cursor position" stuff, I cant move my camera with the keyboard by pressing the WASD Keys and moving with my mouse arround.

    Do you have similar experience and probably solutions? Do I have a concept fail? Is there a better implementation?

    Currently, I am at my working station. On request, I am going to post some parts of my source code.

    • Ercan
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved