How can i grab position of mouse in my application, and how can hide or show mouse.
How can i grab position of mouse in my application, and how can hide or show mouse.
QCursor
Note that Qt::CursorShape enum includes Qt::BlankCursor value.
you can reimplement QWidget's mouseMoveEvent(QMouseEvent *event) and get the current position of the mouse.How can i grab position of mouse in my application
You can use QWidget::setCursor() to change the shape of your cursor.how can hide or show mouse.
This shows the various shapes that you can change your cursor to.
Use BlankCursor to hide and ArrowCursor to show.
Mithin
www.mithin.in
safknw (25th November 2006)
Or simply use QCursor::pos(), if you want to know only the current mouse position.
I want to limit mouse's position within main windows my application, how I can do this?
for limiting the mouse in a window -
1) Convert mouse position from global to window position (use mapFromGlobal())
2) check if that position lies within the window geometry ( Qwidget->geometry())
using these u can limit the movement
hope this helps
Do you mean you want to show mouse cursor only in the main window and hide it in all other windows ?I want to limit mouse's position within main windows my application, how I can do this?
Mithin
www.mithin.in
You might need to do the following.
1. Change the cursor to blank cursor for all the widgets that you don't want to show the cursor for.
2. Reimplement mousePressEvent and mouseReleaseEvent of these widgets and do not let the event propagate.
hmmm, I think there should definitely be a better way to achieve this, but cannot think of any right now.
Mithin
www.mithin.in
Is there a way to get the local coords when using GraphicsView? like perhaps scene coords relative to current view?
QWidget, QGraphicsView and QGraphicsItem all have lots of mapFrom() and mapTo() methods.
J-P Nurmi
Bookmarks