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
abstractformwindowcursor.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
include
"abstractformwindowcursor.h"
5
6
QT_BEGIN_NAMESPACE
7
8
/*!
9
\class QDesignerFormWindowCursorInterface
10
11
\brief The QDesignerFormWindowCursorInterface class allows you to
12
query and modify a form window's widget selection, and in addition
13
modify the properties of all the form's widgets.
14
15
\inmodule QtDesigner
16
17
QDesignerFormWindowCursorInterface is a convenience class that
18
provides an interface to the associated form window's text cursor;
19
it provides a collection of functions that enables you to query a
20
given form window's selection and change the selection's focus
21
according to defined modes (MoveMode) and movements
22
(MoveOperation). You can also use the interface to query the
23
form's widgets and change their properties.
24
25
The interface is not intended to be instantiated directly, but to
26
provide access to the selections and widgets of \QD's current form
27
windows. QDesignerFormWindowInterface always provides an
28
associated cursor interface. The form window for a given widget
29
can be retrieved using the static
30
QDesignerFormWindowInterface::findFormWindow() functions. For
31
example:
32
33
\snippet lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp 0
34
35
You can retrieve any of \QD's current form windows through
36
\QD's \l {QDesignerFormWindowManagerInterface}{form window
37
manager}.
38
39
Once you have a form window's cursor interface, you can check if
40
the form window has a selection at all using the hasSelection()
41
function. You can query the form window for its total
42
widgetCount() and selectedWidgetCount(). You can retrieve the
43
currently selected widget (or widgets) using the current() or
44
selectedWidget() functions.
45
46
You can retrieve any of the form window's widgets using the
47
widget() function, and check if a widget is selected using the
48
isWidgetSelected() function. You can use the setProperty()
49
function to set the selected widget's properties, and the
50
setWidgetProperty() or resetWidgetProperty() functions to modify
51
the properties of any given widget.
52
53
Finally, you can change the selection by changing the text
54
cursor's position() using the setPosition() and movePosition()
55
functions.
56
57
\sa QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface
58
*/
59
60
/*!
61
\enum QDesignerFormWindowCursorInterface::MoveOperation
62
63
This enum describes the types of text cursor operation that can occur in a form window.
64
65
\value NoMove The cursor does not move.
66
\value Start Moves the cursor to the start of the focus chain.
67
\value End Moves the cursor to the end of the focus chain.
68
\value Next Moves the cursor to the next widget in the focus chain.
69
\value Prev Moves the cursor to the previous widget in the focus chain.
70
\value Left The cursor moves to the left.
71
\value Right The cursor moves to the right.
72
\value Up The cursor moves upwards.
73
\value Down The cursor moves downwards.
74
*/
75
76
/*!
77
\enum QDesignerFormWindowCursorInterface::MoveMode
78
79
This enum describes the different modes that are used when the text cursor moves.
80
81
\value MoveAnchor The anchor moves with the cursor to its new location.
82
\value KeepAnchor The anchor remains at the cursor's old location.
83
*/
84
85
/*!
86
Returns true if the specified \a widget is selected; otherwise
87
returns false.
88
*/
89
bool
QDesignerFormWindowCursorInterface::isWidgetSelected(QWidget *widget)
const
90
{
91
for
(
int
index=0; index<selectedWidgetCount(); ++index) {
92
if
(selectedWidget(index) == widget)
93
return
true
;
94
}
95
96
return
false
;
97
}
98
99
/*!
100
\fn virtual QDesignerFormWindowCursorInterface::~QDesignerFormWindowCursorInterface()
101
102
Destroys the cursor interface.
103
*/
104
105
/*!
106
\fn virtual QDesignerFormWindowInterface *QDesignerFormWindowCursorInterface::formWindow() const
107
108
Returns the form window interface associated with this cursor interface.
109
*/
110
111
/*!
112
\fn virtual bool QDesignerFormWindowCursorInterface::movePosition(MoveOperation operation, MoveMode mode)
113
114
Performs the given \a operation on the cursor using the specified
115
\a mode, and returns true if it completed successfully; otherwise
116
returns false.
117
118
\sa position(), setPosition()
119
*/
120
121
/*!
122
\fn virtual int QDesignerFormWindowCursorInterface::position() const
123
124
Returns the cursor position.
125
126
\sa setPosition(), movePosition()
127
*/
128
129
/*!
130
\fn virtual void QDesignerFormWindowCursorInterface::setPosition(int position, MoveMode mode = MoveAnchor)
131
132
Sets the position of the cursor to the given \a position using the
133
\a mode to specify how it is moved there.
134
135
\sa position(), movePosition()
136
*/
137
138
/*!
139
\fn virtual QWidget *QDesignerFormWindowCursorInterface::current() const
140
141
Returns the currently selected widget in the form window.
142
143
\sa selectedWidget()
144
*/
145
146
/*!
147
\fn virtual int QDesignerFormWindowCursorInterface::widgetCount() const
148
149
Returns the number of widgets in the form window.
150
151
\sa selectedWidgetCount()
152
*/
153
154
/*!
155
\fn virtual QWidget *QDesignerFormWindowCursorInterface::widget(int index) const
156
157
Returns the widget with the given \a index in the list of widgets
158
in the form window.
159
160
\sa selectedWidget()
161
*/
162
163
/*!
164
\fn virtual bool QDesignerFormWindowCursorInterface::hasSelection() const
165
166
Returns true if the form window contains a selection; otherwise
167
returns false.
168
*/
169
170
/*!
171
\fn virtual int QDesignerFormWindowCursorInterface::selectedWidgetCount() const
172
173
Returns the number of selected widgets in the form window.
174
175
\sa widgetCount()
176
*/
177
178
/*!
179
\fn virtual QWidget *QDesignerFormWindowCursorInterface::selectedWidget(int index) const
180
181
Returns the widget with the given \a index in the list of selected
182
widgets.
183
184
\sa current(), widget()
185
*/
186
187
/*!
188
\fn virtual void QDesignerFormWindowCursorInterface::setProperty(const QString &name, const QVariant &value)
189
190
Sets the property with the given \a name for the currently
191
selected widget to the specified \a value.
192
193
\sa setWidgetProperty(), resetWidgetProperty()
194
*/
195
196
/*!
197
\fn virtual void QDesignerFormWindowCursorInterface::setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value)
198
199
Sets the property with the given \a name for the given \a widget
200
to the specified \a value.
201
202
\sa resetWidgetProperty(), setProperty()
203
*/
204
205
/*!
206
\fn virtual void QDesignerFormWindowCursorInterface::resetWidgetProperty(QWidget *widget, const QString &name)
207
208
Resets the property with the given \a name for the specified \a
209
widget to its default value.
210
211
\sa setProperty(), setWidgetProperty()
212
*/
213
214
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
qttools
src
designer
src
lib
sdk
abstractformwindowcursor.cpp
Generated on Sat Sep 21 2024 00:50:30 for Qt by
1.12.0