clickItem (Qt)

clickItem(objectOrName, itemOrIndex, x, y, modifierState, button)

This function clicks the mouse on the item with the specified itemOrIndex inside the given objectOrName view widget. This function is typically used to access items inside views such as lists, tables, and trees.

For tables the itemOrIndex is a string with the format row/column, e.g., "4/21". For the tree views the itemOrIndex is a list of segments separated by the "." character. Each segment may optionally contain a _X suffix where X is interpreted as 1-base occurrence index. If any of the involved tree items contains the ".","_" or "\" characters in its text, these characters need to be escaped in the itemOrIndex as "\.","\_" and "\\" respectively in order to avoid being interpreted as special characters. (Note that the script interpreter may require additional escaping for the "\" character.) The sequence of the segments corresponds to the tree path of the returned item. For example the "Item1.Sub\.ItemX_3.Leaf" finds an item with text "Leaf" that is a direct child of the third item with the text "Sub.ItemX" among the children of the root node with text "Item1". For other views it is the relevant item's text.

The click is made at position x and y (in the itemOrIndex item's coordinates) using the specified button and with the modifierState modifier state. It is safe to pass 0 for the coordinates and for the state. Normally, we would pass Qt.LeftButton for the button.

Squish supports this function for view widgets of type QAbstractItemView, and its subclasses, including QListView, QTableView, and QTreeView, and also older Qt3Support classes such as Q3IconView, Q3ListBox, Q3Table, and also classes derived from these types.

Qt Convenience Function Parameters lists valid values for the modifierState and the button arguments.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results