~ubuntu-branches/ubuntu/raring/python-qt4/raring-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMouseEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMouseEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QMouseEvent class contains parameters that describe a mouse
event. <a href="#details">More...</a></p>

<p>Inherits <a href="qinputevent.html">QInputEvent</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmouseevent.html#QMouseEvent">__init__</a></b> (<i>self</i>, QEvent.Type&#160;<i>type</i>, QPoint&#160;<i>pos</i>, Qt.MouseButton&#160;<i>button</i>, Qt.MouseButtons&#160;<i>buttons</i>, Qt.KeyboardModifiers&#160;<i>modifiers</i>)</li><li><div class="fn" /><b><a href="qmouseevent.html#QMouseEvent-2">__init__</a></b> (<i>self</i>, QEvent.Type&#160;<i>type</i>, QPoint&#160;<i>pos</i>, QPoint&#160;<i>globalPos</i>, Qt.MouseButton&#160;<i>button</i>, Qt.MouseButtons&#160;<i>buttons</i>, Qt.KeyboardModifiers&#160;<i>modifiers</i>)</li><li><div class="fn" /><b><a href="qmouseevent.html#QMouseEvent-3">__init__</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" />Qt.MouseButton <b><a href="qmouseevent.html#button">button</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.MouseButtons <b><a href="qmouseevent.html#buttons">buttons</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qmouseevent.html#globalPos">globalPos</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qmouseevent.html#globalX">globalX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qmouseevent.html#globalY">globalY</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmouseevent.html#hasExtendedInfo">hasExtendedInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qmouseevent.html#pos">pos</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qmouseevent.html#posF">posF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qmouseevent.html#x">x</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qmouseevent.html#y">y</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QMouseEvent class contains parameters that describe a mouse
event.</p>
<p>Mouse events occur when a mouse button is pressed or released
inside a widget, or when the mouse cursor is moved.</p>
<p>Mouse move events will occur only when a mouse button is pressed
down, unless mouse tracking has been enabled with <a href="qwidget.html#mouseTracking-prop">QWidget.setMouseTracking</a>().</p>
<p>Qt automatically grabs the mouse when a mouse button is pressed
inside a widget; the widget will continue to receive mouse events
until the last mouse button is released.</p>
<p>A mouse event contains a special accept flag that indicates
whether the receiver wants the event. You should call <a href="qevent.html#ignore">ignore</a>() if the mouse event is not handled
by your widget. A mouse event is propagated up the parent widget
chain until a widget accepts it with <a href="qevent.html#accept">accept</a>(), or an event filter consumes
it.</p>
<p><b>Note:</b> If a mouse event is propagated to a <a href="qwidget.html">widget</a> for which <a href="qt.html#WidgetAttribute-enum">Qt.WA_NoMousePropagation</a> has
been set, that mouse event will not be propagated further up the
parent widget chain.</p>
<p>The state of the keyboard modifier keys can be found by calling
the <a href="qinputevent.html#modifiers">modifiers()</a> function,
inherited from <a href="qinputevent.html">QInputEvent</a>.</p>
<p>The functions <a href="qmouseevent.html#pos">pos</a>(), <a href="qmouseevent.html#x">x</a>(), and <a href="qmouseevent.html#y">y</a>() give the cursor position relative to
the widget that receives the mouse event. If you move the widget as
a result of the mouse event, use the global position returned by
<a href="qmouseevent.html#globalPos">globalPos</a>() to avoid a
shaking motion.</p>
<p>The <a href="qwidget.html#enabled-prop">QWidget.setEnabled</a>() function can
be used to enable or disable mouse and keyboard events for a
widget.</p>
<p>Reimplement the <a href="qwidget.html">QWidget</a> event
handlers, <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>(),
<a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>(),
<a href="qwidget.html#mouseDoubleClickEvent">QWidget.mouseDoubleClickEvent</a>(),
and <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>() to
receive mouse events in your own widgets.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMouseEvent" />QMouseEvent.__init__ (<i>self</i>, <a href="qevent.html#Type-enum">QEvent.Type</a>&#160;<i>type</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-mousebuttons.html">Qt.MouseButtons</a>&#160;<i>buttons</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifiers</i>)</h3><p>Constructs a mouse event object.</p>
<p>The <i>type</i> parameter must be one of <a href="qevent.html#Type-enum">QEvent.MouseButtonPress</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonRelease</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonDblClick</a>, or
<a href="qevent.html#Type-enum">QEvent.MouseMove</a>.</p>
<p>The <i>position</i> is the mouse cursor's position relative to
the receiving widget. The <i>button</i> that caused the event is
given as a value from the <a href="qt.html#MouseButton-enum">Qt.MouseButton</a> enum. If the event
<i>type</i> is <a href="qevent.html#Type-enum">MouseMove</a>, the
appropriate button for this event is <a href="qt.html#MouseButton-enum">Qt.NoButton</a>. The mouse and keyboard
states at the time of the event are specified by <i>buttons</i> and
<i>modifiers</i>.</p>
<p>The <a href="qmouseevent.html#globalPos">globalPos</a>() is
initialized to <a href="qcursor.html#pos">QCursor.pos</a>(), which
may not be appropriate. Use the other constructor to specify the
global position explicitly.</p>


