| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/util/qscrollerproperties.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 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
| 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: new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);never executed: return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults); | 0 | ||||||
| 43 | } | - | ||||||
| 44 | QScrollerProperties::QScrollerProperties() | - | ||||||
| 45 | : d(QScrollerPropertiesPrivate::defaults()) | - | ||||||
| 46 | { | - | ||||||
| 47 | } never executed: end of block | 0 | ||||||
| 48 | - | |||||||
| 49 | - | |||||||
| 50 | - | |||||||
| 51 | - | |||||||
| 52 | QScrollerProperties::QScrollerProperties(const QScrollerProperties &sp) | - | ||||||
| 53 | : d(new QScrollerPropertiesPrivate(*sp.d)) | - | ||||||
| 54 | { | - | ||||||
| 55 | } never executed: end of block | 0 | ||||||
| 56 | - | |||||||
| 57 | - | |||||||
| 58 | - | |||||||
| 59 | - | |||||||
| 60 | QScrollerProperties &QScrollerProperties::operator=(const QScrollerProperties &sp) | - | ||||||
| 61 | { | - | ||||||
| 62 | *d.data() = *sp.d.data(); | - | ||||||
| 63 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||
| 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 never executed: *d.data() == *sp.d.data();return *d.data() == *sp.d.data();never executed: return *d.data() == *sp.d.data(); | 0 | ||||||
| 79 | } | - | ||||||
| 80 | - | |||||||
| 81 | - | |||||||
| 82 | - | |||||||
| 83 | - | |||||||
| 84 | bool QScrollerProperties::operator!=(const QScrollerProperties &sp) const | - | ||||||
| 85 | { | - | ||||||
| 86 | return never executed: !(*d.data() == *sp.d.data());return !(*d.data() == *sp.d.data());never executed: return !(*d.data() == *sp.d.data()); | 0 | ||||||
| 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 never executed: same;return same;never executed: return same; | 0 | ||||||
| 113 | } | - | ||||||
| 114 | void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties &sp) | - | ||||||
| 115 | { | - | ||||||
| 116 | if (!userDefaults
| 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 | - | |||||||
| 128 | void QScrollerProperties::unsetDefaultScrollerProperties() | - | ||||||
| 129 | { | - | ||||||
| 130 | delete userDefaults; | - | ||||||
| 131 | userDefaults = 0; | - | ||||||
| 132 | } never executed: end of block | 0 | ||||||
| 133 | - | |||||||
| 134 | - | |||||||
| 135 | - | |||||||
| 136 | - | |||||||
| 137 | - | |||||||
| 138 | - | |||||||
| 139 | QVariant QScrollerProperties::scrollMetric(ScrollMetric metric) const | - | ||||||
| 140 | { | - | ||||||
| 141 | switch (metric) { | - | ||||||
| 142 | case never executed: MousePressEventDelay:case MousePressEventDelay:never executed: returncase MousePressEventDelay:never executed: d->mousePressEventDelay;return d->mousePressEventDelay;never executed: return d->mousePressEventDelay; | 0 | ||||||
| 143 | case never executed: DragStartDistance:case DragStartDistance:never executed: returncase DragStartDistance:never executed: d->dragStartDistance;return d->dragStartDistance;never executed: return d->dragStartDistance; | 0 | ||||||
| 144 | case never executed: DragVelocitySmoothingFactor:case DragVelocitySmoothingFactor:never executed: returncase DragVelocitySmoothingFactor:never executed: d->dragVelocitySmoothingFactor;return d->dragVelocitySmoothingFactor;never executed: return d->dragVelocitySmoothingFactor; | 0 | ||||||
| 145 | case never executed: AxisLockThreshold:case AxisLockThreshold:never executed: returncase AxisLockThreshold:never executed: d->axisLockThreshold;return d->axisLockThreshold;never executed: return d->axisLockThreshold; | 0 | ||||||
| 146 | case never executed: ScrollingCurve:case ScrollingCurve:never executed: returncase ScrollingCurve:never executed: d->scrollingCurve;return d->scrollingCurve;never executed: return d->scrollingCurve; | 0 | ||||||
| 147 | case never executed: DecelerationFactor:case DecelerationFactor:never executed: returncase DecelerationFactor:never executed: d->decelerationFactor;return d->decelerationFactor;never executed: return d->decelerationFactor; | 0 | ||||||
| 148 | case never executed: MinimumVelocity:case MinimumVelocity:never executed: returncase MinimumVelocity:never executed: d->minimumVelocity;return d->minimumVelocity;never executed: return d->minimumVelocity; | 0 | ||||||
| 149 | case never executed: MaximumVelocity:case MaximumVelocity:never executed: returncase MaximumVelocity:never executed: d->maximumVelocity;return d->maximumVelocity;never executed: return d->maximumVelocity; | 0 | ||||||
| 150 | case never executed: MaximumClickThroughVelocity:case MaximumClickThroughVelocity:never executed: returncase MaximumClickThroughVelocity:never executed: d->maximumClickThroughVelocity;return d->maximumClickThroughVelocity;never executed: return d->maximumClickThroughVelocity; | 0 | ||||||
| 151 | case never executed: AcceleratingFlickMaximumTime:case AcceleratingFlickMaximumTime:never executed: returncase AcceleratingFlickMaximumTime:never executed: d->acceleratingFlickMaximumTime;return d->acceleratingFlickMaximumTime;never executed: return d->acceleratingFlickMaximumTime; | 0 | ||||||
| 152 | case never executed: AcceleratingFlickSpeedupFactor:case AcceleratingFlickSpeedupFactor:never executed: returncase AcceleratingFlickSpeedupFactor:never executed: d->acceleratingFlickSpeedupFactor;return d->acceleratingFlickSpeedupFactor;never executed: return d->acceleratingFlickSpeedupFactor; | 0 | ||||||
| 153 | case never executed: SnapPositionRatio:case SnapPositionRatio:never executed: returncase SnapPositionRatio:never executed: d->snapPositionRatio;return d->snapPositionRatio;never executed: return d->snapPositionRatio; | 0 | ||||||
| 154 | case never executed: SnapTime:case SnapTime:never executed: returncase SnapTime:never executed: d->snapTime;return d->snapTime;never executed: return d->snapTime; | 0 | ||||||
| 155 | case never executed: OvershootDragResistanceFactor:case OvershootDragResistanceFactor:never executed: returncase OvershootDragResistanceFactor:never executed: d->overshootDragResistanceFactor;return d->overshootDragResistanceFactor;never executed: return d->overshootDragResistanceFactor; | 0 | ||||||
| 156 | case never executed: OvershootDragDistanceFactor:case OvershootDragDistanceFactor:never executed: returncase OvershootDragDistanceFactor:never executed: d->overshootDragDistanceFactor;return d->overshootDragDistanceFactor;never executed: return d->overshootDragDistanceFactor; | 0 | ||||||
| 157 | case never executed: OvershootScrollDistanceFactor:case OvershootScrollDistanceFactor:never executed: returncase OvershootScrollDistanceFactor:never executed: d->overshootScrollDistanceFactor;return d->overshootScrollDistanceFactor;never executed: return d->overshootScrollDistanceFactor; | 0 | ||||||
| 158 | case never executed: OvershootScrollTime:case OvershootScrollTime:never executed: returncase OvershootScrollTime:never executed: d->overshootScrollTime;return d->overshootScrollTime;never executed: return d->overshootScrollTime; | 0 | ||||||
| 159 | case never executed: HorizontalOvershootPolicy:case HorizontalOvershootPolicy:never executed: returncase HorizontalOvershootPolicy:never executed: QVariant::fromValue(d->hOvershootPolicy);return QVariant::fromValue(d->hOvershootPolicy);never executed: return QVariant::fromValue(d->hOvershootPolicy); | 0 | ||||||
| 160 | case never executed: VerticalOvershootPolicy:case VerticalOvershootPolicy:never executed: returncase VerticalOvershootPolicy:never executed: QVariant::fromValue(d->vOvershootPolicy);return QVariant::fromValue(d->vOvershootPolicy);never executed: return QVariant::fromValue(d->vOvershootPolicy); | 0 | ||||||
| 161 | case never executed: FrameRate:case FrameRate:never executed: returncase FrameRate:never executed: QVariant::fromValue(d->frameRate);return QVariant::fromValue(d->frameRate);never executed: return QVariant::fromValue(d->frameRate); | 0 | ||||||
| 162 | case never executed: ScrollMetricCount:case ScrollMetricCount:never executed: break;case ScrollMetricCount:never executed: break; | 0 | ||||||
| 163 | } | - | ||||||
| 164 | return never executed: QVariant();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 never executed: MousePressEventDelay:case MousePressEventDelay:never executed: d->mousePressEventDelay = value.toReal(); break;case MousePressEventDelay:never executed: break; | 0 | ||||||
| 176 | case never executed: DragStartDistance:case DragStartDistance:never executed: d->dragStartDistance = value.toReal(); break;case DragStartDistance:never executed: break; | 0 | ||||||
| 177 | case never executed: DragVelocitySmoothingFactor:case DragVelocitySmoothingFactor:never executed: d->dragVelocitySmoothingFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;case DragVelocitySmoothingFactor:never executed: break; | 0 | ||||||
| 178 | case never executed: AxisLockThreshold:case AxisLockThreshold:never executed: d->axisLockThreshold = qBound(qreal(0), value.toReal(), qreal(1)); break;case AxisLockThreshold:never executed: break; | 0 | ||||||
| 179 | case never executed: ScrollingCurve:case ScrollingCurve:never executed: d->scrollingCurve = value.toEasingCurve(); break;case ScrollingCurve:never executed: break; | 0 | ||||||
| 180 | case never executed: DecelerationFactor:case DecelerationFactor:never executed: d->decelerationFactor = value.toReal(); break;case DecelerationFactor:never executed: break; | 0 | ||||||
| 181 | case never executed: MinimumVelocity:case MinimumVelocity:never executed: d->minimumVelocity = value.toReal(); break;case MinimumVelocity:never executed: break; | 0 | ||||||
| 182 | case never executed: MaximumVelocity:case MaximumVelocity:never executed: d->maximumVelocity = value.toReal(); break;case MaximumVelocity:never executed: break; | 0 | ||||||
| 183 | case never executed: MaximumClickThroughVelocity:case MaximumClickThroughVelocity:never executed: d->maximumClickThroughVelocity = value.toReal(); break;case MaximumClickThroughVelocity:never executed: break; | 0 | ||||||
| 184 | case never executed: AcceleratingFlickMaximumTime:case AcceleratingFlickMaximumTime:never executed: d->acceleratingFlickMaximumTime = value.toReal(); break;case AcceleratingFlickMaximumTime:never executed: break; | 0 | ||||||
| 185 | case never executed: AcceleratingFlickSpeedupFactor:case AcceleratingFlickSpeedupFactor:never executed: d->acceleratingFlickSpeedupFactor = value.toReal(); break;case AcceleratingFlickSpeedupFactor:never executed: break; | 0 | ||||||
| 186 | case never executed: SnapPositionRatio:case SnapPositionRatio:never executed: d->snapPositionRatio = qBound(qreal(0), value.toReal(), qreal(1)); break;case SnapPositionRatio:never executed: break; | 0 | ||||||
| 187 | case never executed: SnapTime:case SnapTime:never executed: d->snapTime = value.toReal(); break;case SnapTime:never executed: break; | 0 | ||||||
| 188 | case never executed: OvershootDragResistanceFactor:case OvershootDragResistanceFactor:never executed: d->overshootDragResistanceFactor = value.toReal(); break;case OvershootDragResistanceFactor:never executed: break; | 0 | ||||||
| 189 | case never executed: OvershootDragDistanceFactor:case OvershootDragDistanceFactor:never executed: d->overshootDragDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;case OvershootDragDistanceFactor:never executed: break; | 0 | ||||||
| 190 | case never executed: OvershootScrollDistanceFactor:case OvershootScrollDistanceFactor:never executed: d->overshootScrollDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;case OvershootScrollDistanceFactor:never executed: break; | 0 | ||||||
| 191 | case never executed: OvershootScrollTime:case OvershootScrollTime:never executed: d->overshootScrollTime = value.toReal(); break;case OvershootScrollTime:never executed: break; | 0 | ||||||
| 192 | case never executed: HorizontalOvershootPolicy:case HorizontalOvershootPolicy:never executed: d->hOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;case HorizontalOvershootPolicy:never executed: break; | 0 | ||||||
| 193 | case never executed: VerticalOvershootPolicy:case VerticalOvershootPolicy:never executed: d->vOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;case VerticalOvershootPolicy:never executed: break; | 0 | ||||||
| 194 | case never executed: FrameRate:case FrameRate:never executed: d->frameRate = value.value<QScrollerProperties::FrameRates>(); break;case FrameRate:never executed: break; | 0 | ||||||
| 195 | case never executed: ScrollMetricCount:case ScrollMetricCount:never executed: break;case ScrollMetricCount:never executed: break; | 0 | ||||||
| 196 | } | - | ||||||
| 197 | } never executed: end of block | 0 | ||||||
| 198 | - | |||||||
| Switch to Source code | Preprocessed file |