Skip to content

Commit eea47b9

Browse files
authored
Merge pull request #472 from oscargus/mousedocs
Correct and clarify parameter names for qtbot.mouse*
2 parents c78d21c + d6de276 commit eea47b9

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/pytestqt/qtbot.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,30 @@ class QtBot:
5959
6060
Below are methods used to simulate sending key events to widgets:
6161
62-
.. staticmethod:: keyClick (widget, key[, modifier=Qt.NoModifier[, delay=-1]])
63-
.. staticmethod:: keyClicks (widget, key_sequence[, modifier=Qt.NoModifier[, delay=-1]])
64-
.. staticmethod:: keyEvent (action, widget, key[, modifier=Qt.NoModifier[, delay=-1]])
65-
.. staticmethod:: keyPress (widget, key[, modifier=Qt.NoModifier[, delay=-1]])
66-
.. staticmethod:: keyRelease (widget, key[, modifier=Qt.NoModifier[, delay=-1]])
62+
.. staticmethod:: keyClick (widget, key[, modifier=Qt.KeyboardModifier.NoModifier[, delay=-1]])
63+
.. staticmethod:: keyClicks (widget, key_sequence[, modifier=Qt.KeyboardModifier.NoModifier[, delay=-1]])
64+
.. staticmethod:: keyEvent (action, widget, key[, modifier=Qt.KeyboardModifier.NoModifier[, delay=-1]])
65+
.. staticmethod:: keyPress (widget, key[, modifier=Qt.KeyboardModifier.NoModifier[, delay=-1]])
66+
.. staticmethod:: keyRelease (widget, key[, modifier=Qt.KeyboardModifier.NoModifier[, delay=-1]])
6767
6868
Sends one or more keyboard events to a widget.
6969
7070
:param QWidget widget: the widget that will receive the event
7171
72-
:param str|int key: key to send, it can be either a Qt.Key_* constant or a single character string.
72+
:param str|int key: key to send, it can be either a Qt.Key.Key_* constant or a single character string.
7373
7474
.. _keyboard modifiers:
7575
7676
:param Qt.KeyboardModifier modifier: flags OR'ed together representing other modifier keys
7777
also pressed. Possible flags are:
7878
79-
* ``Qt.NoModifier``: No modifier key is pressed.
80-
* ``Qt.ShiftModifier``: A Shift key on the keyboard is pressed.
81-
* ``Qt.ControlModifier``: A Ctrl key on the keyboard is pressed.
82-
* ``Qt.AltModifier``: An Alt key on the keyboard is pressed.
83-
* ``Qt.MetaModifier``: A Meta key on the keyboard is pressed.
84-
* ``Qt.KeypadModifier``: A keypad button is pressed.
85-
* ``Qt.GroupSwitchModifier``: X11 only. A Mode_switch key on the keyboard is pressed.
79+
* ``Qt.KeyboardModifier.NoModifier``: No modifier key is pressed.
80+
* ``Qt.KeyboardModifier.ShiftModifier``: A Shift key on the keyboard is pressed.
81+
* ``Qt.KeyboardModifier.ControlModifier``: A Ctrl key on the keyboard is pressed.
82+
* ``Qt.KeyboardModifier.AltModifier``: An Alt key on the keyboard is pressed.
83+
* ``Qt.KeyboardModifier.MetaModifier``: A Meta key on the keyboard is pressed.
84+
* ``Qt.KeyboardModifier.KeypadModifier``: A keypad button is pressed.
85+
* ``Qt.KeyboardModifier.GroupSwitchModifier``: X11 only. A Mode_switch key on the keyboard is pressed.
8686
8787
:param int delay: after the event, delay the test for this milliseconds (if > 0).
8888
@@ -91,7 +91,7 @@ class QtBot:
9191
9292
Auxiliary method that converts the given constant to its equivalent ascii.
9393
94-
:param Qt.Key_* key: one of the constants for keys in the Qt namespace.
94+
:param Qt.Key.Key_* key: one of the constants for keys in the Qt namespace.
9595
9696
:return type: str
9797
:returns: the equivalent character string.
@@ -102,11 +102,11 @@ class QtBot:
102102
103103
Below are methods used to simulate sending mouse events to widgets.
104104
105-
.. staticmethod:: mouseClick (widget, button[, stateKey=0[, pos=QPoint()[, delay=-1]]])
106-
.. staticmethod:: mouseDClick (widget, button[, stateKey=0[, pos=QPoint()[, delay=-1]]])
105+
.. staticmethod:: mouseClick (widget, button[, modifier=0[, pos=QPoint()[, delay=-1]]])
106+
.. staticmethod:: mouseDClick (widget, button[, modifier=0[, pos=QPoint()[, delay=-1]]])
107107
.. staticmethod:: mouseMove (widget[, pos=QPoint()[, delay=-1]])
108-
.. staticmethod:: mousePress (widget, button[, stateKey=0[, pos=QPoint()[, delay=-1]]])
109-
.. staticmethod:: mouseRelease (widget, button[, stateKey=0[, pos=QPoint()[, delay=-1]]])
108+
.. staticmethod:: mousePress (widget, button[, modifier=0[, pos=QPoint()[, delay=-1]]])
109+
.. staticmethod:: mouseRelease (widget, button[, modifier=0[, pos=QPoint()[, delay=-1]]])
110110
111111
Sends a mouse moves and clicks to a widget.
112112
@@ -128,10 +128,12 @@ class QtBot:
128128
:param Qt.KeyboardModifier modifier: flags OR'ed together representing other modifier keys
129129
also pressed. See `keyboard modifiers`_.
130130
131-
:param QPoint position: position of the mouse pointer.
131+
:param QPoint pos: position of the mouse pointer.
132132
133133
:param int delay: after the event, delay the test for this milliseconds (if > 0).
134134
135+
.. note:: In the PySide bindings, the *modifier* argument is called *stateKey*.
136+
135137
136138
.. _QTest API: http://doc.qt.io/qt-5/qtest.html
137139

0 commit comments

Comments
 (0)