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
abstractpropertyeditor.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
"abstractpropertyeditor.h"
5
6
QT_BEGIN_NAMESPACE
7
8
/*!
9
\class QDesignerPropertyEditorInterface
10
11
\brief The QDesignerPropertyEditorInterface class allows you to
12
query and manipulate the current state of Qt Widgets Designer's property
13
editor.
14
15
\inmodule QtDesigner
16
17
QDesignerPropertyEditorInterface contains a collection of
18
functions that is typically used to query the property editor for
19
its current state, and several slots manipulating it's state. The
20
interface also provide a signal, propertyChanged(), which is
21
emitted whenever a property changes in the property editor. The
22
signal's arguments are the property that changed and its new
23
value.
24
25
For example, when implementing a custom widget plugin, you can
26
connect the signal to a custom slot:
27
28
\snippet lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 0
29
30
Then the custom slot can check if the new value is within the
31
range we want when a specified property, belonging to a particular
32
widget, changes:
33
34
\snippet lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 1
35
36
The QDesignerPropertyEditorInterface class is not intended to be
37
instantiated directly. You can retrieve an interface to \QD's
38
property editor using the
39
QDesignerFormEditorInterface::propertyEditor() function. A pointer
40
to \QD's current QDesignerFormEditorInterface object (\c
41
formEditor in the examples above) is provided by the
42
QDesignerCustomWidgetInterface::initialize() function's
43
parameter. When implementing a custom widget plugin, you must
44
subclass the QDesignerCustomWidgetInterface to expose your plugin
45
to \QD.
46
47
The functions accessing the property editor are the core()
48
function that you can use to retrieve an interface to the form
49
editor, the currentPropertyName() function that returns the name
50
of the currently selected property in the property editor, the
51
object() function that returns the currently selected object in
52
\QD's workspace, and the isReadOnly() function that returns true
53
if the property editor is write proteced (otherwise false).
54
55
The slots manipulating the property editor's state are the
56
setObject() slot that you can use to change the currently selected
57
object in \QD's workspace, the setPropertyValue() slot that
58
changes the value of a given property and the setReadOnly() slot
59
that control the write protection of the property editor.
60
61
\sa QDesignerFormEditorInterface
62
*/
63
64
/*!
65
Constructs a property editor interface with the given \a parent and
66
the specified window \a flags.
67
*/
68
QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags)
69
: QWidget(parent, flags)
70
{
71
}
72
73
/*!
74
Destroys the property editor interface.
75
*/
76
QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface() =
default
;
77
78
/*!
79
Returns a pointer to \QD's current QDesignerFormEditorInterface
80
object.
81
*/
82
QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core()
const
83
{
84
return
nullptr
;
85
}
86
87
/*!
88
\fn bool QDesignerPropertyEditorInterface::isReadOnly() const
89
90
Returns true if the property editor is write protected; otherwise
91
false.
92
93
\sa setReadOnly()
94
*/
95
96
/*!
97
\fn QObject *QDesignerPropertyEditorInterface::object() const
98
99
Returns the currently selected object in \QD's workspace.
100
101
\sa setObject()
102
*/
103
104
/*!
105
\fn QString QDesignerPropertyEditorInterface::currentPropertyName() const
106
107
Returns the name of the currently selected property in the
108
property editor.
109
110
\sa setPropertyValue()
111
*/
112
113
/*!
114
\fn void QDesignerPropertyEditorInterface::propertyChanged(const QString &name, const QVariant &value)
115
116
This signal is emitted whenever a property changes in the property
117
editor. The property that changed and its new value are specified
118
by \a name and \a value respectively.
119
120
\sa setPropertyValue()
121
*/
122
123
/*!
124
\fn void QDesignerPropertyEditorInterface::setObject(QObject *object)
125
126
Changes the currently selected object in \QD's workspace, to \a
127
object.
128
129
\sa object()
130
*/
131
132
/*!
133
\fn void QDesignerPropertyEditorInterface::setPropertyValue(const QString &name, const QVariant &value, bool changed = true)
134
135
Sets the value of the property specified by \a name to \a
136
value.
137
138
In addition, the property is marked as \a changed in the property
139
editor, i.e. its value is different from the default value.
140
141
\sa currentPropertyName(), propertyChanged()
142
*/
143
144
/*!
145
\fn void QDesignerPropertyEditorInterface::setReadOnly(bool readOnly)
146
147
If \a readOnly is true, the property editor is made write
148
protected; otherwise the write protection is removed.
149
150
\sa isReadOnly()
151
*/
152
153
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
abstractpropertyeditor.cpp
Generated on Sat Sep 21 2024 00:50:30 for Qt by
1.12.0