Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QDesignerFormWindowCursorInterface Class Referenceabstract

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...

#include <abstractformwindowcursor.h>

+ Inheritance diagram for QDesignerFormWindowCursorInterface:
+ Collaboration diagram for QDesignerFormWindowCursorInterface:

Public Types

enum  MoveOperation {
  NoMove , Start , End , Next ,
  Prev , Left , Right , Up ,
  Down
}
 This enum describes the types of text cursor operation that can occur in a form window. More...
 
enum  MoveMode { MoveAnchor , KeepAnchor }
 This enum describes the different modes that are used when the text cursor moves. More...
 

Public Member Functions

 QDesignerFormWindowCursorInterface ()=default
 
virtual ~QDesignerFormWindowCursorInterface ()=default
 Destroys the cursor interface.
 
virtual QDesignerFormWindowInterfaceformWindow () const =0
 Returns the form window interface associated with this cursor interface.
 
virtual bool movePosition (MoveOperation op, MoveMode mode=MoveAnchor)=0
 Performs the given operation on the cursor using the specified mode, and returns true if it completed successfully; otherwise returns false.
 
virtual int position () const =0
 Returns the cursor position.
 
virtual void setPosition (int pos, MoveMode mode=MoveAnchor)=0
 Sets the position of the cursor to the given position using the mode to specify how it is moved there.
 
virtual QWidgetcurrent () const =0
 Returns the currently selected widget in the form window.
 
virtual int widgetCount () const =0
 Returns the number of widgets in the form window.
 
virtual QWidgetwidget (int index) const =0
 Returns the widget with the given index in the list of widgets in the form window.
 
virtual bool hasSelection () const =0
 Returns true if the form window contains a selection; otherwise returns false.
 
virtual int selectedWidgetCount () const =0
 Returns the number of selected widgets in the form window.
 
virtual QWidgetselectedWidget (int index) const =0
 Returns the widget with the given index in the list of selected widgets.
 
virtual void setProperty (const QString &name, const QVariant &value)=0
 Sets the property with the given name for the currently selected widget to the specified value.
 
virtual void setWidgetProperty (QWidget *widget, const QString &name, const QVariant &value)=0
 Sets the property with the given name for the given widget to the specified value.
 
virtual void resetWidgetProperty (QWidget *widget, const QString &name)=0
 Resets the property with the given name for the specified widget to its default value.
 
bool isWidgetSelected (QWidget *widget) const
 Returns true if the specified widget is selected; otherwise returns false.
 

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.

\inmodule QtDesigner

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 \QD'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:

You can retrieve any of \QD's current form windows through \QD's \l {QDesignerFormWindowManagerInterface}{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.

See also
QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface

Definition at line 16 of file abstractformwindowcursor.h.

Member Enumeration Documentation

◆ MoveMode

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

\value MoveAnchor The anchor moves with the cursor to its new location. \value KeepAnchor The anchor remains at the cursor's old location.

Enumerator
MoveAnchor 
KeepAnchor 

Definition at line 35 of file abstractformwindowcursor.h.

◆ MoveOperation

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

\value NoMove The cursor does not move. \value Start Moves the cursor to the start of the focus chain. \value End Moves the cursor to the end of the focus chain. \value Next Moves the cursor to the next widget in the focus chain. \value Prev Moves the cursor to the previous widget in the focus chain. \value Left The cursor moves to the left. \value Right The cursor moves to the right. \value Up The cursor moves upwards. \value Down The cursor moves downwards.

Enumerator
NoMove 
Start 
End 
Next 
Prev 
Left 
Right 
Up 
Down 

Definition at line 21 of file abstractformwindowcursor.h.

Constructor & Destructor Documentation

◆ QDesignerFormWindowCursorInterface()

QDesignerFormWindowCursorInterface::QDesignerFormWindowCursorInterface ( )
default

◆ ~QDesignerFormWindowCursorInterface()

virtual QDesignerFormWindowCursorInterface::~QDesignerFormWindowCursorInterface ( )
virtualdefault

Destroys the cursor interface.

Member Function Documentation

◆ current()

virtual QWidget * QDesignerFormWindowCursorInterface::current ( ) const
pure virtual

Returns the currently selected widget in the form window.

See also
selectedWidget()

Implemented in qdesigner_internal::FormWindowCursor.

◆ formWindow()

virtual QDesignerFormWindowInterface * QDesignerFormWindowCursorInterface::formWindow ( ) const
pure virtual

Returns the form window interface associated with this cursor interface.

Implemented in qdesigner_internal::FormWindowCursor.

◆ hasSelection()

virtual bool QDesignerFormWindowCursorInterface::hasSelection ( ) const
pure virtual

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

Implemented in qdesigner_internal::FormWindowCursor.

◆ isWidgetSelected()

bool QDesignerFormWindowCursorInterface::isWidgetSelected ( QWidget * widget) const

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

Definition at line 89 of file abstractformwindowcursor.cpp.

◆ movePosition()

virtual bool QDesignerFormWindowCursorInterface::movePosition ( MoveOperation operation,
MoveMode mode = MoveAnchor )
pure virtual

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

See also
position(), setPosition()

Implemented in qdesigner_internal::FormWindowCursor.

◆ position()

virtual int QDesignerFormWindowCursorInterface::position ( ) const
pure virtual

Returns the cursor position.

See also
setPosition(), movePosition()

Implemented in qdesigner_internal::FormWindowCursor.

◆ resetWidgetProperty()

virtual void QDesignerFormWindowCursorInterface::resetWidgetProperty ( QWidget * widget,
const QString & name )
pure virtual

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

See also
setProperty(), setWidgetProperty()

Implemented in qdesigner_internal::FormWindowCursor.

◆ selectedWidget()

virtual QWidget * QDesignerFormWindowCursorInterface::selectedWidget ( int index) const
pure virtual

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

See also
current(), widget()

Implemented in qdesigner_internal::FormWindowCursor.

◆ selectedWidgetCount()

virtual int QDesignerFormWindowCursorInterface::selectedWidgetCount ( ) const
pure virtual

Returns the number of selected widgets in the form window.

See also
widgetCount()

Implemented in qdesigner_internal::FormWindowCursor.

◆ setPosition()

virtual void QDesignerFormWindowCursorInterface::setPosition ( int position,
MoveMode mode = MoveAnchor )
pure virtual

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

See also
position(), movePosition()

Implemented in qdesigner_internal::FormWindowCursor.

◆ setProperty()

virtual void QDesignerFormWindowCursorInterface::setProperty ( const QString & name,
const QVariant & value )
pure virtual

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

See also
setWidgetProperty(), resetWidgetProperty()

Implemented in qdesigner_internal::FormWindowCursor.

◆ setWidgetProperty()

virtual void QDesignerFormWindowCursorInterface::setWidgetProperty ( QWidget * widget,
const QString & name,
const QVariant & value )
pure virtual

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

See also
resetWidgetProperty(), setProperty()

Implemented in qdesigner_internal::FormWindowCursor.

◆ widget()

virtual QWidget * QDesignerFormWindowCursorInterface::widget ( int index) const
pure virtual

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

See also
selectedWidget()

Implemented in qdesigner_internal::FormWindowCursor.

◆ widgetCount()

virtual int QDesignerFormWindowCursorInterface::widgetCount ( ) const
pure virtual

Returns the number of widgets in the form window.

See also
selectedWidgetCount()

Implemented in qdesigner_internal::FormWindowCursor.


The documentation for this class was generated from the following files: