Debian Codegraph @

src/DockableWidgetLayout.cpp

raw symbols SCIP
1 #cxx . . $ `<file>/src/DockableWidgetLayout.cpp`/include "DockableWidgetLayout.h"cxx . . $ `<file>/src/DockableWidgetLayout.h`/
2 #include "DockableWidget.h"cxx . . $ `<file>/src/DockableWidget.h`/
3 #include <QLayoutItem>
4 #include <QtGlobal>
5 #include <QSet>
6 #include <iterator>
7
8 static const int SNAP_DISTANCEcxx . . $ SNAP_DISTANCE. = 16;
9
10 DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::DockableWidgetLayoutcxx . . $ DockableWidgetLayout#DockableWidgetLayout(ce39998ec690b8ac).(QWidgetcxx . . $ QWidget#* parent, int margin, int spacing)
11 : QLayoutcxx . . $ QLayout#QLayout(108f35f7aa7f3cf9).(parent)
12 {
13 setMargincxx . . $ QLayout#setMargin(d4f767463ce0a6b3).(margin);
14 setSpacingcxx . . $ QLayout#setSpacing(d4f767463ce0a6b3).(spacing);
15 minWidthcxx . . $ DockableWidgetLayout#minWidth. = minHeightcxx . . $ DockableWidgetLayout#minHeight. = 0;
16 maxWidthcxx . . $ DockableWidgetLayout#maxWidth. = maxHeightcxx . . $ DockableWidgetLayout#maxHeight. = 0;
17 }
18
19 DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::DockableWidgetLayoutcxx . . $ DockableWidgetLayout#DockableWidgetLayout(d4f767463ce0a6b3).(int spacing)
20 {
21 setSpacingcxx . . $ QLayout#setSpacing(d4f767463ce0a6b3).(spacing);
22 minWidthcxx . . $ DockableWidgetLayout#minWidth. = minHeightcxx . . $ DockableWidgetLayout#minHeight. = 0;
23 maxWidthcxx . . $ DockableWidgetLayout#maxWidth. = maxHeightcxx . . $ DockableWidgetLayout#maxHeight. = 0;
24 }
25
26 DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::~cxx . . $ DockableWidgetLayout#`~DockableWidgetLayout`(ced63f7c635d850d).DockableWidgetLayoutcxx . . $ DockableWidgetLayout#()
27 {
28 while (!dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) {
29 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* info = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..takeFirstcxx . . $ QList#takeFirst(5f357b03ed472e5e).();
30 delete info->itemcxx . . $ DockableWidgetLayout#DockInfo#item.;
31 delete info->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.;
32 delete info;
33 }
34 }
35
36 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::addItemcxx . . $ DockableWidgetLayout#addItem(6d8c77b6908f2a).(QLayoutItemcxx . . $ QLayoutItem#* item)
37 {
38 addItemcxx . . $ DockableWidgetLayout#addItem(997e142641fa2c77).(item, -1);
39 }
40
41 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::addItemcxx . . $ DockableWidgetLayout#addItem(997e142641fa2c77).(
42 QLayoutItemcxx . . $ QLayoutItem#* item, int index, DockSidecxx . . $ DockableWidgetLayout#DockSide# side, int dist, int w, int h)
43 {
44 auto* info = new DockInfocxx . . $ DockableWidgetLayout#DockInfo#();
45 info->itemcxx . . $ DockableWidgetLayout#DockInfo#item. = item;
46 info->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget. = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<DockableWidgetcxx . . $ DockableWidget#*>(item->widgetcxx . . $ QLayoutItem#widget(9b769eeb00a33a04).());
47 info->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. = side;
48 info->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. = dist;
49 info->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = 0;
50 info->topcxx . . $ DockableWidgetLayout#DockInfo#top. = 0;
51 info->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = -1;
52 info->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = -1;
53 info->useHintWidthcxx . . $ DockableWidgetLayout#DockInfo#useHintWidth. = true;
54 info->useHintHeightcxx . . $ DockableWidgetLayout#DockInfo#useHintHeight. = true;
55
56 if (info->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->sizePolicycxx . . $ QWidget#sizePolicy(32ae450071346403).().horizontalPolicycxx . . $ QSizePolicy#horizontalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed. &&
57 w > 0) {
58 info->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = w;
59 info->useHintWidthcxx . . $ DockableWidgetLayout#DockInfo#useHintWidth. = false;
60 }
61 if (info->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->sizePolicycxx . . $ QWidget#sizePolicy(32ae450071346403).().verticalPolicycxx . . $ QSizePolicy#verticalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed. &&
62 h > 0) {
63 info->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = h;
64 info->useHintHeightcxx . . $ DockableWidgetLayout#DockInfo#useHintHeight. = false;
65 }
66
67 // first widget is the resize widget, set initial size
68 if (dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) {
69 if (info->widthcxx . . $ DockableWidgetLayout#DockInfo#width. == -1) {
70 info->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = item->sizeHintcxx . . $ QLayoutItem#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).();
71 }
72 if (info->heightcxx . . $ DockableWidgetLayout#DockInfo#height. == -1) {
73 info->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = item->sizeHintcxx . . $ QLayoutItem#sizeHint(4b3b776e5ee2b367).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).();
74 }
75 info->useHintWidthcxx . . $ DockableWidgetLayout#DockInfo#useHintWidth. = false;
76 info->useHintHeightcxx . . $ DockableWidgetLayout#DockInfo#useHintHeight. = false;
77 }
78
79 for (const auto* w : dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.) {
80 Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:861:13`!(w->widget != item->widget());
81 }
82
83 if (index > -1 && index < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) {
84 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..insertcxx . . $ QList#insert(20dcc09d4a3213bb).(index, info);
85 } else {
86 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..appendcxx . . $ QList#append(77d9f17553126ecb).(info);
87 }
88
89 // recalculate size limits
90 calcSizeLimitscxx . . $ DockableWidgetLayout#calcSizeLimits(49f6e7a06ebc5aa8).();
91 }
92
93 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::addWidgetcxx . . $ DockableWidgetLayout#addWidget(44e654ffa86b3330).(DockableWidgetcxx . . $ DockableWidget#* widget, const QRectcxx . . $ QRect#& rect)
94 {
95 int index;
96 DockSidecxx . . $ DockableWidgetLayout#DockSide# side;
97 QRectcxx . . $ QRect# r(rect);
98 if (insertLocationcxx . . $ DockableWidgetLayout#insertLocation(f87c210062199149).(r, index, side, widget->sizePolicycxx . . $ QWidget#sizePolicy(32ae450071346403).())) {
99 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..firstcxx . . $ QList#first(19b2b6f17af048b).();
100 int dist;
101 switch (side) {
102 case TOPcxx . . $ DockableWidgetLayout#TOP.:
103 case BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.:
104 dist = r.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() - d->leftcxx . . $ DockableWidgetLayout#DockInfo#left.;
105 break;
106 case LEFTcxx . . $ DockableWidgetLayout#LEFT.:
107 case RIGHTcxx . . $ DockableWidgetLayout#RIGHT.:
108 dist = r.topcxx . . $ QRect#top(ea6fe5115c70a13f).() - d->topcxx . . $ DockableWidgetLayout#DockInfo#top.;
109 break;
110 }
111 widget->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
112 addItemcxx . . $ DockableWidgetLayout#addItem(997e142641fa2c77).(new QWidgetItemcxx . . $ QWidgetItem#(widget), index, side, dist,
113 r.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), r.heightcxx . . $ QRect#height(ea6fe5115c70a13f).());
114 updatecxx . . $ QLayout#update(49f6e7a06ebc5aa8).();
115 }
116 }
117
118 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::addWidgetcxx . . $ DockableWidgetLayout#addWidget(2b57f50e378c57c1).(
119 DockableWidgetcxx . . $ DockableWidget#* widget, DockSidecxx . . $ DockableWidgetLayout#DockSide# side, int dist, int w, int h)
120 {
121 // append item at the back
122 addItemcxx . . $ DockableWidgetLayout#addItem(997e142641fa2c77).(new QWidgetItemcxx . . $ QWidgetItem#(widget), -1, side, dist, w, h);
123 }
124
125 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::changedcxx . . $ DockableWidgetLayout#changed(49f6e7a06ebc5aa8).()
126 {
127 calcSizeLimitscxx . . $ DockableWidgetLayout#calcSizeLimits(49f6e7a06ebc5aa8).();
128 updatecxx . . $ QLayout#update(49f6e7a06ebc5aa8).();
129 }
130
131 Qtcxx . . $ Qt/::Orientationscxx . . $ Qt/Orientations# DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::expandingDirectionscxx . . $ DockableWidgetLayout#expandingDirections(68f10a281c411dd2).() const
132 {
133 return Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal. |cxx . . $ Qt/`operator|`(b59acee7bc4cf468). Qtcxx . . $ Qt/::Verticalcxx . . $ Qt/Vertical.;
134 }
135
136 bool DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::hasHeightForWidthcxx . . $ DockableWidgetLayout#hasHeightForWidth(50ce9a9e25b4a850).() const
137 {
138 return false;
139 }
140
141 int DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::countcxx . . $ DockableWidgetLayout#count(455f465bc33b4cdf).() const
142 {
143 return dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).();
144 }
145
146 QLayoutItemcxx . . $ QLayoutItem#* DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::takeAtcxx . . $ DockableWidgetLayout#takeAt(528d08ee5b755d3e).(int index)
147 {
148 if (index < 0 || index >= dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) return nullptr;
149
150 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* info = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..takeAtcxx . . $ QList#takeAt(767fea59dce4185d).(index);
151 QLayoutItemcxx . . $ QLayoutItem#* item = info->itemcxx . . $ DockableWidgetLayout#DockInfo#item.;
152 delete info;
153
154 calcSizeLimitscxx . . $ DockableWidgetLayout#calcSizeLimits(49f6e7a06ebc5aa8).();
155 return item;
156 }
157
158 QLayoutItemcxx . . $ QLayoutItem#* DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::itemAtcxx . . $ DockableWidgetLayout#itemAt(8e5f6cab8cd411bf).(int index) const
159 {
160 if (index < 0 || index >= dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) return nullptr;
161
162 return dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(index)->itemcxx . . $ DockableWidgetLayout#DockInfo#item.;
163 }
164
165 QSizecxx . . $ QSize# DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::minimumSizecxx . . $ DockableWidgetLayout#minimumSize(4b3b776e5ee2b367).() const
166 {
167 return {cxx . . $ QSize#QSize(c0d38f4800714fae).minWidthcxx . . $ DockableWidgetLayout#minWidth., minHeightcxx . . $ DockableWidgetLayout#minHeight.};
168 }
169
170 QSizecxx . . $ QSize# DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::maximumSizecxx . . $ DockableWidgetLayout#maximumSize(4b3b776e5ee2b367).() const
171 {
172 return {cxx . . $ QSize#QSize(c0d38f4800714fae).maxWidthcxx . . $ DockableWidgetLayout#maxWidth., maxHeightcxx . . $ DockableWidgetLayout#maxHeight.};
173 }
174
175 QSizecxx . . $ QSize# DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::sizeHintcxx . . $ DockableWidgetLayout#sizeHint(4b3b776e5ee2b367).() const
176 {
177 return {cxx . . $ QSize#QSize(c0d38f4800714fae).layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth., layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight.};
178 }
179
180 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::setGeometrycxx . . $ DockableWidgetLayout#setGeometry(22ba0428947158b).(const QRectcxx . . $ QRect#& rect)
181 {
182 QLayoutcxx . . $ QLayout#::setGeometrycxx . . $ QLayout#setGeometry(22ba0428947158b).(rect);
183
184 // Qt sometimes sets the geometry outside the minimumSize/maximumSize range. :/
185 int W = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), minWidthcxx . . $ DockableWidgetLayout#minWidth., maxWidthcxx . . $ DockableWidgetLayout#maxWidth. );
186 int H = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).(), minHeightcxx . . $ DockableWidgetLayout#minHeight., maxHeightcxx . . $ DockableWidgetLayout#maxHeight.);
187
188 // set main widget size
189 int dx = W - layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth.;
190 int dy = H - layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight.;
191
192 if (dx != 0 || dy != 0) {
193 sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(dx, dy);
194 calcSizeLimitscxx . . $ DockableWidgetLayout#calcSizeLimits(49f6e7a06ebc5aa8).();
195 }
196
197 // resize the widgets
198 for (auto* d : dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.) {
199 if (!d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).()) {
200 d->itemcxx . . $ DockableWidgetLayout#DockInfo#item.->setGeometrycxx . . $ QLayoutItem#setGeometry(22ba0428947158b).(d->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).());
201 }
202 }
203 }
204
205 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::calcSizeLimitscxx . . $ DockableWidgetLayout#calcSizeLimits(49f6e7a06ebc5aa8).()
206 {
207 if (dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) return;
208
209 // layout with current sizes
210 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).();
211 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..firstcxx . . $ QList#first(19b2b6f17af048b).();
212
213 // store current size
214 int curWidth = d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
215 int curHeight = d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
216 QVectorcxx . . $ QVector#<int> distStorecxx . . $ QVector#QVector(ced63f7c635d850d).;
217 for (auto* d : dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.) {
218 distStore.push_backcxx . . $ QVector#push_back(77d9f17553126ecb).(d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.);
219 }
220
221 // first check minimum width (blunt method)
222 for (int i = d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->minimumWidthcxx . . $ QWidget#minimumWidth(455f465bc33b4cdf).(); i <= curWidth; ++i) {
223 // trial layout
224 sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(i - d->widthcxx . . $ DockableWidgetLayout#DockInfo#width., 0);
225 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).(true);
226 // restore
227 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = curWidth;
228 for (int j = 1; j < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++j) {
229 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(j)->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. = distStore.atcxx . . $ QVector#at(e2681f9bb6b2f357).(j);
230 }
231 // check result
232 if (layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight. == checkHeightcxx . . $ DockableWidgetLayout#checkHeight. &&
233 layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth. - checkWidthcxx . . $ DockableWidgetLayout#checkWidth. == d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. - i) {
234 break;
235 }
236 }
237 minWidthcxx . . $ DockableWidgetLayout#minWidth. = checkWidthcxx . . $ DockableWidgetLayout#checkWidth.;
238
239 // first check maximum width (blunt method)
240 for (int i = d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->maximumWidthcxx . . $ QWidget#maximumWidth(455f465bc33b4cdf).(); i >= curWidth; --i) {
241 // trial layout
242 sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(i - d->widthcxx . . $ DockableWidgetLayout#DockInfo#width., 0);
243 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).(true);
244 // restore
245 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = curWidth;
246 for (int j = 1; j < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++j) {
247 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(j)->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. = distStore.atcxx . . $ QVector#at(e2681f9bb6b2f357).(j);
248 }
249 // check result
250 if (layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight. == checkHeightcxx . . $ DockableWidgetLayout#checkHeight. &&
251 layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth. - checkWidthcxx . . $ DockableWidgetLayout#checkWidth. == d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. - i) {
252 break;
253 }
254 }
255 maxWidthcxx . . $ DockableWidgetLayout#maxWidth. = checkWidthcxx . . $ DockableWidgetLayout#checkWidth.;
256
257 // first check minimum height (blunt method)
258 for (int i = d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->minimumHeightcxx . . $ QWidget#minimumHeight(455f465bc33b4cdf).(); i <= curHeight; ++i) {
259 // trial layout
260 sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(0, i - d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.);
261 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).(true);
262 // restore
263 d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = curHeight;
264 for (int j = 1; j < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++j) {
265 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(j)->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. = distStore.atcxx . . $ QVector#at(e2681f9bb6b2f357).(j);
266 }
267 // check result
268 if (layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth. == checkWidthcxx . . $ DockableWidgetLayout#checkWidth. &&
269 layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight. - checkHeightcxx . . $ DockableWidgetLayout#checkHeight. == d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. - i) {
270 break;
271 }
272 }
273 minHeightcxx . . $ DockableWidgetLayout#minHeight. = checkHeightcxx . . $ DockableWidgetLayout#checkHeight.;
274
275 // first check maximum width (blunt method)
276 for (int i = d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->maximumHeightcxx . . $ QWidget#maximumHeight(455f465bc33b4cdf).(); i >= curHeight; --i) {
277 // trial layout
278 sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(0, i - d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.);
279 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).(true);
280 // restore
281 d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = curHeight;
282 for (int j = 1; j < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++j) {
283 dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(j)->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. = distStore.atcxx . . $ QVector#at(e2681f9bb6b2f357).(j);
284 }
285 // check result
286 if (layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth. == checkWidthcxx . . $ DockableWidgetLayout#checkWidth. &&
287 layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight. - checkHeightcxx . . $ DockableWidgetLayout#checkHeight. == d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. - i) {
288 break;
289 }
290 }
291 maxHeightcxx . . $ DockableWidgetLayout#maxHeight. = checkHeightcxx . . $ DockableWidgetLayout#checkHeight.;
292
293 // restore layout
294 doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).();
295 }
296
297 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::sizeMovecxx . . $ DockableWidgetLayout#sizeMove(3e454b8ccf442868).(int dx, int dy)
298 {
299 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d0 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..firstcxx . . $ QList#first(19b2b6f17af048b).();
300 for (int i = 1; i < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) {
301 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
302 if (d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. == TOPcxx . . $ DockableWidgetLayout#TOP. || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. == BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.) {
303 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= d0->widthcxx . . $ DockableWidgetLayout#DockInfo#width.) {
304 d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. += dx;
305 }
306 }
307 if (d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. == LEFTcxx . . $ DockableWidgetLayout#LEFT. || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. == RIGHTcxx . . $ DockableWidgetLayout#RIGHT.) {
308 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= d0->heightcxx . . $ DockableWidgetLayout#DockInfo#height.) {
309 d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. += dy;
310 }
311 }
312 }
313 d0->widthcxx . . $ DockableWidgetLayout#DockInfo#width. += dx;
314 d0->heightcxx . . $ DockableWidgetLayout#DockInfo#height. += dy;
315 }
316
317 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::doLayoutcxx . . $ DockableWidgetLayout#doLayout(b45ddcbc8423892c).(bool check)
318 {
319 if (dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) return;
320
321 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..firstcxx . . $ QList#first(19b2b6f17af048b).();
322 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = 0;
323 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = 0;
324 int W = d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
325 int H = d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
326
327 int dx = 0, dy = 0;
328 for (int i = 1; i < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) {
329 d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i];
330 // only process visible widgets
331 if (d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).()) {
332 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = -10000;
333 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = -10000;
334 continue;
335 }
336 // determine size
337 if (d->useHintWidthcxx . . $ DockableWidgetLayout#DockInfo#useHintWidth.) {
338 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. = d->itemcxx . . $ DockableWidgetLayout#DockInfo#item.->sizeHintcxx . . $ QLayoutItem#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).();
339 }
340 if (d->useHintHeightcxx . . $ DockableWidgetLayout#DockInfo#useHintHeight.) {
341 d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. = d->itemcxx . . $ DockableWidgetLayout#DockInfo#item.->sizeHintcxx . . $ QLayoutItem#sizeHint(4b3b776e5ee2b367).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).();
342 }
343 // determine location
344 switch (d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide.) {
345 case TOPcxx . . $ DockableWidgetLayout#TOP.:
346 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.;
347 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= W || d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.+d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. <= 0) {
348 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = H - d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
349 } else {
350 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = -d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
351 }
352 // adjust position until it doesn't overlap other widgets
353 for (int j = 1; j < i; ++j) {
354 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
355 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left., d->topcxx . . $ DockableWidgetLayout#DockInfo#top. - QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!,
356 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width., d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. + QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!);
357 if (r.intersectscxx . . $ QRect#intersects(d6968d7435602737).(d2->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).())) {
358 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = d2->topcxx . . $ DockableWidgetLayout#DockInfo#top. - d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
359 }
360 }
361 break;
362 case LEFTcxx . . $ DockableWidgetLayout#LEFT.:
363 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.;
364 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= H || d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.+d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. <= 0) {
365 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = W - d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
366 } else {
367 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = -d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
368 }
369 // adjust position until it doesn't overlap other widgets
370 for (int j = 1; j < i; ++j) {
371 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
372 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. - QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!, d->topcxx . . $ DockableWidgetLayout#DockInfo#top.,
373 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. + QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!, d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.);
374 if (r.intersectscxx . . $ QRect#intersects(d6968d7435602737).(d2->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).())) {
375 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left. - d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
376 }
377 }
378 break;
379 case RIGHTcxx . . $ DockableWidgetLayout#RIGHT.:
380 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.;
381 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= H || d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.+d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. <= 0) {
382 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = 0;
383 } else {
384 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = W;
385 }
386 // adjust position until it doesn't overlap other widgets
387 for (int j = 1; j < i; ++j) {
388 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
389 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left., d->topcxx . . $ DockableWidgetLayout#DockInfo#top.,
390 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. + QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!, d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.);
391 if (r.intersectscxx . . $ QRect#intersects(d6968d7435602737).(d2->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).())) {
392 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left. + d2->widthcxx . . $ DockableWidgetLayout#DockInfo#width.;
393 }
394 }
395 break;
396 case BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.:
397 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. = d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.;
398 if (d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance. >= W || d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.+d->widthcxx . . $ DockableWidgetLayout#DockInfo#width. <= 0) {
399 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = 0;
400 } else {
401 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = H;
402 }
403 // adjust position until it doesn't overlap other widgets
404 for (int j = 1; j < i; ++j) {
405 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
406 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left., d->topcxx . . $ DockableWidgetLayout#DockInfo#top.,
407 d->widthcxx . . $ DockableWidgetLayout#DockInfo#width., d->heightcxx . . $ DockableWidgetLayout#DockInfo#height. + QWIDGETSIZE_MAXcxx . . $ `<external>/17274239923536813539/qwidget.h:888:9`!);
408 if (r.intersectscxx . . $ QRect#intersects(d6968d7435602737).(d2->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).())) {
409 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. = d2->topcxx . . $ DockableWidgetLayout#DockInfo#top. + d2->heightcxx . . $ DockableWidgetLayout#DockInfo#height.;
410 }
411 }
412 break;
413 }
414 // check negative coordinates
415 if (d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. < dx) dx = d->leftcxx . . $ DockableWidgetLayout#DockInfo#left.;
416 if (d->topcxx . . $ DockableWidgetLayout#DockInfo#top. < dy) dy = d->topcxx . . $ DockableWidgetLayout#DockInfo#top.;
417 }
418
419 // translate widgets and calculate size
420 int& w = check ? checkWidthcxx . . $ DockableWidgetLayout#checkWidth. : layoutWidthcxx . . $ DockableWidgetLayout#layoutWidth.;
421 int& h = check ? checkHeightcxx . . $ DockableWidgetLayout#checkHeight. : layoutHeightcxx . . $ DockableWidgetLayout#layoutHeight.;
422 w = h = 0;
423 for (auto* d : dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.) {
424 if (!d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).()) {
425 d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. -= dx;
426 d->topcxx . . $ DockableWidgetLayout#DockInfo#top. -= dy;
427 w = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(w, d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
428 h = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(h, d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
429 }
430 }
431 }
432
433 bool DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(const QRectcxx . . $ QRect#& r, int n) const
434 {
435 for (int i = 0; i < n; ++i) {
436 if (r.intersectscxx . . $ QRect#intersects(d6968d7435602737).(dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(e2681f9bb6b2f357).i]->boundscxx . . $ DockableWidgetLayout#DockInfo#bounds(d857385bac04cbf7).())) {
437 return true;
438 }
439 }
440 return false;
441 }
442
443 static bool isClosecxx . . $ isClose(cf9ef193275fa6d8).(int a, int b)
444 {
445 return abs(a - b) < SNAP_DISTANCEcxx . . $ SNAP_DISTANCE.;
446 }
447
448 bool DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::insertLocationcxx . . $ DockableWidgetLayout#insertLocation(f87c210062199149).(
449 QRectcxx . . $ QRect#& rect, int& index, DockSidecxx . . $ DockableWidgetLayout#DockSide#& side, const QSizePolicycxx . . $ QSizePolicy#& sizePol)
450 {
451 // best insertion data
452 // Distance is a number that represents the how far
453 // the insertion rectangle is from the final location.
454 unsigned bestDistance = 0xFFFFFFFF;
455 int bestIndex = 0;
456 DockSidecxx . . $ DockableWidgetLayout#DockSide# bestSide;
457 QRectcxx . . $ QRect# bestRectcxx . . $ QRect#QRect(ced63f7c635d850d).;
458
459 // loop over all widgets and find appropriate matching sides
460 for (int i = 0; i < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) {
461 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i];
462 /*****************************************************
463 * Check for placement against the top of the widget *
464 *****************************************************/
465 if (i == 0 || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. != BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.) {
466 if (!(rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() > d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).() - SNAP_DISTANCEcxx . . $ SNAP_DISTANCE. ||
467 rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).() < d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. + SNAP_DISTANCEcxx . . $ SNAP_DISTANCE.) &&
468 isClosecxx . . $ isClose(cf9ef193275fa6d8).(rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).(), d->topcxx . . $ DockableWidgetLayout#DockInfo#top.)) {
469 // rectangle is close to the edge
470 unsigned dist = 8 * abs(rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).() - d->topcxx . . $ DockableWidgetLayout#DockInfo#top.);
471 // now find all points on this side
472 // (use set as a sorted unique list)
473 QSetcxx . . $ QSet#<int> sidePointscxx . . $ QSet#QSet(ced63f7c635d850d).;
474 for (int j = 0; j <= i; ++j) {
475 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
476 if (d->topcxx . . $ DockableWidgetLayout#DockInfo#top. == d2->topcxx . . $ DockableWidgetLayout#DockInfo#top.) {
477 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left.);
478 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
479 // check if any other widget rest against this side
480 for (int k = i + 1; k < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++k) {
481 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d3 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).k];
482 if (d3->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).() == d2->topcxx . . $ DockableWidgetLayout#DockInfo#top.) {
483 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->leftcxx . . $ DockableWidgetLayout#DockInfo#left.);
484 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
485 }
486 }
487 }
488 }
489 // widget placement can occur at all points, find the closest
490 auto it = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).();
491 for (int j = 0; j < sidePoints.sizecxx . . $ QSet#size(455f465bc33b4cdf).() - 1; ++j) {
492 // check after point
493 unsigned newDist1 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).());
494 if (newDist1 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).())) {
495 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, d->topcxx . . $ DockableWidgetLayout#DockInfo#top. - rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
496 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
497 bestDistance = newDist1;
498 bestIndex = i + 1;
499 bestSide = TOPcxx . . $ DockableWidgetLayout#TOP.;
500 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
501 }
502 }
503 ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).it;
504 // check before point
505 unsigned newDist2 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).());
506 if (newDist2 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).())) {
507 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), d->topcxx . . $ DockableWidgetLayout#DockInfo#top. - rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()),
508 rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
509 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
510 bestDistance = newDist2;
511 bestIndex = i + 1;
512 bestSide = TOPcxx . . $ DockableWidgetLayout#TOP.;
513 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
514 }
515 }
516 }
517 // check for resized placement options
518 if (sizePol.horizontalPolicycxx . . $ QSizePolicy#horizontalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed.) {
519 int mid = rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() + rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).() / 2;
520 for (auto ita = stdcxx . . $ std/::nextcxx . . $ std/next(31d62cd24490f169).(sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).()); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). sidePoints.endcxx . . $ QSet#end(d7eb3e99549f6811).(); ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).ita) {
521 for (auto itb = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).(); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). itb; ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).itb) {
522 int sp_mid = (*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita + *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb) / 2;
523 int sp_diff = *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita - *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb;
524 if (isClosecxx . . $ isClose(cf9ef193275fa6d8).(sp_mid, mid)) {
525 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb, d->topcxx . . $ DockableWidgetLayout#DockInfo#top. - rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).(),
526 sp_diff, rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).());
527 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
528 bestDistance = dist + abs(sp_mid - mid);
529 bestIndex = i + 1;
530 bestSide = TOPcxx . . $ DockableWidgetLayout#TOP.;
531 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
532 }
533 }
534 }
535 }
536 }
537 }
538 }
539
540 /********************************************************
541 * Check for placement against the bottom of the widget *
542 ********************************************************/
543 if (i == 0 || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. != TOPcxx . . $ DockableWidgetLayout#TOP.) {
544 if (!(rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() > d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).() - SNAP_DISTANCEcxx . . $ SNAP_DISTANCE. ||
545 rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).() < d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. + SNAP_DISTANCEcxx . . $ SNAP_DISTANCE.) &&
546 isClosecxx . . $ isClose(cf9ef193275fa6d8).(rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).(), d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).())) {
547 // rectangle is close to the edge
548 unsigned dist = 8 * abs(rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).() - d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
549 // now find all points on this side
550 // (use set as a sorted unique list)
551 QSetcxx . . $ QSet#<int> sidePointscxx . . $ QSet#QSet(ced63f7c635d850d).;
552 for (int j = 0; j <= i; ++j) {
553 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
554 if (d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).() == d2->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).()) {
555 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left.);
556 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
557 // check if any other widget rest against this side
558 for (int k = i + 1; k < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++k) {
559 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d3 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).k];
560 if (d3->topcxx . . $ DockableWidgetLayout#DockInfo#top. == d2->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).()) {
561 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->leftcxx . . $ DockableWidgetLayout#DockInfo#left.);
562 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
563 }
564 }
565 }
566 }
567 // widget placement can occur at all points, find the closest
568 auto it = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).();
569 for (int j = 0; j < sidePoints.sizecxx . . $ QSet#size(455f465bc33b4cdf).() - 1; ++j) {
570 // check after point
571 unsigned newDist1 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).());
572 if (newDist1 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).())) {
573 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).()), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
574 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
575 bestDistance = newDist1;
576 bestIndex = i + 1;
577 bestSide = BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.;
578 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
579 }
580 }
581 ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).it;
582 // check before point
583 unsigned newDist2 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).());
584 if (newDist2 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).())) {
585 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).()), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
586 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
587 bestDistance = newDist2;
588 bestIndex = i + 1;
589 bestSide = BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.;
590 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
591 }
592 }
593 }
594 // check for resized placement options
595 if (sizePol.horizontalPolicycxx . . $ QSizePolicy#horizontalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed.) {
596 int mid = rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() + rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).() / 2;
597 for (auto ita = stdcxx . . $ std/::nextcxx . . $ std/next(31d62cd24490f169).(sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).()); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). sidePoints.endcxx . . $ QSet#end(d7eb3e99549f6811).(); ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).ita) {
598 for (auto itb = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).(); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). itb; ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).itb) {
599 int sp_mid = (*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita + *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb) / 2;
600 int sp_diff = *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita - *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb;
601 if (isClosecxx . . $ isClose(cf9ef193275fa6d8).(sp_mid, mid)) {
602 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb, d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).(),
603 sp_diff, rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).());
604 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
605 bestDistance = dist + abs(sp_mid - mid);
606 bestIndex = i + 1;
607 bestSide = BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.;
608 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
609 }
610 }
611 }
612 }
613 }
614 }
615 }
616
617 /******************************************************
618 * Check for placement against the left of the widget *
619 ******************************************************/
620 if (i == 0 || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. != RIGHTcxx . . $ DockableWidgetLayout#RIGHT.) {
621 if (!(rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).() > d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).() - SNAP_DISTANCEcxx . . $ SNAP_DISTANCE. ||
622 rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).() < d->topcxx . . $ DockableWidgetLayout#DockInfo#top. + SNAP_DISTANCEcxx . . $ SNAP_DISTANCE.) &&
623 isClosecxx . . $ isClose(cf9ef193275fa6d8).(rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).(), d->leftcxx . . $ DockableWidgetLayout#DockInfo#left.)) {
624 // rectangle is close to the edge
625 unsigned dist = 8 * abs(rect.rightcxx . . $ QRect#right(ea6fe5115c70a13f).() - d->leftcxx . . $ DockableWidgetLayout#DockInfo#left.);
626 // now find all points on this side
627 // (use set as a sorted unique list)
628 QSetcxx . . $ QSet#<int> sidePointscxx . . $ QSet#QSet(ced63f7c635d850d).;
629 for (int j = 0; j <= i; ++j) {
630 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
631 if (d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. == d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left.) {
632 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->topcxx . . $ DockableWidgetLayout#DockInfo#top.);
633 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
634 // check if any other widget rest against this side
635 for (int k = i + 1; k < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++k) {
636 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d3 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).k];
637 if (d3->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).() == d2->leftcxx . . $ DockableWidgetLayout#DockInfo#left.) {
638 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->topcxx . . $ DockableWidgetLayout#DockInfo#top.);
639 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
640 }
641 }
642 }
643 }
644 // widget placement can occur at all points, find the closest
645 auto it = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).();
646 for (int j = 0; j < sidePoints.sizecxx . . $ QSet#size(455f465bc33b4cdf).() - 1; ++j) {
647 // check after point
648 unsigned newDist1 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).());
649 if (newDist1 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).())) {
650 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. - rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
651 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
652 bestDistance = newDist1;
653 bestIndex = i + 1;
654 bestSide = LEFTcxx . . $ DockableWidgetLayout#LEFT.;
655 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
656 }
657 }
658 ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).it;
659 // check before point
660 unsigned newDist2 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).());
661 if (newDist2 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).())) {
662 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. - rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()),
663 rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
664 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
665 bestDistance = newDist2;
666 bestIndex = i + 1;
667 bestSide = LEFTcxx . . $ DockableWidgetLayout#LEFT.;
668 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
669 }
670 }
671 }
672 // check for resized placement options
673 if (sizePol.verticalPolicycxx . . $ QSizePolicy#verticalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed.) {
674 int mid = rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).() + rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).() / 2;
675 for (auto ita = stdcxx . . $ std/::nextcxx . . $ std/next(31d62cd24490f169).(sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).()); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). sidePoints.endcxx . . $ QSet#end(d7eb3e99549f6811).(); ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).ita) {
676 for (auto itb = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).(); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). itb; ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).itb) {
677 int sp_mid = (*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita + *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb) / 2;
678 int sp_diff = *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita - *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb;
679 if (isClosecxx . . $ isClose(cf9ef193275fa6d8).(sp_mid, mid)) {
680 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. - rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb,
681 rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), sp_diff);
682 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
683 bestDistance = dist + abs(sp_mid - mid);
684 bestIndex = i + 1;
685 bestSide = LEFTcxx . . $ DockableWidgetLayout#LEFT.;
686 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
687 }
688 }
689 }
690 }
691 }
692 }
693 }
694 /*******************************************************
695 * Check for placement against the right of the widget *
696 *******************************************************/
697 if (i == 0 || d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide. != LEFTcxx . . $ DockableWidgetLayout#LEFT.) {
698 if (!(rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).() > d->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).() - SNAP_DISTANCEcxx . . $ SNAP_DISTANCE. ||
699 rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).() < d->topcxx . . $ DockableWidgetLayout#DockInfo#top. + SNAP_DISTANCEcxx . . $ SNAP_DISTANCE.) &&
700 isClosecxx . . $ isClose(cf9ef193275fa6d8).(rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).(), d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).())) {
701 // rectangle is close to the edge
702 unsigned dist = 8 * abs(rect.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() - d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).());
703 // now find all points on this side
704 // (use set as a sorted unique list)
705 QSetcxx . . $ QSet#<int> sidePointscxx . . $ QSet#QSet(ced63f7c635d850d).;
706 for (int j = 0; j <= i; ++j) {
707 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d2 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).j];
708 if (d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).() == d2->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).()) {
709 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->topcxx . . $ DockableWidgetLayout#DockInfo#top.);
710 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d2->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
711 // check if any other widget rest against this side
712 for (int k = i + 1; k < dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++k) {
713 DockInfocxx . . $ DockableWidgetLayout#DockInfo#* d3 = dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).k];
714 if (d3->leftcxx . . $ DockableWidgetLayout#DockInfo#left. == d2->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).()) {
715 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->topcxx . . $ DockableWidgetLayout#DockInfo#top.);
716 sidePoints.insertcxx . . $ QSet#insert(b1720532d625d779).(d3->bottomcxx . . $ DockableWidgetLayout#DockInfo#bottom(455f465bc33b4cdf).());
717 }
718 }
719 }
720 }
721 // widget placement can occur at all points, find the closest
722 auto it = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).();
723 for (int j = 0; j < sidePoints.sizecxx . . $ QSet#size(455f465bc33b4cdf).() - 1; ++j) {
724 // check after point
725 unsigned newDist1 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).());
726 if (newDist1 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).())) {
727 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(d->leftcxx . . $ DockableWidgetLayout#DockInfo#left. + d->widthcxx . . $ DockableWidgetLayout#DockInfo#width., *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
728 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
729 bestDistance = newDist1;
730 bestIndex = i + 1;
731 bestSide = RIGHTcxx . . $ DockableWidgetLayout#RIGHT.;
732 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
733 }
734 }
735 ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).it;
736 // check before point
737 unsigned newDist2 = dist + abs(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).());
738 if (newDist2 < bestDistance && isClosecxx . . $ isClose(cf9ef193275fa6d8).(*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it, rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).())) {
739 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(250dfd8bdd830e67).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).(), *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).it - rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()), rect.sizecxx . . $ QRect#size(31eef80d4686a819).());
740 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
741 bestDistance = newDist2;
742 bestIndex = i + 1;
743 bestSide = RIGHTcxx . . $ DockableWidgetLayout#RIGHT.;
744 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
745 }
746 }
747 }
748 // check for resized placement options
749 if (sizePol.verticalPolicycxx . . $ QSizePolicy#verticalPolicy(6b16d495c389cba3).() != QSizePolicycxx . . $ QSizePolicy#::Fixedcxx . . $ QSizePolicy#Fixed.) {
750 int mid = rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).() + rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).() / 2;
751 for (auto ita = stdcxx . . $ std/::nextcxx . . $ std/next(31d62cd24490f169).(sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).()); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). sidePoints.endcxx . . $ QSet#end(d7eb3e99549f6811).(); ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).ita) {
752 for (auto itb = sidePoints.begincxx . . $ QSet#begin(d7eb3e99549f6811).(); ita !=cxx . . $ QSet#iterator#`operator!=`(b5fc6e983c850534). itb; ++cxx . . $ QSet#iterator#operator++(9abfca464535b67e).itb) {
753 int sp_mid = (*cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita + *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb) / 2;
754 int sp_diff = *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).ita - *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb;
755 if (isClosecxx . . $ isClose(cf9ef193275fa6d8).(sp_mid, mid)) {
756 QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(d->rightcxx . . $ DockableWidgetLayout#DockInfo#right(455f465bc33b4cdf).(), *cxx . . $ QSet#iterator#`operator*`(ea465e50d690edfe).itb, rect.widthcxx . . $ QRect#width(ea6fe5115c70a13f).(), sp_diff);
757 if (!overlaysWithFirstNWidgetscxx . . $ DockableWidgetLayout#overlaysWithFirstNWidgets(73ad366572e2c50b).(r, i)) {
758 bestDistance = dist + abs(sp_mid - mid);
759 bestIndex = i + 1;
760 bestSide = RIGHTcxx . . $ DockableWidgetLayout#RIGHT.;
761 bestRect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). r;
762 }
763 }
764 }
765 }
766 }
767 }
768 }
769 }
770
771 if (bestIndex) {
772 rect =cxx . . $ QRect#`operator=`(7cfd2b8ed4e6a4e). bestRect;
773 index = bestIndex;
774 side = bestSide;
775 return true;
776 } else {
777 return false;
778 }
779 }
780
781 bool DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::insertLocationcxx . . $ DockableWidgetLayout#insertLocation(65291bfbcdcf84fd).(QRectcxx . . $ QRect#& rect, const QSizePolicycxx . . $ QSizePolicy#& sizePol)
782 {
783 int index;
784 DockSidecxx . . $ DockableWidgetLayout#DockSide# side;
785 return insertLocationcxx . . $ DockableWidgetLayout#insertLocation(f87c210062199149).(rect, index, side, sizePol);
786 }
787
788 void DockableWidgetLayoutcxx . . $ DockableWidgetLayout#::getConfigcxx . . $ DockableWidgetLayout#getConfig(f9511dba40b58c57).(QStringListcxx . . $ QStringList#& list)
789 {
790 for (auto* d : dockedWidgetscxx . . $ DockableWidgetLayout#dockedWidgets.) {
791 // string format D [Hidden/Visible] [Side] [Distance] [Width] [Height]
792 QStringcxx . . $ QString# scxx . . $ QString#QString(85c52e162fed56f9).("%1 D %2 %3 %4 %5 %6");
793 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).(d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->idcxx . . $ DockableWidget#id(a2fb7a6ce195d51).());
794
795 if (d->widgetcxx . . $ DockableWidgetLayout#DockInfo#widget.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).()) {
796 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("H"cxx . . $ QString#QString(85c52e162fed56f9).);
797 } else {
798 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("V"cxx . . $ QString#QString(85c52e162fed56f9).);
799 }
800
801 switch (d->dockSidecxx . . $ DockableWidgetLayout#DockInfo#dockSide.) {
802 case TOPcxx . . $ DockableWidgetLayout#TOP.:
803 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("T"cxx . . $ QString#QString(85c52e162fed56f9).);
804 break;
805 case LEFTcxx . . $ DockableWidgetLayout#LEFT.:
806 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("L"cxx . . $ QString#QString(85c52e162fed56f9).);
807 break;
808 case RIGHTcxx . . $ DockableWidgetLayout#RIGHT.:
809 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("R"cxx . . $ QString#QString(85c52e162fed56f9).);
810 break;
811 case BOTTOMcxx . . $ DockableWidgetLayout#BOTTOM.:
812 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(bc823072288cbbb5).("B"cxx . . $ QString#QString(85c52e162fed56f9).);
813 break;
814 }
815
816 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(64ab2ed17cc11715).(d->dockDistancecxx . . $ DockableWidgetLayout#DockInfo#dockDistance.);
817
818 if (d->useHintWidthcxx . . $ DockableWidgetLayout#DockInfo#useHintWidth.) {
819 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(64ab2ed17cc11715).(-1);
820 } else {
821 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(64ab2ed17cc11715).(d->widthcxx . . $ DockableWidgetLayout#DockInfo#width.);
822 }
823
824 if (d->useHintHeightcxx . . $ DockableWidgetLayout#DockInfo#useHintHeight.) {
825 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(64ab2ed17cc11715).(-1);
826 } else {
827 s =cxx . . $ QString#`operator=`(4f35bf974e7f8568). s.argcxx . . $ QString#arg(64ab2ed17cc11715).(d->heightcxx . . $ DockableWidgetLayout#DockInfo#height.);
828 }
829 list.appendcxx . . $ QList#append(77d9f17553126ecb).(s);
830 }
831 }