qwidgetresizehandler.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qwidgetresizehandler.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8static bool resizeHorizontalDirectionFixed = false;-
9static bool resizeVerticalDirectionFixed = false;-
10-
11-
12-
13-
14-
15QWidgetResizeHandler::QWidgetResizeHandler(QWidget *parent, QWidget *cw)-
16 : QObject(parent), widget(parent), childWidget(cw ? cw : parent),-
17 fw(0), extrahei(0), buttonDown(false), moveResizeMode(false), sizeprotect(true), movingEnabled(true)-
18{-
19 mode = Nowhere;-
20 widget->setMouseTracking(true);-
21 QFrame *frame = qobject_cast<QFrame*>(widget);-
22 range = frame
frameDescription
TRUEnever evaluated
FALSEnever evaluated
? frame->frameWidth() : 4;
0
23 range = qMax(4, range);-
24 activeForMove = activeForResize = true;-
25 widget->installEventFilter(this);-
26}
never executed: end of block
0
27-
28void QWidgetResizeHandler::setActive(Action ac, bool b)-
29{-
30 if (ac & Move
ac & MoveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
31 activeForMove = b;
never executed: activeForMove = b;
0
32 if (ac & Resize
ac & ResizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
33 activeForResize = b;
never executed: activeForResize = b;
0
34-
35 if (!isActive()
!isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
36 setMouseCursor(Nowhere);
never executed: setMouseCursor(Nowhere);
0
37}
never executed: end of block
0
38-
39bool QWidgetResizeHandler::isActive(Action ac) const-
40{-
41 bool b = false;-
42 if (ac & Move
ac & MoveDescription
TRUEnever evaluated
FALSEnever evaluated
) b = activeForMove;
never executed: b = activeForMove;
0
43 if (ac & Resize
ac & ResizeDescription
TRUEnever evaluated
FALSEnever evaluated
) b |= activeForResize;
never executed: b |= activeForResize;
0
44-
45 return
never executed: return b;
b;
never executed: return b;
0
46}-
47-
48bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)-
49{-
50 if (!isActive()
!isActive()Description
TRUEnever evaluated
FALSEnever evaluated
0
51 || (ee->type() != QEvent::MouseButtonPress
ee->type() != ...useButtonPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
52 && ee->type() != QEvent::MouseButtonRelease
ee->type() != ...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
53 && ee->type() != QEvent::MouseMove
ee->type() != ...ent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
54 && ee->type() != QEvent::KeyPress
ee->type() != QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
55 && ee->type() != QEvent::ShortcutOverride
ee->type() != ...ortcutOverrideDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
56 )-
57 return
never executed: return false;
false;
never executed: return false;
0
58-
59 ((!(o == widget)) ? qt_assert("o == widget",__FILE__,107) : qt_noop());-
60 QWidget *w = widget;-
61 if (QApplication::activePopupWidget()
QApplication::...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
62 if (buttonDown
buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
&& ee->type() == QEvent::MouseButtonRelease
ee->type() == ...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
63 buttonDown = false;
never executed: buttonDown = false;
0
64 return
never executed: return false;
false;
never executed: return false;
0
65 }-
66-
67 QMouseEvent *e = (QMouseEvent*)ee;-
68 switch (e->type()) {-
69 case
never executed: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
{
0
70 if (w->isMaximized()
w->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
71 break;
never executed: break;
0
72 if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos()))
!widget->rect(...>globalPos()))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
73 return
never executed: return false;
false;
never executed: return false;
0
74 if (e->button() == Qt::LeftButton
e->button() == Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
75 buttonDown = false;-
76 activate();-
77 bool me = movingEnabled;-
78 movingEnabled = (me
meDescription
TRUEnever evaluated
FALSEnever evaluated
&& o == widget
o == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
79 mouseMoveEvent(e);-
80 movingEnabled = me;-
81 buttonDown = true;-
82 moveOffset = widget->mapFromGlobal(e->globalPos());-
83 invertedMoveOffset = widget->rect().bottomRight() - moveOffset;-
84 if (mode == Center
mode == CenterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
85 if (movingEnabled
movingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
86 return
never executed: return true;
true;
never executed: return true;
0
87 }
never executed: end of block
else {
0
88 return
never executed: return true;
true;
never executed: return true;
0
89 }-
90 }-
91 } break;
never executed: break;
0
92 case
never executed: case QEvent::MouseButtonRelease:
QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
93 if (w->isMaximized()
w->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
94 break;
never executed: break;
0
95 if (e->button() == Qt::LeftButton
e->button() == Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
96 moveResizeMode = false;-
97 buttonDown = false;-
98 widget->releaseMouse();-
99 widget->releaseKeyboard();-
100 if (mode == Center
mode == CenterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 if (movingEnabled
movingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
102 return
never executed: return true;
true;
never executed: return true;
0
103 }
never executed: end of block
else {
0
104 return
never executed: return true;
true;
never executed: return true;
0
105 }-
106 }-
107 break;
never executed: break;
0
108 case
never executed: case QEvent::MouseMove:
QEvent::MouseMove:
never executed: case QEvent::MouseMove:
{
0
109 if (w->isMaximized()
w->isMaximized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
110 break;
never executed: break;
0
111 buttonDown = buttonDown
buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(e->buttons() ...t::LeftButton)Description
TRUEnever evaluated
FALSEnever evaluated
e->buttons() & Qt::LeftButton)
(e->buttons() ...t::LeftButton)Description
TRUEnever evaluated
FALSEnever evaluated
;
0
112 bool me = movingEnabled;-
113 movingEnabled = (me
meDescription
TRUEnever evaluated
FALSEnever evaluated
&& o == widget
o == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
&& (buttonDown
buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
|| moveResizeMode
moveResizeModeDescription
TRUEnever evaluated
FALSEnever evaluated
));
0
114 mouseMoveEvent(e);-
115 movingEnabled = me;-
116 if (mode == Center
mode == CenterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
117 if (movingEnabled
movingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
118 return
never executed: return true;
true;
never executed: return true;
0
119 }
never executed: end of block
else {
0
120 return
never executed: return true;
true;
never executed: return true;
0
121 }-
122 } break;
never executed: break;
0
123 case
never executed: case QEvent::KeyPress:
QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
124 keyPressEvent((QKeyEvent*)e);-
125 break;
never executed: break;
0
126 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
127 if (buttonDown
buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
128 ((QKeyEvent*)ee)->accept();-
129 return
never executed: return true;
true;
never executed: return true;
0
130 }-
131 break;
never executed: break;
0
132 default
never executed: default:
:
never executed: default:
0
133 break;
never executed: break;
0
134 }-
135-
136 return
never executed: return false;
false;
never executed: return false;
0
137}-
138-
139void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)-
140{-
141 QPoint pos = widget->mapFromGlobal(e->globalPos());-
142 if (!moveResizeMode
!moveResizeModeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !buttonDown
!buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
143 if (pos.y() <= range
pos.y() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() <= range
pos.x() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
144 mode = TopLeft;
never executed: mode = TopLeft;
0
145 else if (pos.y() >= widget->height()-range
pos.y() >= wid...height()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() >= widget->width()-range
pos.x() >= wid...>width()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
146 mode = BottomRight;
never executed: mode = BottomRight;
0
147 else if (pos.y() >= widget->height()-range
pos.y() >= wid...height()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() <= range
pos.x() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
148 mode = BottomLeft;
never executed: mode = BottomLeft;
0
149 else if (pos.y() <= range
pos.y() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
&& pos.x() >= widget->width()-range
pos.x() >= wid...>width()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
150 mode = TopRight;
never executed: mode = TopRight;
0
151 else if (pos.y() <= range
pos.y() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
152 mode = Top;
never executed: mode = Top;
0
153 else if (pos.y() >= widget->height()-range
pos.y() >= wid...height()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
154 mode = Bottom;
never executed: mode = Bottom;
0
155 else if (pos.x() <= range
pos.x() <= rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
156 mode = Left;
never executed: mode = Left;
0
157 else if ( pos.x() >= widget->width()-range
pos.x() >= wid...>width()-rangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
158 mode = Right;
never executed: mode = Right;
0
159 else if (widget->rect().contains(pos)
widget->rect().contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
160 mode = Center;
never executed: mode = Center;
0
161 else-
162 mode = Nowhere;
never executed: mode = Nowhere;
0
163-
164 if (widget->isMinimized()
widget->isMinimized()Description
TRUEnever evaluated
FALSEnever evaluated
|| !isActive(Resize)
!isActive(Resize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
165 mode = Center;
never executed: mode = Center;
0
166-
167 setMouseCursor(mode);-
168-
169 return;
never executed: return;
0
170 }-
171-
172 if (mode == Center
mode == CenterDescription
TRUEnever evaluated
FALSEnever evaluated
&& !movingEnabled
!movingEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
173 return;
never executed: return;
0
174-
175 if (widget->testAttribute(Qt::WA_WState_ConfigPending)
widget->testAt...ConfigPending)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
176 return;
never executed: return;
0
177-
178-
179 QPoint globalPos = (!widget->isWindow()
!widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& widget->parentWidget()
widget->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
) ?
0
180 widget->parentWidget()->mapFromGlobal(e->globalPos()) : e->globalPos();-
181 if (!widget->isWindow()
!widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
&& !widget->parentWidget()->rect().contains(globalPos)
!widget->paren...ins(globalPos)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
182 if (globalPos.x() < 0
globalPos.x() < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
183 globalPos.rx() = 0;
never executed: globalPos.rx() = 0;
0
184 if (globalPos.y() < 0
globalPos.y() < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
185 globalPos.ry() = 0;
never executed: globalPos.ry() = 0;
0
186 if (sizeprotect
sizeprotectDescription
TRUEnever evaluated
FALSEnever evaluated
&& globalPos.x() > widget->parentWidget()->width()
globalPos.x() ...get()->width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
187 globalPos.rx() = widget->parentWidget()->width();
never executed: globalPos.rx() = widget->parentWidget()->width();
0
188 if (sizeprotect
sizeprotectDescription
TRUEnever evaluated
FALSEnever evaluated
&& globalPos.y() > widget->parentWidget()->height()
globalPos.y() ...et()->height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
189 globalPos.ry() = widget->parentWidget()->height();
never executed: globalPos.ry() = widget->parentWidget()->height();
0
190 }
never executed: end of block
0
191-
192 QPoint p = globalPos + invertedMoveOffset;-
193 QPoint pp = globalPos - moveOffset;-
194-
195-
196 if (QGuiApplication::platformName() == QLatin1String("xcb")
QGuiApplicatio...1String("xcb")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
197 const QRect desktop = QApplication::desktop()->availableGeometry(widget);-
198 pp.rx() = qMax(pp.x(), desktop.left());-
199 pp.ry() = qMax(pp.y(), desktop.top());-
200 p.rx() = qMin(p.x(), desktop.right());-
201 p.ry() = qMin(p.y(), desktop.bottom());-
202 }
never executed: end of block
0
203-
204 QSize ms = qSmartMinSize(childWidget);-
205 int mw = ms.width();-
206 int mh = ms.height();-
207 if (childWidget != widget
childWidget != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
208 mw += 2 * fw;-
209 mh += 2 * fw + extrahei;-
210 }
never executed: end of block
0
211-
212 QSize maxsize(childWidget->maximumSize());-
213 if (childWidget != widget
childWidget != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
214 maxsize += QSize(2 * fw, 2 * fw + extrahei);
never executed: maxsize += QSize(2 * fw, 2 * fw + extrahei);
0
215 QSize mpsize(widget->geometry().right() - pp.x() + 1,-
216 widget->geometry().bottom() - pp.y() + 1);-
217 mpsize = mpsize.expandedTo(widget->minimumSize()).expandedTo(QSize(mw, mh))-
218 .boundedTo(maxsize);-
219 QPoint mp(widget->geometry().right() - mpsize.width() + 1,-
220 widget->geometry().bottom() - mpsize.height() + 1);-
221-
222 QRect geom = widget->geometry();-
223-
224 switch (mode) {-
225 case
never executed: case TopLeft:
TopLeft:
never executed: case TopLeft:
0
226 geom = QRect(mp, widget->geometry().bottomRight()) ;-
227 break;
never executed: break;
0
228 case
never executed: case BottomRight:
BottomRight:
never executed: case BottomRight:
0
229 geom = QRect(widget->geometry().topLeft(), p) ;-
230 break;
never executed: break;
0
231 case
never executed: case BottomLeft:
BottomLeft:
never executed: case BottomLeft:
0
232 geom = QRect(QPoint(mp.x(), widget->geometry().y()), QPoint(widget->geometry().right(), p.y())) ;-
233 break;
never executed: break;
0
234 case
never executed: case TopRight:
TopRight:
never executed: case TopRight:
0
235 geom = QRect(QPoint(widget->geometry().x(), mp.y()), QPoint(p.x(), widget->geometry().bottom())) ;-
236 break;
never executed: break;
0
237 case
never executed: case Top:
Top:
never executed: case Top:
0
238 geom = QRect(QPoint(widget->geometry().left(), mp.y()), widget->geometry().bottomRight()) ;-
239 break;
never executed: break;
0
240 case
never executed: case Bottom:
Bottom:
never executed: case Bottom:
0
241 geom = QRect(widget->geometry().topLeft(), QPoint(widget->geometry().right(), p.y())) ;-
242 break;
never executed: break;
0
243 case
never executed: case Left:
Left:
never executed: case Left:
0
244 geom = QRect(QPoint(mp.x(), widget->geometry().top()), widget->geometry().bottomRight()) ;-
245 break;
never executed: break;
0
246 case
never executed: case Right:
Right:
never executed: case Right:
0
247 geom = QRect(widget->geometry().topLeft(), QPoint(p.x(), widget->geometry().bottom())) ;-
248 break;
never executed: break;
0
249 case
never executed: case Center:
Center:
never executed: case Center:
0
250 geom.moveTopLeft(pp);-
251 break;
never executed: break;
0
252 default
never executed: default:
:
never executed: default:
0
253 break;
never executed: break;
0
254 }-
255-
256 geom = QRect(geom.topLeft(),-
257 geom.size().expandedTo(widget->minimumSize())-
258 .expandedTo(QSize(mw, mh))-
259 .boundedTo(maxsize));-
260-
261 if (geom != widget->geometry()
geom != widget->geometry()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
262 (widget->isWindow()
widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
|| widget->parentWidget()->rect().intersects(geom)
widget->parent...tersects(geom)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
263 if (mode == Center
mode == CenterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
264 widget->move(geom.topLeft());
never executed: widget->move(geom.topLeft());
0
265 else-
266 widget->setGeometry(geom);
never executed: widget->setGeometry(geom);
0
267 }-
268}
never executed: end of block
0
269-
270void QWidgetResizeHandler::setMouseCursor(MousePosition m)-
271{-
272-
273-
274-
275 QObjectList children = widget->children();-
276 for (int i = 0; i < children.size()
i < children.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
277 if (QWidget *w = qobject_cast<QWidget*>(children.at(i))
QWidget *w = q...hildren.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
278 if (!w->testAttribute(Qt::WA_SetCursor)
!w->testAttrib...:WA_SetCursor)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
279 w->setCursor(Qt::ArrowCursor);-
280 }
never executed: end of block
0
281 }
never executed: end of block
0
282 }
never executed: end of block
0
283-
284 switch (m) {-
285 case
never executed: case TopLeft:
TopLeft:
never executed: case TopLeft:
0
286 case
never executed: case BottomRight:
BottomRight:
never executed: case BottomRight:
0
287 widget->setCursor(Qt::SizeFDiagCursor);-
288 break;
never executed: break;
0
289 case
never executed: case BottomLeft:
BottomLeft:
never executed: case BottomLeft:
0
290 case
never executed: case TopRight:
TopRight:
never executed: case TopRight:
0
291 widget->setCursor(Qt::SizeBDiagCursor);-
292 break;
never executed: break;
0
293 case
never executed: case Top:
Top:
never executed: case Top:
0
294 case
never executed: case Bottom:
Bottom:
never executed: case Bottom:
0
295 widget->setCursor(Qt::SizeVerCursor);-
296 break;
never executed: break;
0
297 case
never executed: case Left:
Left:
never executed: case Left:
0
298 case
never executed: case Right:
Right:
never executed: case Right:
0
299 widget->setCursor(Qt::SizeHorCursor);-
300 break;
never executed: break;
0
301 default
never executed: default:
:
never executed: default:
0
302 widget->setCursor(Qt::ArrowCursor);-
303 break;
never executed: break;
0
304 }-
305-
306}-
307-
308void QWidgetResizeHandler::keyPressEvent(QKeyEvent * e)-
309{-
310 if (!isMove()
!isMove()Description
TRUEnever evaluated
FALSEnever evaluated
&& !isResize()
!isResize()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
311 return;
never executed: return;
0
312 bool is_control = e->modifiers() & Qt::ControlModifier;-
313 int delta = is_control
is_controlDescription
TRUEnever evaluated
FALSEnever evaluated
?1:8;
0
314 QPoint pos = QCursor::pos();-
315 switch (e->key()) {-
316 case
never executed: case Qt::Key_Left:
Qt::Key_Left:
never executed: case Qt::Key_Left:
0
317 pos.rx() -= delta;-
318 if (pos.x() <= QApplication::desktop()->geometry().left()
pos.x() <= QAp...metry().left()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
319 if (mode == TopLeft
mode == TopLeftDescription
TRUEnever evaluated
FALSEnever evaluated
|| mode == BottomLeft
mode == BottomLeftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
320 moveOffset.rx() += delta;-
321 invertedMoveOffset.rx() += delta;-
322 }
never executed: end of block
else {
0
323 moveOffset.rx() -= delta;-
324 invertedMoveOffset.rx() -= delta;-
325 }
never executed: end of block
0
326 }-
327 if (isResize()
isResize()Description
TRUEnever evaluated
FALSEnever evaluated
&& !resizeHorizontalDirectionFixed
!resizeHorizon...DirectionFixedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
328 resizeHorizontalDirectionFixed = true;-
329 if (mode == BottomRight
mode == BottomRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
330 mode = BottomLeft;
never executed: mode = BottomLeft;
0
331 else if (mode == TopRight
mode == TopRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
332 mode = TopLeft;
never executed: mode = TopLeft;
0
333-
334 setMouseCursor(mode);-
335 widget->grabMouse(widget->cursor());-
336-
337-
338-
339 }
never executed: end of block
0
340 break;
never executed: break;
0
341 case
never executed: case Qt::Key_Right:
Qt::Key_Right:
never executed: case Qt::Key_Right:
0
342 pos.rx() += delta;-
343 if (pos.x() >= QApplication::desktop()->geometry().right()
pos.x() >= QAp...etry().right()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
344 if (mode == TopRight
mode == TopRightDescription
TRUEnever evaluated
FALSEnever evaluated
|| mode == BottomRight
mode == BottomRightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
345 moveOffset.rx() += delta;-
346 invertedMoveOffset.rx() += delta;-
347 }
never executed: end of block
else {
0
348 moveOffset.rx() -= delta;-
349 invertedMoveOffset.rx() -= delta;-
350 }
never executed: end of block
0
351 }-
352 if (isResize()
isResize()Description
TRUEnever evaluated
FALSEnever evaluated
&& !resizeHorizontalDirectionFixed
!resizeHorizon...DirectionFixedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
353 resizeHorizontalDirectionFixed = true;-
354 if (mode == BottomLeft
mode == BottomLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
355 mode = BottomRight;
never executed: mode = BottomRight;
0
356 else if (mode == TopLeft
mode == TopLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
357 mode = TopRight;
never executed: mode = TopRight;
0
358-
359 setMouseCursor(mode);-
360 widget->grabMouse(widget->cursor());-
361-
362-
363-
364 }
never executed: end of block
0
365 break;
never executed: break;
0
366 case
never executed: case Qt::Key_Up:
Qt::Key_Up:
never executed: case Qt::Key_Up:
0
367 pos.ry() -= delta;-
368 if (pos.y() <= QApplication::desktop()->geometry().top()
pos.y() <= QAp...ometry().top()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
369 if (mode == TopLeft
mode == TopLeftDescription
TRUEnever evaluated
FALSEnever evaluated
|| mode == TopRight
mode == TopRightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
370 moveOffset.ry() += delta;-
371 invertedMoveOffset.ry() += delta;-
372 }
never executed: end of block
else {
0
373 moveOffset.ry() -= delta;-
374 invertedMoveOffset.ry() -= delta;-
375 }
never executed: end of block
0
376 }-
377 if (isResize()
isResize()Description
TRUEnever evaluated
FALSEnever evaluated
&& !resizeVerticalDirectionFixed
!resizeVerticalDirectionFixedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
378 resizeVerticalDirectionFixed = true;-
379 if (mode == BottomLeft
mode == BottomLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
380 mode = TopLeft;
never executed: mode = TopLeft;
0
381 else if (mode == BottomRight
mode == BottomRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
382 mode = TopRight;
never executed: mode = TopRight;
0
383-
384 setMouseCursor(mode);-
385 widget->grabMouse(widget->cursor());-
386-
387-
388-
389 }
never executed: end of block
0
390 break;
never executed: break;
0
391 case
never executed: case Qt::Key_Down:
Qt::Key_Down:
never executed: case Qt::Key_Down:
0
392 pos.ry() += delta;-
393 if (pos.y() >= QApplication::desktop()->geometry().bottom()
pos.y() >= QAp...try().bottom()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
394 if (mode == BottomLeft
mode == BottomLeftDescription
TRUEnever evaluated
FALSEnever evaluated
|| mode == BottomRight
mode == BottomRightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
395 moveOffset.ry() += delta;-
396 invertedMoveOffset.ry() += delta;-
397 }
never executed: end of block
else {
0
398 moveOffset.ry() -= delta;-
399 invertedMoveOffset.ry() -= delta;-
400 }
never executed: end of block
0
401 }-
402 if (isResize()
isResize()Description
TRUEnever evaluated
FALSEnever evaluated
&& !resizeVerticalDirectionFixed
!resizeVerticalDirectionFixedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
403 resizeVerticalDirectionFixed = true;-
404 if (mode == TopLeft
mode == TopLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
405 mode = BottomLeft;
never executed: mode = BottomLeft;
0
406 else if (mode == TopRight
mode == TopRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
407 mode = BottomRight;
never executed: mode = BottomRight;
0
408-
409 setMouseCursor(mode);-
410 widget->grabMouse(widget->cursor());-
411-
412-
413-
414 }
never executed: end of block
0
415 break;
never executed: break;
0
416 case
never executed: case Qt::Key_Space:
Qt::Key_Space:
never executed: case Qt::Key_Space:
0
417 case
never executed: case Qt::Key_Return:
Qt::Key_Return:
never executed: case Qt::Key_Return:
0
418 case
never executed: case Qt::Key_Enter:
Qt::Key_Enter:
never executed: case Qt::Key_Enter:
0
419 case
never executed: case Qt::Key_Escape:
Qt::Key_Escape:
never executed: case Qt::Key_Escape:
0
420 moveResizeMode = false;-
421 widget->releaseMouse();-
422 widget->releaseKeyboard();-
423 buttonDown = false;-
424 break;
never executed: break;
0
425 default
never executed: default:
:
never executed: default:
0
426 return;
never executed: return;
0
427 }-
428 QCursor::setPos(pos);-
429}
never executed: end of block
0
430-
431-
432void QWidgetResizeHandler::doResize()-
433{-
434 if (!activeForResize
!activeForResizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
435 return;
never executed: return;
0
436-
437 moveResizeMode = true;-
438 moveOffset = widget->mapFromGlobal(QCursor::pos());-
439 if (moveOffset.x() < widget->width()/2
moveOffset.x()...get->width()/2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
440 if (moveOffset.y() < widget->height()/2
moveOffset.y()...et->height()/2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
441 mode = TopLeft;
never executed: mode = TopLeft;
0
442 else-
443 mode = BottomLeft;
never executed: mode = BottomLeft;
0
444 } else {-
445 if (moveOffset.y() < widget->height()/2
moveOffset.y()...et->height()/2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
446 mode = TopRight;
never executed: mode = TopRight;
0
447 else-
448 mode = BottomRight;
never executed: mode = BottomRight;
0
449 }-
450 invertedMoveOffset = widget->rect().bottomRight() - moveOffset;-
451-
452 setMouseCursor(mode);-
453 widget->grabMouse(widget->cursor() );-
454-
455-
456-
457 widget->grabKeyboard();-
458 resizeHorizontalDirectionFixed = false;-
459 resizeVerticalDirectionFixed = false;-
460}
never executed: end of block
0
461-
462void QWidgetResizeHandler::doMove()-
463{-
464 if (!activeForMove
!activeForMoveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
465 return;
never executed: return;
0
466-
467 mode = Center;-
468 moveResizeMode = true;-
469 moveOffset = widget->mapFromGlobal(QCursor::pos());-
470 invertedMoveOffset = widget->rect().bottomRight() - moveOffset;-
471-
472 widget->grabMouse(Qt::SizeAllCursor);-
473-
474-
475-
476 widget->grabKeyboard();-
477}
never executed: end of block
0
478-
479-
480-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9