<h3 class="fn"><a name="QMouseEvent-2" />QMouseEvent.__init__ (<i>self</i>, <a href="qevent.html#Type-enum">QEvent.Type</a>&#160;<i>type</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, <a href="qpoint.html">QPoint</a>&#160;<i>globalPos</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-mousebuttons.html">Qt.MouseButtons</a>&#160;<i>buttons</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifiers</i>)</h3><p>Constructs a mouse event object.</p>
<p>The <i>type</i> parameter must be <a href="qevent.html#Type-enum">QEvent.MouseButtonPress</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonRelease</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonDblClick</a>, or
<a href="qevent.html#Type-enum">QEvent.MouseMove</a>.</p>
<p>The <i>pos</i> is the mouse cursor's position relative to the
receiving widget. The cursor's position in global coordinates is
specified by <i>globalPos</i>. The <i>button</i> that caused the
event is given as a value from the <a href="qt.html#MouseButton-enum">Qt.MouseButton</a> enum. If the event
<i>type</i> is <a href="qevent.html#Type-enum">MouseMove</a>, the
appropriate button for this event is <a href="qt.html#MouseButton-enum">Qt.NoButton</a>. <i>buttons</i> is the
state of all buttons at the time of the event, <i>modifiers</i> the
state of all keyboard modifiers.</p>


<h3 class="fn"><a name="QMouseEvent-3" />QMouseEvent.__init__ (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><h3 class="fn"><a name="button" /><a href="qt.html#MouseButton-enum">Qt.MouseButton</a> QMouseEvent.button (<i>self</i>)</h3><p>Returns the button that caused the event.</p>
<p>Note that the returned value is always <a href="qt.html#MouseButton-enum">Qt.NoButton</a> for mouse move
events.</p>
<p><b>See also</b> <a href="qmouseevent.html#buttons">buttons</a>()
and <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>.</p>


<h3 class="fn"><a name="buttons" /><a href="qt-mousebuttons.html">Qt.MouseButtons</a> QMouseEvent.buttons (<i>self</i>)</h3><p>Returns the button state when the event was generated. The
button state is a combination of <a href="qt.html#MouseButton-enum">Qt.LeftButton</a>, <a href="qt.html#MouseButton-enum">Qt.RightButton</a>, <a href="qt.html#MouseButton-enum">Qt.MidButton</a> using the OR operator.
For mouse move events, this is all buttons that are pressed down.
For mouse press and double click events this includes the button
that caused the event. For mouse release events this excludes the
button that caused the event.</p>
<p><b>See also</b> <a href="qmouseevent.html#button">button</a>()
and <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>.</p>


<h3 class="fn"><a name="globalPos" /><a href="qpoint.html">QPoint</a> QMouseEvent.globalPos (<i>self</i>)</h3><p>Returns the global position of the mouse cursor <i>at the time
of the event</i>. This is important on asynchronous window systems
like X11. Whenever you move your widgets around in response to
mouse events, globalPos() may differ a lot from the current pointer
position <a href="qcursor.html#pos">QCursor.pos</a>(), and from
QWidget.mapToGlobal(<a href="qmouseevent.html#pos">pos</a>()).</p>
<p><b>See also</b> <a href="qmouseevent.html#globalX">globalX</a>()
and <a href="qmouseevent.html#globalY">globalY</a>().</p>


<h3 class="fn"><a name="globalX" />int QMouseEvent.globalX (<i>self</i>)</h3><p>Returns the global x position of the mouse cursor at the time of
the event.</p>
<p><b>See also</b> <a href="qmouseevent.html#globalY">globalY</a>()
and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="globalY" />int QMouseEvent.globalY (<i>self</i>)</h3><p>Returns the global y position of the mouse cursor at the time of
the event.</p>
<p><b>See also</b> <a href="qmouseevent.html#globalX">globalX</a>()
and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="hasExtendedInfo" />bool QMouseEvent.hasExtendedInfo (<i>self</i>)</h3><h3 class="fn"><a name="pos" /><a href="qpoint.html">QPoint</a> QMouseEvent.pos (<i>self</i>)</h3><p>Returns the position of the mouse cursor, relative to the widget
that received the event.</p>
<p>If you move the widget as a result of the mouse event, use the
global position returned by <a href="qmouseevent.html#globalPos">globalPos</a>() to avoid a shaking
motion.</p>
<p><b>See also</b> <a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="posF" /><a href="qpointf.html">QPointF</a> QMouseEvent.posF (<i>self</i>)</h3><p>Returns the position of the mouse cursor as a <a href="qpointf.html">QPointF</a>, relative to the widget that received
the event.</p>
<p>If you move the widget as a result of the mouse event, use the
global position returned by <a href="qmouseevent.html#globalPos">globalPos</a>() to avoid a shaking
motion.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), <a href="qmouseevent.html#pos">pos</a>(), and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>


<h3 class="fn"><a name="x" />int QMouseEvent.x (<i>self</i>)</h3><p>Returns the x position of the mouse cursor, relative to the
widget that received the event.</p>
<p><b>See also</b> <a href="qmouseevent.html#y">y</a>() and
<a href="qmouseevent.html#pos">pos</a>().</p>


<h3 class="fn"><a name="y" />int QMouseEvent.y (<i>self</i>)</h3><p>Returns the y position of the mouse cursor, relative to the
widget that received the event.</p>
<p><b>See also</b> <a href="qmouseevent.html#x">x</a>() and
<a href="qmouseevent.html#pos">pos</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.6 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.4</td></tr></table></div></address></body></html>