widgets/qabstractscrollarea.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() -
9 :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), -
10 viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), -
11 xoffset(0), yoffset(0), viewportFilter(0) -
12 -
13 -
14 -
15{ -
16}
executed: }
Execution Count:5100
5100
17 -
18QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(Qt::Orientation orientation, QWidget *parent) -
19 :QWidget(parent), scrollBar(new QScrollBar(orientation, this)), -
20 layout(new QBoxLayout(orientation == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom)), -
21 orientation(orientation) -
22{ -
23 setLayout(layout); -
24 layout->setMargin(0); -
25 layout->setSpacing(0); -
26 layout->addWidget(scrollBar); -
27 layout->setSizeConstraint(QLayout::SetMaximumSize); -
28}
executed: }
Execution Count:10200
10200
29 -
30 -
31 -
32 -
33void QAbstractScrollAreaScrollBarContainer::addWidget(QWidget *widget, LogicalPosition position) -
34{ -
35 QSizePolicy policy = widget->sizePolicy(); -
36 if (orientation == Qt::Vertical)
evaluated: orientation == Qt::Vertical
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
5-8
37 policy.setHorizontalPolicy(QSizePolicy::Ignored);
executed: policy.setHorizontalPolicy(QSizePolicy::Ignored);
Execution Count:8
8
38 else -
39 policy.setVerticalPolicy(QSizePolicy::Ignored);
executed: policy.setVerticalPolicy(QSizePolicy::Ignored);
Execution Count:5
5
40 widget->setSizePolicy(policy); -
41 widget->setParent(this); -
42 -
43 const int insertIndex = (position & LogicalLeft) ? 0 : scrollBarLayoutIndex() + 1;
evaluated: (position & LogicalLeft)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
5-8
44 layout->insertWidget(insertIndex, widget); -
45}
executed: }
Execution Count:13
13
46 -
47 -
48 -
49 -
50 -
51QWidgetList QAbstractScrollAreaScrollBarContainer::widgets(LogicalPosition position) -
52{ -
53 QWidgetList list; -
54 const int scrollBarIndex = scrollBarLayoutIndex(); -
55 if (position == LogicalLeft) {
evaluated: position == LogicalLeft
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:30
30
56 for (int i = 0; i < scrollBarIndex; ++i)
evaluated: i < scrollBarIndex
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:30
12-30
57 list.append(layout->itemAt(i)->widget());
executed: list.append(layout->itemAt(i)->widget());
Execution Count:12
12
58 } else if (position == LogicalRight) {
partially evaluated: position == LogicalRight
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
executed: }
Execution Count:30
0-30
59 const int layoutItemCount = layout->count(); -
60 for (int i = scrollBarIndex + 1; i < layoutItemCount; ++i)
evaluated: i < layoutItemCount
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:30
10-30
61 list.append(layout->itemAt(i)->widget());
executed: list.append(layout->itemAt(i)->widget());
Execution Count:10
10
62 }
executed: }
Execution Count:30
30
63 return list;
executed: return list;
Execution Count:60
60
64} -
65 -
66 -
67 -
68 -
69 -
70 -
71 -
72int QAbstractScrollAreaScrollBarContainer::scrollBarLayoutIndex() const -
73{ -
74 const int layoutItemCount = layout->count(); -
75 for (int i = 0; i < layoutItemCount; ++i) {
partially evaluated: i < layoutItemCount
TRUEFALSE
yes
Evaluation Count:100
no
Evaluation Count:0
0-100
76 if (qobject_cast<QScrollBar *>(layout->itemAt(i)->widget()))
evaluated: qobject_cast<QScrollBar *>(layout->itemAt(i)->widget())
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:32
32-68
77 return i;
executed: return i;
Execution Count:68
68
78 }
executed: }
Execution Count:32
32
79 return -1;
never executed: return -1;
0
80} -
81 -
82 -
83 -
84void QAbstractScrollAreaPrivate::replaceScrollBar(QScrollBar *scrollBar, -
85 Qt::Orientation orientation) -
86{ -
87 QAbstractScrollArea * const q = q_func(); -
88 -
89 QAbstractScrollAreaScrollBarContainer *container = scrollBarContainers[orientation]; -
90 bool horizontal = (orientation == Qt::Horizontal); -
91 QScrollBar *oldBar = horizontal ? hbar : vbar;
evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
92 if (horizontal)
evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
93 hbar = scrollBar;
executed: hbar = scrollBar;
Execution Count:4
4
94 else -
95 vbar = scrollBar;
executed: vbar = scrollBar;
Execution Count:4
4
96 scrollBar->setParent(container); -
97 container->scrollBar = scrollBar; -
98 container->layout->removeWidget(oldBar); -
99 container->layout->insertWidget(0, scrollBar); -
100 scrollBar->setVisible(oldBar->isVisibleTo(container)); -
101 scrollBar->setInvertedAppearance(oldBar->invertedAppearance()); -
102 scrollBar->setInvertedControls(oldBar->invertedControls()); -
103 scrollBar->setRange(oldBar->minimum(), oldBar->maximum()); -
104 scrollBar->setOrientation(oldBar->orientation()); -
105 scrollBar->setPageStep(oldBar->pageStep()); -
106 scrollBar->setSingleStep(oldBar->singleStep()); -
107 scrollBar->setSliderDown(oldBar->isSliderDown()); -
108 scrollBar->setSliderPosition(oldBar->sliderPosition()); -
109 scrollBar->setTracking(oldBar->hasTracking()); -
110 scrollBar->setValue(oldBar->value()); -
111 scrollBar->installEventFilter(q); -
112 oldBar->removeEventFilter(q); -
113 delete oldBar; -
114 -
115 QObject::connect(scrollBar, "2""valueChanged(int)", -
116 q, horizontal ? "1""_q_hslide(int)" : "1""_q_vslide(int)"); -
117 QObject::connect(scrollBar, "2""rangeChanged(int,int)", -
118 q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); -
119}
executed: }
Execution Count:8
8
120 -
121void QAbstractScrollAreaPrivate::init() -
122{ -
123 QAbstractScrollArea * const q = q_func(); -
124 viewport = new QWidget(q); -
125 viewport->setObjectName(QLatin1String("qt_scrollarea_viewport")); -
126 viewport->setBackgroundRole(QPalette::Base); -
127 viewport->setAutoFillBackground(true); -
128 scrollBarContainers[Qt::Horizontal] = new QAbstractScrollAreaScrollBarContainer(Qt::Horizontal, q); -
129 scrollBarContainers[Qt::Horizontal]->setObjectName(QLatin1String("qt_scrollarea_hcontainer")); -
130 hbar = scrollBarContainers[Qt::Horizontal]->scrollBar; -
131 hbar->setRange(0,0); -
132 scrollBarContainers[Qt::Horizontal]->setVisible(false); -
133 hbar->installEventFilter(q); -
134 QObject::connect(hbar, "2""valueChanged(int)", q, "1""_q_hslide(int)"); -
135 QObject::connect(hbar, "2""rangeChanged(int,int)", q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); -
136 scrollBarContainers[Qt::Vertical] = new QAbstractScrollAreaScrollBarContainer(Qt::Vertical, q); -
137 scrollBarContainers[Qt::Vertical]->setObjectName(QLatin1String("qt_scrollarea_vcontainer")); -
138 vbar = scrollBarContainers[Qt::Vertical]->scrollBar; -
139 vbar->setRange(0,0); -
140 scrollBarContainers[Qt::Vertical]->setVisible(false); -
141 vbar->installEventFilter(q); -
142 QObject::connect(vbar, "2""valueChanged(int)", q, "1""_q_vslide(int)"); -
143 QObject::connect(vbar, "2""rangeChanged(int,int)", q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); -
144 viewportFilter.reset(new QAbstractScrollAreaFilter(this)); -
145 viewport->installEventFilter(viewportFilter.data()); -
146 viewport->setFocusProxy(q); -
147 q->setFocusPolicy(Qt::WheelFocus); -
148 q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); -
149 q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -
150 layoutChildren(); -
151 -
152 -
153 viewport->grabGesture(Qt::PanGesture); -
154 -
155 -
156}
executed: }
Execution Count:5100
5100
157void QAbstractScrollAreaPrivate::layoutChildren() -
158{ -
159 QAbstractScrollArea * const q = q_func(); -
160 bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); -
161 bool needh = (hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
evaluated: (hbarpolicy != Qt::ScrollBarAlwaysOff)
TRUEFALSE
yes
Evaluation Count:15161
yes
Evaluation Count:13037
evaluated: hbarpolicy == Qt::ScrollBarAlwaysOn
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:14936
partially evaluated: !transient
TRUEFALSE
yes
Evaluation Count:225
no
Evaluation Count:0
0-15161
162 || ((hbarpolicy == Qt::ScrollBarAsNeeded || transient)
partially evaluated: hbarpolicy == Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:14936
no
Evaluation Count:0
never evaluated: transient
0-14936
163 && hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty()));
evaluated: hbar->minimum() < hbar->maximum()
TRUEFALSE
yes
Evaluation Count:2334
yes
Evaluation Count:12602
partially evaluated: !hbar->sizeHint().isEmpty()
TRUEFALSE
yes
Evaluation Count:2334
no
Evaluation Count:0
0-12602
164 -
165 bool needv = (vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
evaluated: (vbarpolicy != Qt::ScrollBarAlwaysOff)
TRUEFALSE
yes
Evaluation Count:15463
yes
Evaluation Count:12735
evaluated: vbarpolicy == Qt::ScrollBarAlwaysOn
TRUEFALSE
yes
Evaluation Count:411
yes
Evaluation Count:15052
partially evaluated: !transient
TRUEFALSE
yes
Evaluation Count:411
no
Evaluation Count:0
0-15463
166 || ((vbarpolicy == Qt::ScrollBarAsNeeded || transient)
partially evaluated: vbarpolicy == Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:15052
no
Evaluation Count:0
never evaluated: transient
0-15052
167 && vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty()));
evaluated: vbar->minimum() < vbar->maximum()
TRUEFALSE
yes
Evaluation Count:3031
yes
Evaluation Count:12021
partially evaluated: !vbar->sizeHint().isEmpty()
TRUEFALSE
yes
Evaluation Count:3031
no
Evaluation Count:0
0-12021
168 -
169 QStyleOption opt(0); -
170 opt.init(q); -
171 const int scrollOverlap = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, -
172 &opt, q); -
173 const int hsbExt = hbar->sizeHint().height(); -
174 const int vsbExt = vbar->sizeHint().width(); -
175 const QPoint extPoint(vsbExt, hsbExt); -
176 const QSize extSize(vsbExt, hsbExt); -
177 -
178 const QRect widgetRect = q->rect(); -
179 -
180 const bool hasCornerWidget = (cornerWidget != 0); -
181 QPoint cornerOffset((needv && scrollOverlap == 0) ? vsbExt : 0, (needh && scrollOverlap == 0) ? hsbExt : 0); -
182 QRect controlsRect; -
183 QRect viewportRect; -
184 -
185 -
186 -
187 if ((frameStyle != QFrame::NoFrame) &&
evaluated: (frameStyle != QFrame::NoFrame)
TRUEFALSE
yes
Evaluation Count:14796
yes
Evaluation Count:13402
13402-14796
188 q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) {
evaluated: q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14794
2-14794
189 controlsRect = widgetRect; -
190 const int extra = scrollOverlap + q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q); -
191 const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0); -
192 QRect frameRect = widgetRect; -
193 frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y()); -
194 q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, frameRect)); -
195 -
196 -
197 -
198 viewportRect = QStyle::visualRect(opt.direction, opt.rect, q->contentsRect()); -
199 } else {
executed: }
Execution Count:2
2
200 q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, widgetRect)); -
201 controlsRect = q->contentsRect(); -
202 viewportRect = QRect(controlsRect.topLeft(), controlsRect.bottomRight() - cornerOffset); -
203 }
executed: }
Execution Count:28196
28196
204 -
205 cornerOffset = QPoint(needv ? vsbExt : 0, needh ? hsbExt : 0); -
206 -
207 -
208 -
209 if (hasCornerWidget && (needv || needh) && scrollOverlap == 0)
evaluated: hasCornerWidget
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:28196
evaluated: needv
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: needh
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: scrollOverlap == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-28196
210 cornerOffset = extPoint;
executed: cornerOffset = extPoint;
Execution Count:1
1
211 const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset); -
212 -
213 -
214 -
215 -
216 if ((needv && needh && hasCornerWidget == false && scrollOverlap == 0)
evaluated: needv
TRUEFALSE
yes
Evaluation Count:3442
yes
Evaluation Count:24756
evaluated: needh
TRUEFALSE
yes
Evaluation Count:1733
yes
Evaluation Count:1709
evaluated: hasCornerWidget == false
TRUEFALSE
yes
Evaluation Count:1732
yes
Evaluation Count:1
partially evaluated: scrollOverlap == 0
TRUEFALSE
yes
Evaluation Count:1732
no
Evaluation Count:0
0-24756
217 || ((needv || needh)
evaluated: needv
TRUEFALSE
yes
Evaluation Count:1710
yes
Evaluation Count:24756
evaluated: needh
TRUEFALSE
yes
Evaluation Count:826
yes
Evaluation Count:23930
826-24756
218 -
219 -
220 -
221 ) -
222 ) { -
223 cornerPaintingRect = QStyle::visualRect(opt.direction, opt.rect, QRect(cornerPoint, extSize)); -
224 } else {
executed: }
Execution Count:4268
4268
225 cornerPaintingRect = QRect(); -
226 }
executed: }
Execution Count:23930
23930
227 int vHeaderRight = 0; -
228 int hHeaderBottom = 0; -
229 if (scrollOverlap > 0 && (needv || needh)) {
partially evaluated: scrollOverlap > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28198
never evaluated: needv
never evaluated: needh
0-28198
230 const QList<QHeaderView *> headers = q->findChildren<QHeaderView*>(); -
231 if (headers.count() <= 2) {
never evaluated: headers.count() <= 2
0
232 for (QForeachContainer<__typeof__(headers)> _container_(headers); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QHeaderView *header = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
233 const QRect geo = header->geometry(); -
234 if (header->orientation() == Qt::Vertical && header->isVisible() && QStyle::visualRect(opt.direction, opt.rect, geo).left() <= opt.rect.width() / 2)
never evaluated: header->orientation() == Qt::Vertical
never evaluated: header->isVisible()
never evaluated: QStyle::visualRect(opt.direction, opt.rect, geo).left() <= opt.rect.width() / 2
0
235 vHeaderRight = QStyle::visualRect(opt.direction, opt.rect, geo).right();
never executed: vHeaderRight = QStyle::visualRect(opt.direction, opt.rect, geo).right();
0
236 else if (header->orientation() == Qt::Horizontal && header->isVisible() && geo.top() <= q->frameWidth())
never evaluated: header->orientation() == Qt::Horizontal
never evaluated: header->isVisible()
never evaluated: geo.top() <= q->frameWidth()
0
237 hHeaderBottom = geo.bottom();
never executed: hHeaderBottom = geo.bottom();
0
238 } -
239 }
never executed: }
0
240 }
never executed: }
0
241 -
242 if (needh) {
evaluated: needh
TRUEFALSE
yes
Evaluation Count:2559
yes
Evaluation Count:25639
2559-25639
243 QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); -
244 scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); -
245 scrollBarContainers[Qt::Horizontal]->raise(); -
246 }
executed: }
Execution Count:2559
2559
247 -
248 if (needv) {
evaluated: needv
TRUEFALSE
yes
Evaluation Count:3442
yes
Evaluation Count:24756
3442-24756
249 QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1)); -
250 -
251 -
252 -
253 -
254 scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect)); -
255 scrollBarContainers[Qt::Vertical]->raise(); -
256 }
executed: }
Execution Count:3442
3442
257 -
258 if (cornerWidget) {
evaluated: cornerWidget
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:28196
2-28196
259 const QRect cornerWidgetRect(cornerPoint, controlsRect.bottomRight()); -
260 cornerWidget->setGeometry(QStyle::visualRect(opt.direction, opt.rect, cornerWidgetRect)); -
261 }
executed: }
Execution Count:2
2
262 -
263 scrollBarContainers[Qt::Horizontal]->setVisible(needh); -
264 scrollBarContainers[Qt::Vertical]->setVisible(needv); -
265 -
266 if (q->isRightToLeft())
evaluated: q->isRightToLeft()
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:28102
96-28102
267 viewportRect.adjust(right, top, -left, -bottom);
executed: viewportRect.adjust(right, top, -left, -bottom);
Execution Count:96
96
268 else -
269 viewportRect.adjust(left, top, -right, -bottom);
executed: viewportRect.adjust(left, top, -right, -bottom);
Execution Count:28102
28102
270 -
271 viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); -
272}
executed: }
Execution Count:28198
28198
273 -
274 -
275 -
276 -
277 -
278 -
279QAbstractScrollArea::QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent) -
280 :QFrame(dd, parent) -
281{ -
282 QAbstractScrollAreaPrivate * const d = d_func(); -
283 if (true) {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:5097
no
Evaluation Count:0
0-5097
284 d->init(); -
285 } else {
executed: }
Execution Count:5097
5097
286 d->viewportFilter.reset(); -
287 qt_noop(); -
288 }
never executed: }
0
289} -
290 -
291 -
292 -
293 -
294 -
295 -
296QAbstractScrollArea::QAbstractScrollArea(QWidget *parent) -
297 :QFrame(*new QAbstractScrollAreaPrivate, parent) -
298{ -
299 QAbstractScrollAreaPrivate * const d = d_func(); -
300 if (true) {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
301 d->init(); -
302 } else {
executed: }
Execution Count:3
3
303 d->viewportFilter.reset(); -
304 qt_noop(); -
305 }
never executed: }
0
306} -
307 -
308 -
309 -
310 -
311 -
312QAbstractScrollArea::~QAbstractScrollArea() -
313{ -
314 QAbstractScrollAreaPrivate * const d = d_func(); -
315 -
316 d->viewportFilter.reset(); -
317}
executed: }
Execution Count:4457
4457
318void QAbstractScrollArea::setViewport(QWidget *widget) -
319{ -
320 QAbstractScrollAreaPrivate * const d = d_func(); -
321 if (widget != d->viewport) {
partially evaluated: widget != d->viewport
TRUEFALSE
yes
Evaluation Count:889
no
Evaluation Count:0
0-889
322 QWidget *oldViewport = d->viewport; -
323 if (!widget)
evaluated: !widget
TRUEFALSE
yes
Evaluation Count:880
yes
Evaluation Count:9
9-880
324 widget = new QWidget;
executed: widget = new QWidget;
Execution Count:880
880
325 d->viewport = widget; -
326 d->viewport->setParent(this); -
327 d->viewport->setFocusProxy(this); -
328 d->viewport->installEventFilter(d->viewportFilter.data()); -
329 -
330 -
331 d->viewport->grabGesture(Qt::PanGesture); -
332 -
333 -
334 d->layoutChildren(); -
335 if (isVisible())
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:886
3-886
336 d->viewport->show();
executed: d->viewport->show();
Execution Count:3
3
337 setupViewport(widget); -
338 delete oldViewport; -
339 }
executed: }
Execution Count:889
889
340}
executed: }
Execution Count:889
889
341QWidget *QAbstractScrollArea::viewport() const -
342{ -
343 const QAbstractScrollAreaPrivate * const d = d_func(); -
344 return d->viewport;
executed: return d->viewport;
Execution Count:63310
63310
345} -
346 -
347 -
348 -
349 -
350 -
351 -
352 -
353QSize QAbstractScrollArea::maximumViewportSize() const -
354{ -
355 const QAbstractScrollAreaPrivate * const d = d_func(); -
356 int hsbExt = d->hbar->sizeHint().height(); -
357 int vsbExt = d->vbar->sizeHint().width(); -
358 -
359 int f = 2 * d->frameWidth; -
360 QSize max = size() - QSize(f + d->left + d->right, f + d->top + d->bottom); -
361 if (d->vbarpolicy == Qt::ScrollBarAlwaysOn)
evaluated: d->vbarpolicy == Qt::ScrollBarAlwaysOn
TRUEFALSE
yes
Evaluation Count:596
yes
Evaluation Count:12609
596-12609
362 max.rwidth() -= vsbExt;
executed: max.rwidth() -= vsbExt;
Execution Count:596
596
363 if (d->hbarpolicy == Qt::ScrollBarAlwaysOn)
evaluated: d->hbarpolicy == Qt::ScrollBarAlwaysOn
TRUEFALSE
yes
Evaluation Count:308
yes
Evaluation Count:12897
308-12897
364 max.rheight() -= hsbExt;
executed: max.rheight() -= hsbExt;
Execution Count:308
308
365 return max;
executed: return max;
Execution Count:13205
13205
366} -
367Qt::ScrollBarPolicy QAbstractScrollArea::verticalScrollBarPolicy() const -
368{ -
369 const QAbstractScrollAreaPrivate * const d = d_func(); -
370 return d->vbarpolicy;
executed: return d->vbarpolicy;
Execution Count:47
47
371} -
372 -
373void QAbstractScrollArea::setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy) -
374{ -
375 QAbstractScrollAreaPrivate * const d = d_func(); -
376 const Qt::ScrollBarPolicy oldPolicy = d->vbarpolicy; -
377 d->vbarpolicy = policy; -
378 if (isVisible())
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2374
2-2374
379 d->layoutChildren();
executed: d->layoutChildren();
Execution Count:2
2
380 if (oldPolicy != d->vbarpolicy)
evaluated: oldPolicy != d->vbarpolicy
TRUEFALSE
yes
Evaluation Count:2273
yes
Evaluation Count:103
103-2273
381 d->scrollBarPolicyChanged(Qt::Vertical, d->vbarpolicy);
executed: d->scrollBarPolicyChanged(Qt::Vertical, d->vbarpolicy);
Execution Count:2273
2273
382}
executed: }
Execution Count:2376
2376
383 -
384 -
385 -
386 -
387 -
388 -
389 -
390QScrollBar *QAbstractScrollArea::verticalScrollBar() const -
391{ -
392 const QAbstractScrollAreaPrivate * const d = d_func(); -
393 return d->vbar;
executed: return d->vbar;
Execution Count:61137
61137
394} -
395void QAbstractScrollArea::setVerticalScrollBar(QScrollBar *scrollBar) -
396{ -
397 QAbstractScrollAreaPrivate * const d = d_func(); -
398 if (!scrollBar) {
partially evaluated: !scrollBar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
399 QMessageLogger("widgets/qabstractscrollarea.cpp", 698, __PRETTY_FUNCTION__).warning("QAbstractScrollArea::setVerticalScrollBar: Cannot set a null scroll bar"); -
400 return;
never executed: return;
0
401 } -
402 -
403 d->replaceScrollBar(scrollBar, Qt::Vertical); -
404}
executed: }
Execution Count:4
4
405Qt::ScrollBarPolicy QAbstractScrollArea::horizontalScrollBarPolicy() const -
406{ -
407 const QAbstractScrollAreaPrivate * const d = d_func(); -
408 return d->hbarpolicy;
executed: return d->hbarpolicy;
Execution Count:1216
1216
409} -
410 -
411void QAbstractScrollArea::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy) -
412{ -
413 QAbstractScrollAreaPrivate * const d = d_func(); -
414 const Qt::ScrollBarPolicy oldPolicy = d->hbarpolicy; -
415 d->hbarpolicy = policy; -
416 if (isVisible())
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2736
2-2736
417 d->layoutChildren();
executed: d->layoutChildren();
Execution Count:2
2
418 if (oldPolicy != d->hbarpolicy)
evaluated: oldPolicy != d->hbarpolicy
TRUEFALSE
yes
Evaluation Count:2635
yes
Evaluation Count:103
103-2635
419 d->scrollBarPolicyChanged(Qt::Horizontal, d->hbarpolicy);
executed: d->scrollBarPolicyChanged(Qt::Horizontal, d->hbarpolicy);
Execution Count:2635
2635
420}
executed: }
Execution Count:2738
2738
421 -
422 -
423 -
424 -
425 -
426 -
427QScrollBar *QAbstractScrollArea::horizontalScrollBar() const -
428{ -
429 const QAbstractScrollAreaPrivate * const d = d_func(); -
430 return d->hbar;
executed: return d->hbar;
Execution Count:77669
77669
431} -
432void QAbstractScrollArea::setHorizontalScrollBar(QScrollBar *scrollBar) -
433{ -
434 QAbstractScrollAreaPrivate * const d = d_func(); -
435 if (!scrollBar) {
partially evaluated: !scrollBar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
436 QMessageLogger("widgets/qabstractscrollarea.cpp", 759, __PRETTY_FUNCTION__).warning("QAbstractScrollArea::setHorizontalScrollBar: Cannot set a null scroll bar"); -
437 return;
never executed: return;
0
438 } -
439 -
440 d->replaceScrollBar(scrollBar, Qt::Horizontal); -
441}
executed: }
Execution Count:4
4
442QWidget *QAbstractScrollArea::cornerWidget() const -
443{ -
444 const QAbstractScrollAreaPrivate * const d = d_func(); -
445 return d->cornerWidget;
executed: return d->cornerWidget;
Execution Count:70
70
446} -
447void QAbstractScrollArea::setCornerWidget(QWidget *widget) -
448{ -
449 QAbstractScrollAreaPrivate * const d = d_func(); -
450 QWidget* oldWidget = d->cornerWidget; -
451 if (oldWidget != widget) {
partially evaluated: oldWidget != widget
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
452 if (oldWidget)
partially evaluated: oldWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
453 oldWidget->hide();
never executed: oldWidget->hide();
0
454 d->cornerWidget = widget; -
455 -
456 if (widget && widget->parentWidget() != this)
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: widget->parentWidget() != this
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
457 widget->setParent(this);
executed: widget->setParent(this);
Execution Count:2
2
458 -
459 d->layoutChildren(); -
460 if (widget)
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
461 widget->show();
executed: widget->show();
Execution Count:2
2
462 } else {
executed: }
Execution Count:2
2
463 d->cornerWidget = widget; -
464 d->layoutChildren(); -
465 }
never executed: }
0
466} -
467void QAbstractScrollArea::addScrollBarWidget(QWidget *widget, Qt::Alignment alignment) -
468{ -
469 QAbstractScrollAreaPrivate * const d = d_func(); -
470 -
471 if (widget == 0)
partially evaluated: widget == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
472 return;
never executed: return;
0
473 -
474 const Qt::Orientation scrollBarOrientation -
475 = ((alignment & Qt::AlignLeft) || (alignment & Qt::AlignRight)) ? Qt::Horizontal : Qt::Vertical;
evaluated: (alignment & Qt::AlignLeft)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
evaluated: (alignment & Qt::AlignRight)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-10
476 const QAbstractScrollAreaScrollBarContainer::LogicalPosition position -
477 = ((alignment & Qt::AlignRight) || (alignment & Qt::AlignBottom))
evaluated: (alignment & Qt::AlignRight)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
evaluated: (alignment & Qt::AlignBottom)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:5
2-11
478 ? QAbstractScrollAreaScrollBarContainer::LogicalRight : QAbstractScrollAreaScrollBarContainer::LogicalLeft; -
479 d->scrollBarContainers[scrollBarOrientation]->addWidget(widget, position); -
480 d->layoutChildren(); -
481 if (isHidden() == false)
partially evaluated: isHidden() == false
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
482 widget->show();
executed: widget->show();
Execution Count:13
13
483}
executed: }
Execution Count:13
13
484QWidgetList QAbstractScrollArea::scrollBarWidgets(Qt::Alignment alignment) -
485{ -
486 QAbstractScrollAreaPrivate * const d = d_func(); -
487 -
488 QWidgetList list; -
489 -
490 if (alignment & Qt::AlignLeft)
evaluated: alignment & Qt::AlignLeft
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:21
15-21
491 list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);
executed: list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);
Execution Count:15
15
492 if (alignment & Qt::AlignRight)
evaluated: alignment & Qt::AlignRight
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:21
15-21
493 list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);
executed: list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);
Execution Count:15
15
494 if (alignment & Qt::AlignTop)
evaluated: alignment & Qt::AlignTop
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:21
15-21
495 list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);
executed: list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);
Execution Count:15
15
496 if (alignment & Qt::AlignBottom)
evaluated: alignment & Qt::AlignBottom
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:21
15-21
497 list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);
executed: list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);
Execution Count:15
15
498 -
499 return list;
executed: return list;
Execution Count:36
36
500} -
501void QAbstractScrollArea::setViewportMargins(int left, int top, int right, int bottom) -
502{ -
503 QAbstractScrollAreaPrivate * const d = d_func(); -
504 d->left = left; -
505 d->top = top; -
506 d->right = right; -
507 d->bottom = bottom; -
508 d->layoutChildren(); -
509}
executed: }
Execution Count:4077
4077
510void QAbstractScrollArea::setViewportMargins(const QMargins &margins) -
511{ -
512 setViewportMargins(margins.left(), margins.top(), -
513 margins.right(), margins.bottom()); -
514}
never executed: }
0
515 -
516 -
517bool QAbstractScrollArea::eventFilter(QObject *o, QEvent *e) -
518{ -
519 QAbstractScrollAreaPrivate * const d = d_func(); -
520 if ((o == d->hbar || o == d->vbar) && (e->type() == QEvent::HoverEnter || e->type() == QEvent::HoverLeave)) {
evaluated: o == d->hbar
TRUEFALSE
yes
Evaluation Count:11647
yes
Evaluation Count:83419
evaluated: o == d->vbar
TRUEFALSE
yes
Evaluation Count:12636
yes
Evaluation Count:70783
partially evaluated: e->type() == QEvent::HoverEnter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24283
partially evaluated: e->type() == QEvent::HoverLeave
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24283
0-83419
521 Qt::ScrollBarPolicy policy = o == d->hbar ? d->vbarpolicy : d->hbarpolicy;
never evaluated: o == d->hbar
0
522 if (policy == Qt::ScrollBarAsNeeded || style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, d->vbar ? d->vbar : d->hbar)) {
never evaluated: policy == Qt::ScrollBarAsNeeded
never evaluated: style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, d->vbar ? d->vbar : d->hbar)
0
523 QScrollBar *sibling = o == d->hbar ? d->vbar : d->hbar;
never evaluated: o == d->hbar
0
524 d->setScrollBarTransient(sibling, e->type() == QEvent::HoverLeave); -
525 }
never executed: }
0
526 }
never executed: }
0
527 return QFrame::eventFilter(o, e);
executed: return QFrame::eventFilter(o, e);
Execution Count:95066
95066
528} -
529bool QAbstractScrollArea::event(QEvent *e) -
530{ -
531 QAbstractScrollAreaPrivate * const d = d_func(); -
532 switch (e->type()) { -
533 case QEvent::AcceptDropsChange: -
534 -
535 -
536 -
537 -
538 -
539 if (d->viewport)
partially evaluated: d->viewport
TRUEFALSE
yes
Evaluation Count:1576
no
Evaluation Count:0
0-1576
540 d->viewport->setAcceptDrops(acceptDrops());
executed: d->viewport->setAcceptDrops(acceptDrops());
Execution Count:1576
1576
541 break;
executed: break;
Execution Count:1576
1576
542 case QEvent::MouseTrackingChange: -
543 d->viewport->setMouseTracking(hasMouseTracking()); -
544 break;
executed: break;
Execution Count:342
342
545 case QEvent::Resize: -
546 d->layoutChildren(); -
547 break;
executed: break;
Execution Count:4071
4071
548 case QEvent::Paint: { -
549 QStyleOption option; -
550 option.initFrom(this); -
551 if (d->cornerPaintingRect.isValid()) {
evaluated: d->cornerPaintingRect.isValid()
TRUEFALSE
yes
Evaluation Count:846
yes
Evaluation Count:851
846-851
552 option.rect = d->cornerPaintingRect; -
553 QPainter p(this); -
554 style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); -
555 }
executed: }
Execution Count:846
846
556 -
557 -
558 -
559 -
560 -
561 -
562 -
563 } -
564 QFrame::paintEvent((QPaintEvent*)e); -
565 break;
executed: break;
Execution Count:1697
1697
566 -
567 case QEvent::ContextMenu: -
568 if (static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard)
partially evaluated: static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:100
0-100
569 return QFrame::event(e);
never executed: return QFrame::event(e);
0
570 e->ignore(); -
571 break;
executed: break;
Execution Count:100
100
572 -
573 case QEvent::MouseButtonPress: -
574 case QEvent::MouseButtonRelease: -
575 case QEvent::MouseButtonDblClick: -
576 case QEvent::MouseMove: -
577 case QEvent::Wheel: -
578 -
579 case QEvent::Drop: -
580 case QEvent::DragEnter: -
581 case QEvent::DragMove: -
582 case QEvent::DragLeave: -
583 -
584 -
585 case QEvent::TouchBegin: -
586 case QEvent::TouchUpdate: -
587 case QEvent::TouchEnd: -
588 return false;
executed: return false;
Execution Count:10
10
589 -
590 case QEvent::Gesture: -
591 { -
592 QGestureEvent *ge = static_cast<QGestureEvent *>(e); -
593 QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture)); -
594 if (g) {
never evaluated: g
0
595 QScrollBar *hBar = horizontalScrollBar(); -
596 QScrollBar *vBar = verticalScrollBar(); -
597 QPointF delta = g->delta(); -
598 if (!delta.isNull()) {
never evaluated: !delta.isNull()
0
599 if (QApplication::isRightToLeft())
never evaluated: QApplication::isRightToLeft()
0
600 delta.rx() *= -1;
never executed: delta.rx() *= -1;
0
601 int newX = hBar->value() - delta.x(); -
602 int newY = vBar->value() - delta.y(); -
603 hBar->setValue(newX); -
604 vBar->setValue(newY); -
605 }
never executed: }
0
606 return true;
never executed: return true;
0
607 } -
608 return false;
never executed: return false;
0
609 } -
610 -
611 case QEvent::ScrollPrepare: -
612 { -
613 QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e); -
614 if (d->canStartScrollingAt(se->startPos().toPoint())) {
never evaluated: d->canStartScrollingAt(se->startPos().toPoint())
0
615 QScrollBar *hBar = horizontalScrollBar(); -
616 QScrollBar *vBar = verticalScrollBar(); -
617 -
618 se->setViewportSize(QSizeF(viewport()->size())); -
619 se->setContentPosRange(QRectF(0, 0, hBar->maximum(), vBar->maximum())); -
620 se->setContentPos(QPointF(hBar->value(), vBar->value())); -
621 se->accept(); -
622 return true;
never executed: return true;
0
623 } -
624 return false;
never executed: return false;
0
625 } -
626 case QEvent::Scroll: -
627 { -
628 QScrollEvent *se = static_cast<QScrollEvent *>(e); -
629 -
630 QScrollBar *hBar = horizontalScrollBar(); -
631 QScrollBar *vBar = verticalScrollBar(); -
632 hBar->setValue(se->contentPos().x()); -
633 vBar->setValue(se->contentPos().y()); -
634 { -
635 QPoint delta = d->overshoot - se->overshootDistance().toPoint(); -
636 if (!delta.isNull())
never evaluated: !delta.isNull()
0
637 viewport()->move(viewport()->pos() + delta);
never executed: viewport()->move(viewport()->pos() + delta);
0
638 } -
639 d->overshoot = se->overshootDistance().toPoint(); -
640 -
641 return true;
never executed: return true;
0
642 } -
643 case QEvent::StyleChange: -
644 case QEvent::LayoutDirectionChange: -
645 case QEvent::ApplicationLayoutDirectionChange: -
646 case QEvent::LayoutRequest: -
647 d->layoutChildren(); -
648 -
649 default: -
650 return QFrame::event(e);
executed: return QFrame::event(e);
Execution Count:94627
94627
651 } -
652 return true;
executed: return true;
Execution Count:7786
7786
653} -
654bool QAbstractScrollArea::viewportEvent(QEvent *e) -
655{ -
656 switch (e->type()) { -
657 case QEvent::Resize: -
658 case QEvent::Paint: -
659 case QEvent::MouseButtonPress: -
660 case QEvent::MouseButtonRelease: -
661 case QEvent::MouseButtonDblClick: -
662 case QEvent::TouchBegin: -
663 case QEvent::TouchUpdate: -
664 case QEvent::TouchEnd: -
665 case QEvent::MouseMove: -
666 case QEvent::ContextMenu: -
667 -
668 case QEvent::Wheel: -
669 -
670 -
671 case QEvent::Drop: -
672 case QEvent::DragEnter: -
673 case QEvent::DragMove: -
674 case QEvent::DragLeave: -
675 -
676 return QFrame::event(e);
executed: return QFrame::event(e);
Execution Count:20260
20260
677 case QEvent::LayoutRequest: -
678 -
679 case QEvent::Gesture: -
680 case QEvent::GestureOverride: -
681 return event(e);
executed: return event(e);
Execution Count:204
204
682 -
683 case QEvent::ScrollPrepare: -
684 case QEvent::Scroll: -
685 return event(e);
never executed: return event(e);
0
686 default: -
687 break;
executed: break;
Execution Count:29816
29816
688 } -
689 return false;
executed: return false;
Execution Count:29816
29816
690} -
691void QAbstractScrollArea::resizeEvent(QResizeEvent *) -
692{ -
693} -
694void QAbstractScrollArea::paintEvent(QPaintEvent*) -
695{ -
696} -
697void QAbstractScrollArea::mousePressEvent(QMouseEvent *e) -
698{ -
699 e->ignore(); -
700}
never executed: }
0
701void QAbstractScrollArea::mouseReleaseEvent(QMouseEvent *e) -
702{ -
703 e->ignore(); -
704}
never executed: }
0
705void QAbstractScrollArea::mouseDoubleClickEvent(QMouseEvent *e) -
706{ -
707 e->ignore(); -
708}
never executed: }
0
709void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) -
710{ -
711 e->ignore(); -
712}
never executed: }
0
713void QAbstractScrollArea::wheelEvent(QWheelEvent *e) -
714{ -
715 QAbstractScrollAreaPrivate * const d = d_func(); -
716 if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
evaluated: static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
717 QApplication::sendEvent(d->hbar, e);
executed: QApplication::sendEvent(d->hbar, e);
Execution Count:4
4
718 else -
719 QApplication::sendEvent(d->vbar, e);
executed: QApplication::sendEvent(d->vbar, e);
Execution Count:5
5
720} -
721void QAbstractScrollArea::contextMenuEvent(QContextMenuEvent *e) -
722{ -
723 e->ignore(); -
724}
never executed: }
0
725 -
726 -
727 -
728 -
729 -
730 -
731 -
732void QAbstractScrollArea::keyPressEvent(QKeyEvent * e) -
733{ -
734 QAbstractScrollAreaPrivate * const d = d_func(); -
735 if (false){
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
736 -
737 } else if (e == QKeySequence::MoveToPreviousPage) {
never executed: }
partially evaluated: e == QKeySequence::MoveToPreviousPage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
738 d->vbar->triggerAction(QScrollBar::SliderPageStepSub); -
739 } else if (e == QKeySequence::MoveToNextPage) {
never executed: }
partially evaluated: e == QKeySequence::MoveToNextPage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
740 d->vbar->triggerAction(QScrollBar::SliderPageStepAdd); -
741 -
742 } else {
never executed: }
0
743 -
744 -
745 -
746 -
747 -
748 -
749 switch (e->key()) { -
750 case Qt::Key_Up: -
751 d->vbar->triggerAction(QScrollBar::SliderSingleStepSub); -
752 break;
never executed: break;
0
753 case Qt::Key_Down: -
754 d->vbar->triggerAction(QScrollBar::SliderSingleStepAdd); -
755 break;
never executed: break;
0
756 case Qt::Key_Left: -
757 d->hbar->triggerAction( -
758 layoutDirection() == Qt::LeftToRight -
759 ? QScrollBar::SliderSingleStepSub : QScrollBar::SliderSingleStepAdd); -
760 break;
executed: break;
Execution Count:2
2
761 case Qt::Key_Right: -
762 d->hbar->triggerAction( -
763 layoutDirection() == Qt::LeftToRight -
764 ? QScrollBar::SliderSingleStepAdd : QScrollBar::SliderSingleStepSub); -
765 break;
executed: break;
Execution Count:2
2
766 default: -
767 e->ignore(); -
768 return;
executed: return;
Execution Count:4
4
769 } -
770 }
executed: }
Execution Count:4
4
771 e->accept(); -
772}
executed: }
Execution Count:4
4
773void QAbstractScrollArea::dragEnterEvent(QDragEnterEvent *) -
774{ -
775} -
776void QAbstractScrollArea::dragMoveEvent(QDragMoveEvent *) -
777{ -
778} -
779void QAbstractScrollArea::dragLeaveEvent(QDragLeaveEvent *) -
780{ -
781} -
782void QAbstractScrollArea::dropEvent(QDropEvent *) -
783{ -
784} -
785void QAbstractScrollArea::scrollContentsBy(int, int) -
786{ -
787 viewport()->update(); -
788}
never executed: }
0
789 -
790bool QAbstractScrollAreaPrivate::canStartScrollingAt( const QPoint &startPos ) -
791{ -
792 QAbstractScrollArea * const q = q_func(); -
793 -
794 -
795 -
796 -
797 if (QGraphicsView *view = qobject_cast<QGraphicsView *>(q)) {
never evaluated: QGraphicsView *view = qobject_cast<QGraphicsView *>(q)
0
798 if (view->dragMode() != QGraphicsView::NoDrag)
never evaluated: view->dragMode() != QGraphicsView::NoDrag
0
799 return false;
never executed: return false;
0
800 -
801 QGraphicsItem *childItem = view->itemAt(startPos); -
802 -
803 if (childItem && (childItem->flags() & QGraphicsItem::ItemIsMovable))
never evaluated: childItem
never evaluated: (childItem->flags() & QGraphicsItem::ItemIsMovable)
0
804 return false;
never executed: return false;
0
805 }
never executed: }
0
806 -
807 -
808 -
809 if (qobject_cast<QAbstractSlider *>(q->viewport()->childAt(startPos))) {
never evaluated: qobject_cast<QAbstractSlider *>(q->viewport()->childAt(startPos))
0
810 return false;
never executed: return false;
0
811 } -
812 -
813 return true;
never executed: return true;
0
814} -
815 -
816void QAbstractScrollAreaPrivate::flashScrollBars() -
817{ -
818 QAbstractScrollArea * const q = q_func(); -
819 bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); -
820 if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || transient))
evaluated: (hbarpolicy != Qt::ScrollBarAlwaysOff)
TRUEFALSE
yes
Evaluation Count:9080
yes
Evaluation Count:122
evaluated: hbarpolicy == Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:9012
yes
Evaluation Count:68
partially evaluated: transient
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:68
0-9080
821 hbar->d_func()->flash();
executed: hbar->d_func()->flash();
Execution Count:9012
9012
822 if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || transient))
evaluated: (vbarpolicy != Qt::ScrollBarAlwaysOff)
TRUEFALSE
yes
Evaluation Count:9142
yes
Evaluation Count:60
evaluated: vbarpolicy == Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:9014
yes
Evaluation Count:128
partially evaluated: transient
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:128
0-9142
823 vbar->d_func()->flash();
executed: vbar->d_func()->flash();
Execution Count:9014
9014
824}
executed: }
Execution Count:9202
9202
825 -
826void QAbstractScrollAreaPrivate::setScrollBarTransient(QScrollBar *scrollBar, bool transient) -
827{ -
828 scrollBar->d_func()->setTransient(transient); -
829}
never executed: }
0
830 -
831void QAbstractScrollAreaPrivate::_q_hslide(int x) -
832{ -
833 QAbstractScrollArea * const q = q_func(); -
834 int dx = xoffset - x; -
835 xoffset = x; -
836 q->scrollContentsBy(dx, 0); -
837 flashScrollBars(); -
838}
executed: }
Execution Count:7058
7058
839 -
840void QAbstractScrollAreaPrivate::_q_vslide(int y) -
841{ -
842 QAbstractScrollArea * const q = q_func(); -
843 int dy = yoffset - y; -
844 yoffset = y; -
845 q->scrollContentsBy(0, dy); -
846 flashScrollBars(); -
847}
executed: }
Execution Count:2144
2144
848 -
849void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() -
850{ -
851 layoutChildren(); -
852 -
853 -
854 -
855 -
856 -
857 -
858 -
859}
executed: }
Execution Count:1506
1506
860 -
861QPoint QAbstractScrollAreaPrivate::contentsOffset() const -
862{ -
863 const QAbstractScrollArea * const q = q_func(); -
864 QPoint offset; -
865 if (vbar->isVisible())
evaluated: vbar->isVisible()
TRUEFALSE
yes
Evaluation Count:1412
yes
Evaluation Count:758
758-1412
866 offset.setY(vbar->value());
executed: offset.setY(vbar->value());
Execution Count:1412
1412
867 if (hbar->isVisible()) {
evaluated: hbar->isVisible()
TRUEFALSE
yes
Evaluation Count:1237
yes
Evaluation Count:933
933-1237
868 if (q->isRightToLeft())
evaluated: q->isRightToLeft()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1236
1-1236
869 offset.setX(hbar->maximum() - hbar->value());
executed: offset.setX(hbar->maximum() - hbar->value());
Execution Count:1
1
870 else -
871 offset.setX(hbar->value());
executed: offset.setX(hbar->value());
Execution Count:1236
1236
872 } -
873 return offset;
executed: return offset;
Execution Count:2170
2170
874} -
875 -
876 -
877 -
878 -
879 -
880QSize QAbstractScrollArea::minimumSizeHint() const -
881{ -
882 const QAbstractScrollAreaPrivate * const d = d_func(); -
883 int hsbExt = d->hbar->sizeHint().height(); -
884 int vsbExt = d->vbar->sizeHint().width(); -
885 int extra = 2 * d->frameWidth; -
886 QStyleOption opt; -
887 opt.initFrom(this); -
888 if ((d->frameStyle != QFrame::NoFrame)
evaluated: (d->frameStyle != QFrame::NoFrame)
TRUEFALSE
yes
Evaluation Count:2554
yes
Evaluation Count:75
75-2554
889 && style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, this)) {
partially evaluated: style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2554
0-2554
890 extra += style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, this); -
891 }
never executed: }
0
892 return QSize(d->scrollBarContainers[Qt::Horizontal]->sizeHint().width() + vsbExt + extra, 2629
893 d->scrollBarContainers[Qt::Vertical]->sizeHint().height() + hsbExt + extra);
executed: return QSize(d->scrollBarContainers[Qt::Horizontal]->sizeHint().width() + vsbExt + extra, d->scrollBarContainers[Qt::Vertical]->sizeHint().height() + hsbExt + extra);
Execution Count:2629
2629
894} -
895 -
896 -
897 -
898 -
899QSize QAbstractScrollArea::sizeHint() const -
900{ -
901 return QSize(256, 192);
executed: return QSize(256, 192);
Execution Count:1649
1649
902 -
903 -
904 -
905 -
906 -
907 -
908} -
909void QAbstractScrollArea::setupViewport(QWidget *viewport) -
910{ -
911 (void)viewport;; -
912}
executed: }
Execution Count:1
1
913 -
914 -
915 -
916 -
917 -
918 -
919QSize QAbstractScrollArea::viewportSizeHint() const -
920{ -
921 return QSize();
never executed: return QSize();
0
922} -
923 -
924 -
925 -
926 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial