mouseevent

PyQt4: QGraphicsItem mousePressEvent() disables flag ItemIsMovable

試著忘記壹切 提交于 2020-02-05 13:38:52
问题 Here's a bug which I accidently solved it and have no idea why that works. I hope that someone could explain to me the logics behind it. I've reimplmented QGraphicsItem and its mousePressEvent. By doing that the item was no longer movable. Even when trying to call QGraphicsItem.mousePressEvent(self, event) it didn't work. Only when I reimplmented mouseMoveEvent() and mouseReleaseEvent() it finally worked. Code: class LWResizeableItem(QtGui.QGraphicsItem): def __init__(self): super

Mouse handling: printing pixel location

帅比萌擦擦* 提交于 2020-02-01 08:45:50
问题 I've been trying to do some work with OpenCV in VS2010, specifically in the area of mouse handling. So far, I have this: CV_EVENT_LBUTTONDOWN :drawing_line = true; cvLine( frame, cvPoint(x,y),cvPoint(350,500), CV_RGB(255,0,0), CV_AA, 15,0 ); fprintf( stdout, "Point found. %i, %i \n", object_x0, object_y0 ); break; What I want it to do is return the location of the pixels that I clicked on but all it returns is "Point found. 0,0" instead of the actual location. Eventually, I would like to use

How to display a message next to the mouse when on mousePressed event in swing?

安稳与你 提交于 2020-01-26 04:57:11
问题 I am trying to display a text box next to the mouse whenever it is clicked in a GUI. The same idea when you hover your mouse over a link on the internet, it shows a preview as a small popup bubble. I would like to have it when clicked. 回答1: Here is an example for you: import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Popup; import javax.swing.PopupFactory; import javax.swing

LWJGL Display mounted on Canvas fails to generate Mouse Events

社会主义新天地 提交于 2020-01-25 23:56:13
问题 My ultimate goal is to be able to make use of additional mouse buttons in Java. Currently, LWJGL's JInput doesn't seem capable of detecting more than three buttons. To make use of Java's System.setProperty("sun.awt.enableExtraMouseButtons", "true"), I've tried mounting the Display onto an AWT Canvas, within a JFrame. Unfortunately, this does not appear to work, and I am unsure why. [I should note that I've been away from Java for a some time] import java.awt.Canvas; import java.awt.event

Shape position wont redraw when dragged with mouse

有些话、适合烂在心里 提交于 2020-01-25 23:47:31
问题 I have a filled circle drawn on a canvas and I'm trying to get it to move based on a click and drag method with the mouse. I've managed to checked whether the mouse pointer is within the bounds of the circle, and when I drag the mouse, the variable storing the position of the circle updates as it should, but the circle itself is not redrawing as I'm dragging (the most it will do is flicker). My problem is at the end where I'm overriding mouseDragged() . getCanvas().addMouseListener(new

mouse event still fired on touch event even with preventDefault set

ε祈祈猫儿з 提交于 2020-01-24 22:35:27
问题 is there anything I misunderstood here? I often use code like the following in my site that I want to work either for desktop and iPad device: $("#someElement") .on( "mousemove", function(e) { alert ( "I am still here" ); // undesired code for ipad here } ) .on( "touchmove", function(e) { e.preventDefault(); // only desired code for ipad use here } ); I read in many places that the e.preventDefault should kill the mouse events attached. And that the touch events are elaborated in the first

Getting shift/ctrl/alt states from a mouse event?

会有一股神秘感。 提交于 2020-01-21 06:18:25
问题 In my WPF App, how do I get the state of the shift , ctrl and alt keys in my mouse event handler? I seem to remember in MFC you could get that information from the mouse event. 回答1: Assuming that you're still in the mouse event handler, you can check the value of Keyboard.Modifiers. I don't think that there is anyway to get modifier information from the event itself, so you have to interrogate the keyboard directly. 回答2: As per Andy's answer, you use Keyboard.Modifiers. I figured I would post

getting a mouseenter event from a still mouse entering an animated element

喜你入骨 提交于 2020-01-17 06:19:32
问题 I'm writing a image carousel and due to some class adding/removing my css pointer as well as my mouseenter event don't seem to work properly. $("img", ":not(.active)").on("click", function() { var $this = $(this); $("img").removeClass("active"); $this.addClass("active"); goto($this.index()); }); $("img").on("mouseenter", function() { console.log("silence"); }); function goto(i) { $(".images").animate({ left: 55-i*310 }); } http://jsfiddle.net/rnfkqq6s/3/ please take a look at the fiddle and