mouse

Qt mouseMoveEvent only when left mouse button is pressed

倾然丶 夕夏残阳落幕 提交于 2020-01-03 13:00:51
问题 I currently have a program that draws lines and rectangles. void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); I use mouseMoveEvent to draw temporary preview of a line and when i release i draw the actual line. What I would like to know is how can i make mouseMoveEvent work work only when i have the left mouse button pressed down. I tried the following but then the whole function stops working. void mouseMoveEvent

Logging application wide mouse clicks in Delphi

笑着哭i 提交于 2020-01-03 05:38:05
问题 I am trying to track and log what a user does in my app. One way to help is to have a list of what buttons and menu etc they click as they use the program. Then if the program crashes for any reason I have a log of the exact steps they took to try and reproduce the issue. So I drop an ApplicationEvents component on the main form and then under OnMessage I use... procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;var Handled: Boolean); var Target: TControl; Point: TPoint; begin Handled

Show converted mouse coordinates of an element with javascript

左心房为你撑大大i 提交于 2020-01-03 03:24:28
问题 I'd like to show a mouse tooltip like this: with a coordinate system relative to its image. Whenever the mouse is hovered over one of the 75x75 cells, the position is displayed in text. I can only show the mouse's raw coordinates, but can't figure out the math to display it like it is in the picture. I'm open to HTML5 implementations as well. 回答1: Here’s how to convert mouse coordinates to cell coordinates and display a tooltip This math calculates which 75x75 cell your mouse is inside: var

Moving mouse to stop monitor from sleeping [duplicate]

浪子不回头ぞ 提交于 2020-01-02 10:22:22
问题 This question already has answers here : How to prevent Windows from entering idle state? (5 answers) Closed 5 years ago . I want to stop my monitor to stop sleep (which is driven by company policies). Below is the code I am using for that while (true) { this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); Cursor.Clip = new Rectangle(this.Location, this.Size); System.Threading.Thread.Sleep(2000); this.Cursor = new Cursor

Can't see mouse and keyboard device with usbManager android

 ̄綄美尐妖づ 提交于 2020-01-02 10:04:13
问题 I work on a project where I need get data of keyboard and mouse on a service. I also have to be able to send data to my device hid. To do this, I want use the usb host mode. When I get list of device, I can see a mass storage but no mouse and keyboard. After search, I have seen that usbManager don't return mouse and keyboard device. I have tried to change permissions (on /system/etc/permissions) whitout success). I have run the application USB Device Info and I see mouse and keyboard on linux

Ignore mouse and keyboard events in Qt

随声附和 提交于 2020-01-01 02:34:08
问题 In Qt, how can I ignore all mouse and keyboard events and later stop ignoring them? That is: click a button, ignore all events in children; click again, not ignore. Is that clear? I have the following lines, but maybe I'm doing something wrong: setAttribute(Qt::WA_TransparentForMouseEvents); setFocusPolicy(Qt::NoFocus); 回答1: Dont use setFocusPolicy(Qt::NoFocus); and it will propagate events to the parent. Use only setAttribute(Qt::WA_TransparentForMouseEvents); 回答2: You can use Events'

Detecting a Mouse Click Anywhere on Screen with Java

非 Y 不嫁゛ 提交于 2019-12-31 05:15:10
问题 Is it possible to detect a mouse click anywhere on a screen, outside of my application? I have written an application to do this in C#, but would like to write a version of this in Java so that it can be run on several platforms. It looks like I can get the co-ordinates of the mouse at any time with java.awt.MouseInfo.getPointerInfo() but I am not sure as to how to listen for a mouse click. In C# I used GetAsyncKeyState to detect whether the mouse button was clicked, but obviously I cannot

Move a window on keypress + mouse (like linux ALT + mouse down)

时间秒杀一切 提交于 2019-12-31 04:43:48
问题 Simple, i want to move a windows pressing ALT+MOUSE, like linux os (ALT+drag). It's possible to pass a win32 api (move api) to the windows interested clicking on it? I have a windows services that hook key pressed (ALT button in specific). When ALT key is pressed and a mouse down event is verified, i want to move window clicking anywhere, not only on the title bar! Currently i move my form windows in this way: using System.Runtime.InteropServices; [DllImport( "user32.dll", CharSet = CharSet

Mouse speed not changing by using SPI_SETMOUSESPEED

烈酒焚心 提交于 2019-12-31 04:38:10
问题 Why mouse speed is not changing after execution of the following program ? Is it due to SPI_SETMOUSESPEED or due to unable to change the winini file by SPIF_UPDATEINIFILE , SPIF_SENDCHANGE and SPIF_SENDCHANGE parameters ? Compiler : g++ , OS : Windows 8 . #include <iostream> #include <windows.h> #include<winuser.h> #pragma comment(lib, "user32.lib") using namespace std ; int main() { int i = 0 , *MouseSpeed = &i ; bool x ; // Retrieving the mouse speed . x = SystemParametersInfo( SPI

I cannot access Position of the cursor (move mouse programatically)

这一生的挚爱 提交于 2019-12-31 04:13:14
问题 this is my code: private void MoveCursor(int x, int y) { // Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. System.Windows.Forms.Cursor cursorMouse = new System.Windows.Forms.Cursor(System.Windows.Forms.Cursor.Current.Handle); cursorMouse.Position = new System.Drawing.Point(x, y); System.Windows.Forms.Cursor.Clip = new System.Drawing.Rectangle(cursorMouse.Position, cursorMouse.Size); } This is what my console says: Error 11 Member 'System