|  | Home · All Classes · Modules

# QDesignerFormWindowCursorInterface Class Reference
[QtDesigner module]

The QDesignerFormWindowCursorInterface class allows you to query and modify a form window's widget selection, and in addition modify the properties of all the form's widgets. More...

### Types

- enum MoveMode { MoveAnchor, KeepAnchor }
- enum MoveOperation { NoMove, Start, End, Next, ..., Down }

### Methods

- __init__ (self)
- __init__ (self, QDesignerFormWindowCursorInterface)
- QWidget current (self)
- QDesignerFormWindowInterface formWindow (self)
- bool hasSelection (self)
- bool isWidgetSelected (self, QWidget widget)
- bool movePosition (self, MoveOperation op, MoveMode mode = QDesignerFormWindowCursorInterface.MoveAnchor)
- int position (self)
- resetWidgetProperty (self, QWidget widget, QString name)
- QWidget selectedWidget (self, int index)
- int selectedWidgetCount (self)
- setPosition (self, int pos, MoveMode mode = QDesignerFormWindowCursorInterface.MoveAnchor)
- setProperty (self, QString name, QVariant value)
- setWidgetProperty (self, QWidget widget, QString name, QVariant value)
- QWidget widget (self, int index)
- int widgetCount (self)

## Detailed Description

The QDesignerFormWindowCursorInterface class allows you to query and modify a form window's widget selection, and in addition modify the properties of all the form's widgets.

QDesignerFormWindowCursorInterface is a convenience class that provides an interface to the associated form window's text cursor; it provides a collection of functions that enables you to query a given form window's selection and change the selection's focus according to defined modes (MoveMode) and movements (MoveOperation). You can also use the interface to query the form's widgets and change their properties.

The interface is not intended to be instantiated directly, but to provide access to the selections and widgets of Qt Designer's current form windows. QDesignerFormWindowInterface always provides an associated cursor interface. The form window for a given widget can be retrieved using the static QDesignerFormWindowInterface.findFormWindow() functions. For example:

         QDesignerFormWindowInterface *formWindow = 0;
         formWindow = QDesignerFormWindowInterface.findFormWindow(myWidget);

         formWindow->cursor()->setProperty(myWidget, myProperty, newValue);

You can retrieve any of Qt Designer's current form windows through Qt Designer's form window manager.

Once you have a form window's cursor interface, you can check if the form window has a selection at all using the hasSelection() function. You can query the form window for its total widgetCount() and selectedWidgetCount(). You can retrieve the currently selected widget (or widgets) using the current() or selectedWidget() functions.

You can retrieve any of the form window's widgets using the widget() function, and check if a widget is selected using the isWidgetSelected() function. You can use the setProperty() function to set the selected widget's properties, and the setWidgetProperty() or resetWidgetProperty() functions to modify the properties of any given widget.

Finally, you can change the selection by changing the text cursor's position() using the setPosition() and movePosition() functions.

## Type Documentation

### QDesignerFormWindowCursorInterface.MoveMode

This enum describes the different modes that are used when the text cursor moves.

Constant | Value | Description
--- | --- | ---
`QDesignerFormWindowCursorInterface.MoveAnchor` | `0` | The anchor moves with the cursor to its new location.
`QDesignerFormWindowCursorInterface.KeepAnchor` | `1` | The anchor remains at the cursor's old location.

### QDesignerFormWindowCursorInterface.MoveOperation

This enum describes the types of text cursor operation that can occur in a form window.

Constant | Value | Description
--- | --- | ---
`QDesignerFormWindowCursorInterface.NoMove` | `0` | The cursor does not move.
`QDesignerFormWindowCursorInterface.Start` | `1` | Moves the cursor to the start of the focus chain.
`QDesignerFormWindowCursorInterface.End` | `2` | Moves the cursor to the end of the focus chain.
`QDesignerFormWindowCursorInterface.Next` | `3` | Moves the cursor to the next widget in the focus chain.
`QDesignerFormWindowCursorInterface.Prev` | `4` | Moves the cursor to the previous widget in the focus chain.
`QDesignerFormWindowCursorInterface.Left` | `5` | The cursor moves to the left.
`QDesignerFormWindowCursorInterface.Right` | `6` | The cursor moves to the right.
`QDesignerFormWindowCursorInterface.Up` | `7` | The cursor moves upwards.
`QDesignerFormWindowCursorInterface.Down` | `8` | The cursor moves downwards.

## Method Documentation

### QDesignerFormWindowCursorInterface.__init__ (self)

### QDesignerFormWindowCursorInterface.__init__ (self, QDesignerFormWindowCursorInterface)

### QWidget QDesignerFormWindowCursorInterface.current (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the currently selected widget in the form window.

See also selectedWidget().

### QDesignerFormWindowInterface QDesignerFormWindowCursorInterface.formWindow (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the form window interface associated with this cursor interface.

### bool QDesignerFormWindowCursorInterface.hasSelection (self)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the form window contains a selection; otherwise returns false.

### bool QDesignerFormWindowCursorInterface.isWidgetSelected (self, QWidget widget)

Returns true if the specified widget is selected; otherwise returns false.

### bool QDesignerFormWindowCursorInterface.movePosition (self, MoveOperation op, MoveMode mode = QDesignerFormWindowCursorInterface.MoveAnchor)

This method is abstract and should be reimplemented in any sub-class.

Performs the given operation on the cursor using the specified mode, and returns true if it completed successfully; otherwise returns false.

See also position() and setPosition().

### int QDesignerFormWindowCursorInterface.position (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the cursor position.

See also setPosition() and movePosition().

### QDesignerFormWindowCursorInterface.resetWidgetProperty (self, QWidget widget, QString name)

This method is abstract and should be reimplemented in any sub-class.

Resets the property with the given name for the specified widget to its default value.

See also setProperty() and setWidgetProperty().

### QWidget QDesignerFormWindowCursorInterface.selectedWidget (self, int index)

This method is abstract and should be reimplemented in any sub-class.

Returns the widget with the given index in the list of selected widgets.

See also current() and widget().

### int QDesignerFormWindowCursorInterface.selectedWidgetCount (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the number of selected widgets in the form window.

See also widgetCount().

### QDesignerFormWindowCursorInterface.setPosition (self, int pos, MoveMode mode = QDesignerFormWindowCursorInterface.MoveAnchor)

This method is abstract and should be reimplemented in any sub-class.

Sets the position of the cursor to the given position using the mode to specify how it is moved there.

See also position() and movePosition().

### QDesignerFormWindowCursorInterface.setProperty (self, QString name, QVariant value)

This method is abstract and should be reimplemented in any sub-class.

Sets the property with the given name for the currently selected widget to the specified value.

See also setWidgetProperty() and resetWidgetProperty().

### QDesignerFormWindowCursorInterface.setWidgetProperty (self, QWidget widget, QString name, QVariant value)

This method is abstract and should be reimplemented in any sub-class.

Sets the property with the given name for the given widget to the specified value.

See also resetWidgetProperty() and setProperty().

### QWidget QDesignerFormWindowCursorInterface.widget (self, int index)

This method is abstract and should be reimplemented in any sub-class.

Returns the widget with the given index in the list of widgets in the form window.

See also selectedWidget().

### int QDesignerFormWindowCursorInterface.widgetCount (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the number of widgets in the form window.

See also selectedWidgetCount().