qscrollerproperties.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/util/qscrollerproperties.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8static QScrollerPropertiesPrivate *userDefaults = 0;-
9static QScrollerPropertiesPrivate *systemDefaults = 0;-
10-
11QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()-
12{-
13 if (!systemDefaults
!systemDefaultsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
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 }
never executed: end of block
0
42 return
never executed: return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);
new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);
never executed: return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);
0
43}-
44QScrollerProperties::QScrollerProperties()-
45 : d(QScrollerPropertiesPrivate::defaults())-
46{-
47}
never executed: end of block
0
48-
49-
50-
51-
52QScrollerProperties::QScrollerProperties(const QScrollerProperties &sp)-
53 : d(new QScrollerPropertiesPrivate(*sp.d))-
54{-
55}
never executed: end of block
0
56-
57-
58-
59-
60QScrollerProperties &QScrollerProperties::operator=(const QScrollerProperties &sp)-
61{-
62 *d.data() = *sp.d.data();-
63 return
never executed: return *this;
*this;
never executed: return *this;
0
64}-
65-
66-
67-
68-
69QScrollerProperties::~QScrollerProperties()-
70{-
71}-
72-
73-
74-
75-
76bool QScrollerProperties::operator==(const QScrollerProperties &sp) const-
77{-
78 return
never executed: return *d.data() == *sp.d.data();
*d.data() == *sp.d.data();
never executed: return *d.data() == *sp.d.data();
0
79}-
80-
81-
82-
83-
84bool QScrollerProperties::operator!=(const QScrollerProperties &sp) const-
85{-
86 return
never executed: return !(*d.data() == *sp.d.data());
!(*d.data() == *sp.d.data());
never executed: return !(*d.data() == *sp.d.data());
0
87}-
88-
89bool 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
never executed: return same;
same;
never executed: return same;
0
113}-
114void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties &sp)-
115{-
116 if (!userDefaults
!userDefaultsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
117 userDefaults = new QScrollerPropertiesPrivate(*sp.d);
never executed: userDefaults = new QScrollerPropertiesPrivate(*sp.d);
0
118 else-
119 *
never executed: *userDefaults = *sp.d;
userDefaults = *sp.d;
never executed: *userDefaults = *sp.d;
0
120}-
121-
122-
123-
124-
125-
126-
127-
128void QScrollerProperties::unsetDefaultScrollerProperties()-
129{-
130 delete userDefaults;-
131 userDefaults = 0;-
132}
never executed: end of block
0
133-
134-
135-
136-
137-
138-
139QVariant QScrollerProperties::scrollMetric(ScrollMetric metric) const-
140{-
141 switch (metric) {-
142 case
never executed: case MousePressEventDelay:
MousePressEventDelay:
never executed: case MousePressEventDelay:
return
never executed: return d->mousePressEventDelay;
d->mousePressEventDelay;
never executed: return d->mousePressEventDelay;
0
143 case
never executed: case DragStartDistance:
DragStartDistance:
never executed: case DragStartDistance:
return
never executed: return d->dragStartDistance;
d->dragStartDistance;
never executed: return d->dragStartDistance;
0
144 case
never executed: case DragVelocitySmoothingFactor:
DragVelocitySmoothingFactor:
never executed: case DragVelocitySmoothingFactor:
return
never executed: return d->dragVelocitySmoothingFactor;
d->dragVelocitySmoothingFactor;
never executed: return d->dragVelocitySmoothingFactor;
0
145 case
never executed: case AxisLockThreshold:
AxisLockThreshold:
never executed: case AxisLockThreshold:
return
never executed: return d->axisLockThreshold;
d->axisLockThreshold;
never executed: return d->axisLockThreshold;
0
146 case
never executed: case ScrollingCurve:
ScrollingCurve:
never executed: case ScrollingCurve:
return
never executed: return d->scrollingCurve;
d->scrollingCurve;
never executed: return d->scrollingCurve;
0
147 case
never executed: case DecelerationFactor:
DecelerationFactor:
never executed: case DecelerationFactor:
return
never executed: return d->decelerationFactor;
d->decelerationFactor;
never executed: return d->decelerationFactor;
0
148 case
never executed: case MinimumVelocity:
MinimumVelocity:
never executed: case MinimumVelocity:
return
never executed: return d->minimumVelocity;
d->minimumVelocity;
never executed: return d->minimumVelocity;
0
149 case
never executed: case MaximumVelocity:
MaximumVelocity:
never executed: case MaximumVelocity:
return
never executed: return d->maximumVelocity;
d->maximumVelocity;
never executed: return d->maximumVelocity;
0
150 case
never executed: case MaximumClickThroughVelocity:
MaximumClickThroughVelocity:
never executed: case MaximumClickThroughVelocity:
return
never executed: return d->maximumClickThroughVelocity;
d->maximumClickThroughVelocity;
never executed: return d->maximumClickThroughVelocity;
0
151 case
never executed: case AcceleratingFlickMaximumTime:
AcceleratingFlickMaximumTime:
never executed: case AcceleratingFlickMaximumTime:
return
never executed: return d->acceleratingFlickMaximumTime;
d->acceleratingFlickMaximumTime;
never executed: return d->acceleratingFlickMaximumTime;
0
152 case
never executed: case AcceleratingFlickSpeedupFactor:
AcceleratingFlickSpeedupFactor:
never executed: case AcceleratingFlickSpeedupFactor:
return
never executed: return d->acceleratingFlickSpeedupFactor;
d->acceleratingFlickSpeedupFactor;
never executed: return d->acceleratingFlickSpeedupFactor;
0
153 case
never executed: case SnapPositionRatio:
SnapPositionRatio:
never executed: case SnapPositionRatio:
return
never executed: return d->snapPositionRatio;
d->snapPositionRatio;
never executed: return d->snapPositionRatio;
0
154 case
never executed: case SnapTime:
SnapTime:
never executed: case SnapTime:
return
never executed: return d->snapTime;
d->snapTime;
never executed: return d->snapTime;
0
155 case
never executed: case OvershootDragResistanceFactor:
OvershootDragResistanceFactor:
never executed: case OvershootDragResistanceFactor:
return
never executed: return d->overshootDragResistanceFactor;
d->overshootDragResistanceFactor;
never executed: return d->overshootDragResistanceFactor;
0
156 case
never executed: case OvershootDragDistanceFactor:
OvershootDragDistanceFactor:
never executed: case OvershootDragDistanceFactor:
return
never executed: return d->overshootDragDistanceFactor;
d->overshootDragDistanceFactor;
never executed: return d->overshootDragDistanceFactor;
0
157 case
never executed: case OvershootScrollDistanceFactor:
OvershootScrollDistanceFactor:
never executed: case OvershootScrollDistanceFactor:
return
never executed: return d->overshootScrollDistanceFactor;
d->overshootScrollDistanceFactor;
never executed: return d->overshootScrollDistanceFactor;
0
158 case
never executed: case OvershootScrollTime:
OvershootScrollTime:
never executed: case OvershootScrollTime:
return
never executed: return d->overshootScrollTime;
d->overshootScrollTime;
never executed: return d->overshootScrollTime;
0
159 case
never executed: case HorizontalOvershootPolicy:
HorizontalOvershootPolicy:
never executed: case HorizontalOvershootPolicy:
return
never executed: return QVariant::fromValue(d->hOvershootPolicy);
QVariant::fromValue(d->hOvershootPolicy);
never executed: return QVariant::fromValue(d->hOvershootPolicy);
0
160 case
never executed: case VerticalOvershootPolicy:
VerticalOvershootPolicy:
never executed: case VerticalOvershootPolicy:
return
never executed: return QVariant::fromValue(d->vOvershootPolicy);
QVariant::fromValue(d->vOvershootPolicy);
never executed: return QVariant::fromValue(d->vOvershootPolicy);
0
161 case
never executed: case FrameRate:
FrameRate:
never executed: case FrameRate:
return
never executed: return QVariant::fromValue(d->frameRate);
QVariant::fromValue(d->frameRate);
never executed: return QVariant::fromValue(d->frameRate);
0
162 case
never executed: case ScrollMetricCount:
ScrollMetricCount:
never executed: case ScrollMetricCount:
break;
never executed: break;
0
163 }-
164 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
165}-
166-
167-
168-
169-
170-
171-
172void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &value)-
173{-
174 switch (metric) {-
175 case
never executed: case MousePressEventDelay:
MousePressEventDelay:
never executed: case MousePressEventDelay:
d->mousePressEventDelay = value.toReal(); break;
never executed: break;
0
176 case
never executed: case DragStartDistance:
DragStartDistance:
never executed: case DragStartDistance:
d->dragStartDistance = value.toReal(); break;
never executed: break;
0
177 case
never executed: case DragVelocitySmoothingFactor:
DragVelocitySmoothingFactor:
never executed: case DragVelocitySmoothingFactor:
d->dragVelocitySmoothingFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
never executed: break;
0
178 case
never executed: case AxisLockThreshold:
AxisLockThreshold:
never executed: case AxisLockThreshold:
d->axisLockThreshold = qBound(qreal(0), value.toReal(), qreal(1)); break;
never executed: break;
0
179 case
never executed: case ScrollingCurve:
ScrollingCurve:
never executed: case ScrollingCurve:
d->scrollingCurve = value.toEasingCurve(); break;
never executed: break;
0
180 case
never executed: case DecelerationFactor:
DecelerationFactor:
never executed: case DecelerationFactor:
d->decelerationFactor = value.toReal(); break;
never executed: break;
0
181 case
never executed: case MinimumVelocity:
MinimumVelocity:
never executed: case MinimumVelocity:
d->minimumVelocity = value.toReal(); break;
never executed: break;
0
182 case
never executed: case MaximumVelocity:
MaximumVelocity:
never executed: case MaximumVelocity:
d->maximumVelocity = value.toReal(); break;
never executed: break;
0
183 case
never executed: case MaximumClickThroughVelocity:
MaximumClickThroughVelocity:
never executed: case MaximumClickThroughVelocity:
d->maximumClickThroughVelocity = value.toReal(); break;
never executed: break;
0
184 case
never executed: case AcceleratingFlickMaximumTime:
AcceleratingFlickMaximumTime:
never executed: case AcceleratingFlickMaximumTime:
d->acceleratingFlickMaximumTime = value.toReal(); break;
never executed: break;
0
185 case
never executed: case AcceleratingFlickSpeedupFactor:
AcceleratingFlickSpeedupFactor:
never executed: case AcceleratingFlickSpeedupFactor:
d->acceleratingFlickSpeedupFactor = value.toReal(); break;
never executed: break;
0
186 case
never executed: case SnapPositionRatio:
SnapPositionRatio:
never executed: case SnapPositionRatio:
d->snapPositionRatio = qBound(qreal(0), value.toReal(), qreal(1)); break;
never executed: break;
0
187 case
never executed: case SnapTime:
SnapTime:
never executed: case SnapTime:
d->snapTime = value.toReal(); break;
never executed: break;
0
188 case
never executed: case OvershootDragResistanceFactor:
OvershootDragResistanceFactor:
never executed: case OvershootDragResistanceFactor:
d->overshootDragResistanceFactor = value.toReal(); break;
never executed: break;
0
189 case
never executed: case OvershootDragDistanceFactor:
OvershootDragDistanceFactor:
never executed: case OvershootDragDistanceFactor:
d->overshootDragDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
never executed: break;
0
190 case
never executed: case OvershootScrollDistanceFactor:
OvershootScrollDistanceFactor:
never executed: case OvershootScrollDistanceFactor:
d->overshootScrollDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
never executed: break;
0
191 case
never executed: case OvershootScrollTime:
OvershootScrollTime:
never executed: case OvershootScrollTime:
d->overshootScrollTime = value.toReal(); break;
never executed: break;
0
192 case
never executed: case HorizontalOvershootPolicy:
HorizontalOvershootPolicy:
never executed: case HorizontalOvershootPolicy:
d->hOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;
never executed: break;
0
193 case
never executed: case VerticalOvershootPolicy:
VerticalOvershootPolicy:
never executed: case VerticalOvershootPolicy:
d->vOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;
never executed: break;
0
194 case
never executed: case FrameRate:
FrameRate:
never executed: case FrameRate:
d->frameRate = value.value<QScrollerProperties::FrameRates>(); break;
never executed: break;
0
195 case
never executed: case ScrollMetricCount:
ScrollMetricCount:
never executed: case ScrollMetricCount:
break;
never executed: break;
0
196 }-
197}
never executed: end of block
0
198-
Switch to Source codePreprocessed file

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