Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | static QScrollerPropertiesPrivate *userDefaults = 0; | - |
9 | static QScrollerPropertiesPrivate *systemDefaults = 0; | - |
10 | | - |
11 | QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults() | - |
12 | { | - |
13 | if (!systemDefaults) { evaluated: !systemDefaults yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
14 | QScrollerPropertiesPrivate spp; | - |
15 | spp.mousePressEventDelay = qreal(0.25); | - |
16 | spp.dragStartDistance = qreal(5.0 / 1000); | - |
17 | spp.dragVelocitySmoothingFactor = qreal(0.8); | - |
18 | spp.axisLockThreshold = qreal(0); | - |
19 | spp.scrollingCurve.setType(QEasingCurve::OutQuad); | - |
20 | spp.decelerationFactor = qreal(0.125); | - |
21 | spp.minimumVelocity = qreal(50.0 / 1000); | - |
22 | spp.maximumVelocity = qreal(500.0 / 1000); | - |
23 | spp.maximumClickThroughVelocity = qreal(66.5 / 1000); | - |
24 | spp.acceleratingFlickMaximumTime = qreal(1.25); | - |
25 | spp.acceleratingFlickSpeedupFactor = qreal(3.0); | - |
26 | spp.snapPositionRatio = qreal(0.5); | - |
27 | spp.snapTime = qreal(0.3); | - |
28 | spp.overshootDragResistanceFactor = qreal(0.5); | - |
29 | spp.overshootDragDistanceFactor = qreal(1); | - |
30 | spp.overshootScrollDistanceFactor = qreal(0.5); | - |
31 | spp.overshootScrollTime = qreal(0.7); | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | spp.hOvershootPolicy = QScrollerProperties::OvershootWhenScrollable; | - |
37 | spp.vOvershootPolicy = QScrollerProperties::OvershootWhenScrollable; | - |
38 | spp.frameRate = QScrollerProperties::Standard; | - |
39 | | - |
40 | systemDefaults = new QScrollerPropertiesPrivate(spp); | - |
41 | } executed: } Execution Count:1 | 1 |
42 | return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults); executed: return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults); Execution Count:8 | 8 |
43 | } | - |
44 | QScrollerProperties::QScrollerProperties() | - |
45 | : d(QScrollerPropertiesPrivate::defaults()) | - |
46 | { | - |
47 | } executed: } Execution Count:8 | 8 |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | QScrollerProperties::QScrollerProperties(const QScrollerProperties &sp) | - |
53 | : d(new QScrollerPropertiesPrivate(*sp.d)) | - |
54 | { | - |
55 | } executed: } Execution Count:12 | 12 |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | QScrollerProperties &QScrollerProperties::operator=(const QScrollerProperties &sp) | - |
61 | { | - |
62 | *d.data() = *sp.d.data(); | - |
63 | return *this; executed: return *this; Execution Count:4 | 4 |
64 | } | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | QScrollerProperties::~QScrollerProperties() | - |
70 | { | - |
71 | } | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | bool QScrollerProperties::operator==(const QScrollerProperties &sp) const | - |
77 | { | - |
78 | return *d.data() == *sp.d.data(); executed: return *d.data() == *sp.d.data(); Execution Count:2 | 2 |
79 | } | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | bool QScrollerProperties::operator!=(const QScrollerProperties &sp) const | - |
85 | { | - |
86 | return !(*d.data() == *sp.d.data()); executed: return !(*d.data() == *sp.d.data()); Execution Count:5 | 5 |
87 | } | - |
88 | | - |
89 | bool QScrollerPropertiesPrivate::operator==(const QScrollerPropertiesPrivate &p) const | - |
90 | { | - |
91 | bool same = true; | - |
92 | same &= (mousePressEventDelay == p.mousePressEventDelay); | - |
93 | same &= (dragStartDistance == p.dragStartDistance); | - |
94 | same &= (dragVelocitySmoothingFactor == p.dragVelocitySmoothingFactor); | - |
95 | same &= (axisLockThreshold == p.axisLockThreshold); | - |
96 | same &= (scrollingCurve == p.scrollingCurve); | - |
97 | same &= (decelerationFactor == p.decelerationFactor); | - |
98 | same &= (minimumVelocity == p.minimumVelocity); | - |
99 | same &= (maximumVelocity == p.maximumVelocity); | - |
100 | same &= (maximumClickThroughVelocity == p.maximumClickThroughVelocity); | - |
101 | same &= (acceleratingFlickMaximumTime == p.acceleratingFlickMaximumTime); | - |
102 | same &= (acceleratingFlickSpeedupFactor == p.acceleratingFlickSpeedupFactor); | - |
103 | same &= (snapPositionRatio == p.snapPositionRatio); | - |
104 | same &= (snapTime == p.snapTime); | - |
105 | same &= (overshootDragResistanceFactor == p.overshootDragResistanceFactor); | - |
106 | same &= (overshootDragDistanceFactor == p.overshootDragDistanceFactor); | - |
107 | same &= (overshootScrollDistanceFactor == p.overshootScrollDistanceFactor); | - |
108 | same &= (overshootScrollTime == p.overshootScrollTime); | - |
109 | same &= (hOvershootPolicy == p.hOvershootPolicy); | - |
110 | same &= (vOvershootPolicy == p.vOvershootPolicy); | - |
111 | same &= (frameRate == p.frameRate); | - |
112 | return same; executed: return same; Execution Count:7 | 7 |
113 | } | - |
114 | void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties &sp) | - |
115 | { | - |
116 | if (!userDefaults) never evaluated: !userDefaults | 0 |
117 | userDefaults = new QScrollerPropertiesPrivate(*sp.d); never executed: userDefaults = new QScrollerPropertiesPrivate(*sp.d); | 0 |
118 | else | - |
119 | *userDefaults = *sp.d; never executed: *userDefaults = *sp.d; | 0 |
120 | } | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | void QScrollerProperties::unsetDefaultScrollerProperties() | - |
129 | { | - |
130 | delete userDefaults; | - |
131 | userDefaults = 0; | - |
132 | } | 0 |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | QVariant QScrollerProperties::scrollMetric(ScrollMetric metric) const | - |
140 | { | - |
141 | switch (metric) { | - |
142 | case MousePressEventDelay: return d->mousePressEventDelay; executed: return d->mousePressEventDelay; Execution Count:1 | 1 |
143 | case DragStartDistance: return d->dragStartDistance; executed: return d->dragStartDistance; Execution Count:1 | 1 |
144 | case DragVelocitySmoothingFactor: return d->dragVelocitySmoothingFactor; executed: return d->dragVelocitySmoothingFactor; Execution Count:1 | 1 |
145 | case AxisLockThreshold: return d->axisLockThreshold; executed: return d->axisLockThreshold; Execution Count:1 | 1 |
146 | case ScrollingCurve: return d->scrollingCurve; executed: return d->scrollingCurve; Execution Count:1 | 1 |
147 | case DecelerationFactor: return d->decelerationFactor; executed: return d->decelerationFactor; Execution Count:1 | 1 |
148 | case MinimumVelocity: return d->minimumVelocity; executed: return d->minimumVelocity; Execution Count:1 | 1 |
149 | case MaximumVelocity: return d->maximumVelocity; executed: return d->maximumVelocity; Execution Count:1 | 1 |
150 | case MaximumClickThroughVelocity: return d->maximumClickThroughVelocity; executed: return d->maximumClickThroughVelocity; Execution Count:1 | 1 |
151 | case AcceleratingFlickMaximumTime: return d->acceleratingFlickMaximumTime; executed: return d->acceleratingFlickMaximumTime; Execution Count:1 | 1 |
152 | case AcceleratingFlickSpeedupFactor:return d->acceleratingFlickSpeedupFactor; executed: return d->acceleratingFlickSpeedupFactor; Execution Count:1 | 1 |
153 | case SnapPositionRatio: return d->snapPositionRatio; executed: return d->snapPositionRatio; Execution Count:1 | 1 |
154 | case SnapTime: return d->snapTime; executed: return d->snapTime; Execution Count:1 | 1 |
155 | case OvershootDragResistanceFactor: return d->overshootDragResistanceFactor; executed: return d->overshootDragResistanceFactor; Execution Count:1 | 1 |
156 | case OvershootDragDistanceFactor: return d->overshootDragDistanceFactor; executed: return d->overshootDragDistanceFactor; Execution Count:1 | 1 |
157 | case OvershootScrollDistanceFactor: return d->overshootScrollDistanceFactor; executed: return d->overshootScrollDistanceFactor; Execution Count:1 | 1 |
158 | case OvershootScrollTime: return d->overshootScrollTime; executed: return d->overshootScrollTime; Execution Count:1 | 1 |
159 | case HorizontalOvershootPolicy: return QVariant::fromValue(d->hOvershootPolicy); executed: return QVariant::fromValue(d->hOvershootPolicy); Execution Count:1 | 1 |
160 | case VerticalOvershootPolicy: return QVariant::fromValue(d->vOvershootPolicy); executed: return QVariant::fromValue(d->vOvershootPolicy); Execution Count:1 | 1 |
161 | case FrameRate: return QVariant::fromValue(d->frameRate); executed: return QVariant::fromValue(d->frameRate); Execution Count:1 | 1 |
162 | case ScrollMetricCount: break; | 0 |
163 | } | - |
164 | return QVariant(); never executed: return QVariant(); | 0 |
165 | } | - |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | | - |
172 | void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &value) | - |
173 | { | - |
174 | switch (metric) { | - |
175 | case MousePressEventDelay: d->mousePressEventDelay = value.toReal(); break; executed: break; Execution Count:1 | 1 |
176 | case DragStartDistance: d->dragStartDistance = value.toReal(); break; executed: break; Execution Count:1 | 1 |
177 | case DragVelocitySmoothingFactor: d->dragVelocitySmoothingFactor = qBound(qreal(0), value.toReal(), qreal(1)); break; executed: break; Execution Count:1 | 1 |
178 | case AxisLockThreshold: d->axisLockThreshold = qBound(qreal(0), value.toReal(), qreal(1)); break; executed: break; Execution Count:1 | 1 |
179 | case ScrollingCurve: d->scrollingCurve = value.toEasingCurve(); break; executed: break; Execution Count:1 | 1 |
180 | case DecelerationFactor: d->decelerationFactor = value.toReal(); break; executed: break; Execution Count:1 | 1 |
181 | case MinimumVelocity: d->minimumVelocity = value.toReal(); break; executed: break; Execution Count:1 | 1 |
182 | case MaximumVelocity: d->maximumVelocity = value.toReal(); break; executed: break; Execution Count:1 | 1 |
183 | case MaximumClickThroughVelocity: d->maximumClickThroughVelocity = value.toReal(); break; executed: break; Execution Count:1 | 1 |
184 | case AcceleratingFlickMaximumTime: d->acceleratingFlickMaximumTime = value.toReal(); break; executed: break; Execution Count:1 | 1 |
185 | case AcceleratingFlickSpeedupFactor:d->acceleratingFlickSpeedupFactor = value.toReal(); break; executed: break; Execution Count:1 | 1 |
186 | case SnapPositionRatio: d->snapPositionRatio = qBound(qreal(0), value.toReal(), qreal(1)); break; executed: break; Execution Count:1 | 1 |
187 | case SnapTime: d->snapTime = value.toReal(); break; executed: break; Execution Count:1 | 1 |
188 | case OvershootDragResistanceFactor: d->overshootDragResistanceFactor = value.toReal(); break; executed: break; Execution Count:2 | 2 |
189 | case OvershootDragDistanceFactor: d->overshootDragDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break; executed: break; Execution Count:3 | 3 |
190 | case OvershootScrollDistanceFactor: d->overshootScrollDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break; executed: break; Execution Count:3 | 3 |
191 | case OvershootScrollTime: d->overshootScrollTime = value.toReal(); break; executed: break; Execution Count:1 | 1 |
192 | case HorizontalOvershootPolicy: d->hOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break; executed: break; Execution Count:6 | 6 |
193 | case VerticalOvershootPolicy: d->vOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break; executed: break; Execution Count:1 | 1 |
194 | case FrameRate: d->frameRate = value.value<QScrollerProperties::FrameRates>(); break; executed: break; Execution Count:1 | 1 |
195 | case ScrollMetricCount: break; | 0 |
196 | } | - |
197 | } executed: } Execution Count:30 | 30 |
198 | | - |
199 | | - |
| | |