This repository has been archived by the owner on May 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dtk-widget-denhancedwidget.html
216 lines (216 loc) · 17.1 KB
/
dtk-widget-denhancedwidget.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- denhancedwidget.cpp -->
<title>DEnhancedWidget Class | Dtk Reference Documentation 1.0.0</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li><a href="index.html">Dtk Doc</a></li>
<li><a href="index.html">Dtk Reference Documentation</a></li>
<li>DEnhancedWidget</li>
<li id="buildversion"><a href="index.html">Qt 5.15.2 Reference Documentation</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">DEnhancedWidget Class</h1>
<span class="small-subtitle">class <a href="dtk.html">Dtk</a>::<a href="dtk-widget.html">Widget</a>::DEnhancedWidget</span>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <DEnhancedWidget></span>
</td></tr></table></div><ul>
<li><a href="dtk-widget-denhancedwidget-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="dtk-widget-denhancedwidget.html#enabled-prop">enabled</a></b> : bool</li>
<li class="fn"><b><a href="dtk-widget-denhancedwidget.html#target-prop">target</a></b> : QWidget*</li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#DEnhancedWidget">DEnhancedWidget</a></b>(QWidget *<i>w</i>, QObject *<i>parent</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#enabled-prop">enabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#target-prop">target</a></b>() const</td></tr>
</table></div>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#setEnabled">setEnabled</a></b>(bool <i>enabled</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#setTarget">setTarget</a></b>(QWidget *<i>target</i>)</td></tr>
</table></div>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#enabledChanged">enabledChanged</a></b>(bool <i>enabled</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#heightChanged">heightChanged</a></b>(int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#positionChanged">positionChanged</a></b>(const QPoint &<i>point</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#showed">showed</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#sizeChanged">sizeChanged</a></b>(const QSize &<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#targetChanged">targetChanged</a></b>(QWidget *<i>target</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#widthChanged">widthChanged</a></b>(int <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#xChanged">xChanged</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="dtk-widget-denhancedwidget.html#yChanged">yChanged</a></b>(int <i>y</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$DEnhancedWidget-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a> 中只有少量的信号用于通知和窗口相关的属性变化,常用的如 x y width height 等属性的改变只能通过继承重写对应的事件才能知晓。DEnhancedWidget 中通过使用事件 过滤器监听目标控件的事件,收到对应事件之后转换为自身的信号发射出来,以此来实现对 <a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a> 对象的信号扩展。</p>
</div>
<!-- @@@DEnhancedWidget -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$enabled-prop$$$enabled$$$setEnabledbool$$$enabledChangedbool -->
<h3 class="fn" id="enabled-prop"><a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type">bool</span></h3>
<p>值为 true 时过滤 target 控件的事件发送信号。否则卸载事件过滤器,控件属性 改变时也不会发出信号。</p>
<p><b>Note: </b>可读可写</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>enabled</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="dtk-widget-denhancedwidget.html#setEnabled">setEnabled</a></b></span>(bool <i>enabled</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="dtk-widget-denhancedwidget.html#enabledChanged">enabledChanged</a></b></span>(bool <i>enabled</i>)</td></tr>
</table></div>
<!-- @@@enabled -->
<!-- $$$target-prop$$$target$$$setTargetQWidget*$$$targetChangedQWidget* -->
<h3 class="fn" id="target-prop"><a name="target-prop"></a><span class="name">target</span> : <span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span>*</h3>
<p>要监听的目标控件,每一个 <a href="dtk-widget-denhancedwidget.html">DEnhancedWidget</a> 对象只能关联到一个 <a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a> 对象 当 target 改变后,所有的信号和旧的 target 都不再有任何关系。</p>
<pre class="cpp">
<span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span> <span class="operator">*</span>w1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span>();
w1<span class="operator">-</span><span class="operator">></span>show();
DEnhancedWidget <span class="operator">*</span>ew <span class="operator">=</span> <span class="keyword">new</span> DEnhancedWidget(w1);
connect(ew<span class="operator">,</span> <span class="operator">&</span>DEnhancedWidget<span class="operator">::</span>xChanged<span class="operator">,</span> <span class="operator">[</span><span class="operator">]</span> (<span class="type">int</span> x) {
<a href="http://doc.qt.io/qt-5/qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> x;
});
<span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span> <span class="operator">*</span>w2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span>();
ew<span class="operator">.</span>setTarget(w2);
w1<span class="operator">-</span><span class="operator">></span>move(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);
</pre>
<p>移动控件 w1 时不会有任何打印</p>
<pre class="cpp">
w2<span class="operator">-</span><span class="operator">></span>show();
w2<span class="operator">-</span><span class="operator">></span>move(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);
</pre>
<p>移动控件 w2 时会有打印 虽然将 target 设置为 w2 之前就已经连接了 x 改变的信号,不过 w2 位置改变时可以收到信号</p>
<p><b>Note: </b>可读可写</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QWidget *</td><td class="memItemRight bottomAlign"><span class="name"><b>target</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="dtk-widget-denhancedwidget.html#setTarget">setTarget</a></b></span>(QWidget *<i>target</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="dtk-widget-denhancedwidget.html#targetChanged">targetChanged</a></b></span>(QWidget *<i>target</i>)</td></tr>
</table></div>
<!-- @@@target -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$DEnhancedWidget[overload1]$$$DEnhancedWidgetQWidget*QObject* -->
<h3 class="fn" id="DEnhancedWidget"><a name="DEnhancedWidget"></a>DEnhancedWidget::<span class="name">DEnhancedWidget</span>(<span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span> *<i>w</i>, <span class="type"><a href="http://doc.qt.io/qt-5/qobject.html">QObject</a></span> *<i>parent</i> = 0)</h3>
<p><a href="dtk-widget-denhancedwidget.html">DEnhancedWidget::DEnhancedWidget</a> 构造函数.</p>
<p><i>w</i> 初始时指定的 target 控件 <i>parent</i> 父对象,直接传递给基类</p>
<p><b>See also </b><a href="dtk-widget-denhancedwidget.html#target-prop">DEnhancedWidget::target</a> and <a href="http://doc.qt.io/qt-5/qobject.html#parent">QObject::parent</a>.</p>
<!-- @@@DEnhancedWidget -->
<!-- $$$enabledChanged -->
<h3 class="fn" id="enabledChanged"><a name="enabledChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">enabledChanged</span>(<span class="type">bool</span> <i>enabled</i>)</h3>
<p><i>enabled</i> 是否可用. 这个信号在属性 <a href="dtk-widget-denhancedwidget.html#enabled-prop">DEnhancedWidget::enabled</a> <i>enabled</i> 被改变后发送</p>
<p><b>Note: </b>Notifier signal for property <a href="dtk-widget-denhancedwidget.html#enabled-prop">enabled</a>. </p>
<!-- @@@enabledChanged -->
<!-- $$$heightChanged[overload1]$$$heightChangedint -->
<h3 class="fn" id="heightChanged"><a name="heightChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">heightChanged</span>(<span class="type">int</span> <i>height</i>)</h3>
<p><i>height</i> 改变的高度大小. 这个信号在目标控件的高度改变后被发送</p>
<!-- @@@heightChanged -->
<!-- $$$positionChanged[overload1]$$$positionChangedconstQPoint& -->
<h3 class="fn" id="positionChanged"><a name="positionChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">positionChanged</span>(const <span class="type"><a href="http://doc.qt.io/qt-5/qpoint.html">QPoint</a></span> &<i>point</i>)</h3>
<p><i>point</i> 改变的位置坐标. 这个信号在目标控件的坐标改变后被发送</p>
<!-- @@@positionChanged -->
<!-- $$$setEnabled -->
<h3 class="fn" id="setEnabled"><a name="setEnabled"></a><code>[slot] </code><span class="type">void</span> DEnhancedWidget::<span class="name">setEnabled</span>(<span class="type">bool</span> <i>enabled</i>)</h3>
<p>DEnhancedWidget::setEnabled <i>enabled</i></p>
<p><b>Note: </b>Setter function for property <a href="dtk-widget-denhancedwidget.html#enabled-prop">enabled</a>. </p>
<p><b>See also </b><a href="dtk-widget-denhancedwidget.html#enabled-prop">DEnhancedWidget::enabled</a>.</p>
<!-- @@@setEnabled -->
<!-- $$$setTarget -->
<h3 class="fn" id="setTarget"><a name="setTarget"></a><code>[slot] </code><span class="type">void</span> DEnhancedWidget::<span class="name">setTarget</span>(<span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span> *<i>target</i>)</h3>
<p>DEnhancedWidget::setTarget <i>target</i></p>
<p><b>Note: </b>Setter function for property <a href="dtk-widget-denhancedwidget.html#target-prop">target</a>. </p>
<p><b>See also </b><a href="dtk-widget-denhancedwidget.html#target-prop">DEnhancedWidget::target</a>.</p>
<!-- @@@setTarget -->
<!-- $$$showed[overload1]$$$showed -->
<h3 class="fn" id="showed"><a name="showed"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">showed</span>()</h3>
<p>这个信号在目标控件显示后发送</p>
<!-- @@@showed -->
<!-- $$$sizeChanged[overload1]$$$sizeChangedconstQSize& -->
<h3 class="fn" id="sizeChanged"><a name="sizeChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">sizeChanged</span>(const <span class="type"><a href="http://doc.qt.io/qt-5/qsize.html">QSize</a></span> &<i>size</i>)</h3>
<p><i>size</i> 改变的大小. 这个信号在目标控件的大小改变后被发送</p>
<!-- @@@sizeChanged -->
<!-- $$$targetChanged -->
<h3 class="fn" id="targetChanged"><a name="targetChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">targetChanged</span>(<span class="type"><a href="http://doc.qt.io/qt-5/qwidget.html">QWidget</a></span> *<i>target</i>)</h3>
<p><i>target</i> 目标控件. 这个信号在属性 <a href="dtk-widget-denhancedwidget.html#target-prop">DEnhancedWidget::target</a> 被改变后发送</p>
<p><b>Note: </b>Notifier signal for property <a href="dtk-widget-denhancedwidget.html#target-prop">target</a>. </p>
<!-- @@@targetChanged -->
<!-- $$$widthChanged[overload1]$$$widthChangedint -->
<h3 class="fn" id="widthChanged"><a name="widthChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">widthChanged</span>(<span class="type">int</span> <i>width</i>)</h3>
<p><i>width</i> 改变的宽度大小. 这个信号在目标控件的宽度改变后被发送</p>
<!-- @@@widthChanged -->
<!-- $$$xChanged[overload1]$$$xChangedint -->
<h3 class="fn" id="xChanged"><a name="xChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">xChanged</span>(<span class="type">int</span> <i>x</i>)</h3>
<p><i>x</i> 改变的 x 轴坐标. 这个信号在目标控件的 x 坐标改变后被发送</p>
<!-- @@@xChanged -->
<!-- $$$yChanged[overload1]$$$yChangedint -->
<h3 class="fn" id="yChanged"><a name="yChanged"></a><code>[signal] </code><span class="type">void</span> DEnhancedWidget::<span class="name">yChanged</span>(<span class="type">int</span> <i>y</i>)</h3>
<p><i>y</i> 改变的 y 轴坐标. 这个信号在目标控件的 y 坐标改变后被发送</p>
<!-- @@@yChanged -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2020 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> 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. </p>
</div>
</body>
</html>