Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | namespace QAccessibleBridgeUtils { | - | ||||||||||||
7 | - | |||||||||||||
8 | static bool performAction(QAccessibleInterface *iface, const QString &actionName) | - | ||||||||||||
9 | { | - | ||||||||||||
10 | if (QAccessibleActionInterface *actionIface = iface->actionInterface()
| 0 | ||||||||||||
11 | if (actionIface->actionNames().contains(actionName)
| 0 | ||||||||||||
12 | actionIface->doAction(actionName); | - | ||||||||||||
13 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
14 | } | - | ||||||||||||
15 | } never executed: end of block | 0 | ||||||||||||
16 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
17 | } | - | ||||||||||||
18 | - | |||||||||||||
19 | QStringList effectiveActionNames(QAccessibleInterface *iface) | - | ||||||||||||
20 | { | - | ||||||||||||
21 | QStringList actions; | - | ||||||||||||
22 | if (QAccessibleActionInterface *actionIface = iface->actionInterface()
| 0 | ||||||||||||
23 | actions = actionIface->actionNames(); never executed: actions = actionIface->actionNames(); | 0 | ||||||||||||
24 | - | |||||||||||||
25 | if (iface->valueInterface()
| 0 | ||||||||||||
26 | if (!actions.contains(QAccessibleActionInterface::increaseAction())
| 0 | ||||||||||||
27 | actions << QAccessibleActionInterface::increaseAction(); never executed: actions << QAccessibleActionInterface::increaseAction(); | 0 | ||||||||||||
28 | if (!actions.contains(QAccessibleActionInterface::decreaseAction())
| 0 | ||||||||||||
29 | actions << QAccessibleActionInterface::decreaseAction(); never executed: actions << QAccessibleActionInterface::decreaseAction(); | 0 | ||||||||||||
30 | } never executed: end of block | 0 | ||||||||||||
31 | return never executed: actions;return actions; never executed: return actions; | 0 | ||||||||||||
32 | } | - | ||||||||||||
33 | - | |||||||||||||
34 | bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionName) | - | ||||||||||||
35 | { | - | ||||||||||||
36 | if (!iface
| 0 | ||||||||||||
37 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
38 | if (performAction(iface, actionName)
| 0 | ||||||||||||
39 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
40 | if (actionName != QAccessibleActionInterface::increaseAction()
| 0 | ||||||||||||
41 | && actionName != QAccessibleActionInterface::decreaseAction()
| 0 | ||||||||||||
42 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
43 | - | |||||||||||||
44 | QAccessibleValueInterface *valueIface = iface->valueInterface(); | - | ||||||||||||
45 | if (!valueIface
| 0 | ||||||||||||
46 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
47 | bool success; | - | ||||||||||||
48 | const QVariant currentVariant = valueIface->currentValue(); | - | ||||||||||||
49 | double stepSize = valueIface->minimumStepSize().toDouble(&success); | - | ||||||||||||
50 | if (!success
| 0 | ||||||||||||
51 | const double min = valueIface->minimumValue().toDouble(&success); | - | ||||||||||||
52 | if (!success
| 0 | ||||||||||||
53 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
54 | const double max = valueIface->maximumValue().toDouble(&success); | - | ||||||||||||
55 | if (!success
| 0 | ||||||||||||
56 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
57 | stepSize = (max - min) / 10; | - | ||||||||||||
58 | const int typ = currentVariant.type(); | - | ||||||||||||
59 | if (typ != QMetaType::Float
| 0 | ||||||||||||
60 | - | |||||||||||||
61 | stepSize = qCeil(stepSize); | - | ||||||||||||
62 | } never executed: end of block | 0 | ||||||||||||
63 | } never executed: end of block | 0 | ||||||||||||
64 | const double current = currentVariant.toDouble(&success); | - | ||||||||||||
65 | if (!success
| 0 | ||||||||||||
66 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
67 | if (actionName == QAccessibleActionInterface::decreaseAction()
| 0 | ||||||||||||
68 | stepSize = -stepSize; never executed: stepSize = -stepSize; | 0 | ||||||||||||
69 | valueIface->setCurrentValue(current + stepSize); | - | ||||||||||||
70 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
71 | } | - | ||||||||||||
72 | - | |||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | - | |||||||||||||
Switch to Source code | Preprocessed file |