qabstractscrollarea.cpp

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

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