Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | class QActionGroupPrivate : public QObjectPrivate | - |
8 | { | - |
9 | inline QActionGroup* q_func() { return static_cast<QActionGroup *>(q_ptr); } inline const QActionGroup* q_func() const { return static_cast<const QActionGroup *>(q_ptr); } friend class QActionGroup; | - |
10 | public: | - |
11 | QActionGroupPrivate() : exclusive(1), enabled(1), visible(1) { } executed: } Execution Count:198 | 198 |
12 | QList<QAction *> actions; | - |
13 | QPointer<QAction> current; | - |
14 | uint exclusive : 1; | - |
15 | uint enabled : 1; | - |
16 | uint visible : 1; | - |
17 | | - |
18 | private: | - |
19 | void _q_actionTriggered(); | - |
20 | void _q_actionChanged(); | - |
21 | void _q_actionHovered(); | - |
22 | }; | - |
23 | | - |
24 | void QActionGroupPrivate::_q_actionChanged() | - |
25 | { | - |
26 | QActionGroup * const q = q_func(); | - |
27 | QAction *action = qobject_cast<QAction*>(q->sender()); | - |
28 | qt_noop(); | - |
29 | if(exclusive) { evaluated: exclusive yes Evaluation Count:29 | yes Evaluation Count:1704 |
| 29-1704 |
30 | if (action->isChecked()) { evaluated: action->isChecked() yes Evaluation Count:4 | yes Evaluation Count:25 |
| 4-25 |
31 | if (action != current) { partially evaluated: action != current yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
32 | if(current) evaluated: current yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
33 | current->setChecked(false); executed: current->setChecked(false); Execution Count:1 | 1 |
34 | current = action; | - |
35 | } executed: } Execution Count:4 | 4 |
36 | } else if (action == current) { executed: } Execution Count:4 evaluated: action == current yes Evaluation Count:2 | yes Evaluation Count:23 |
| 2-23 |
37 | current = 0; | - |
38 | } executed: } Execution Count:2 | 2 |
39 | } | - |
40 | } executed: } Execution Count:1733 | 1733 |
41 | | - |
42 | void QActionGroupPrivate::_q_actionTriggered() | - |
43 | { | - |
44 | QActionGroup * const q = q_func(); | - |
45 | QAction *action = qobject_cast<QAction*>(q->sender()); | - |
46 | qt_noop(); | - |
47 | q->triggered(action); | - |
48 | } executed: } Execution Count:1 | 1 |
49 | | - |
50 | void QActionGroupPrivate::_q_actionHovered() | - |
51 | { | - |
52 | QActionGroup * const q = q_func(); | - |
53 | QAction *action = qobject_cast<QAction*>(q->sender()); | - |
54 | qt_noop(); | - |
55 | q->hovered(action); | - |
56 | } | 0 |
57 | QActionGroup::QActionGroup(QObject* parent) : QObject(*new QActionGroupPrivate, parent) | - |
58 | { | - |
59 | } executed: } Execution Count:198 | 198 |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | QActionGroup::~QActionGroup() | - |
65 | { | - |
66 | } | - |
67 | QAction *QActionGroup::addAction(QAction* a) | - |
68 | { | - |
69 | QActionGroupPrivate * const d = d_func(); | - |
70 | if(!d->actions.contains(a)) { evaluated: !d->actions.contains(a) yes Evaluation Count:588 | yes Evaluation Count:3 |
| 3-588 |
71 | d->actions.append(a); | - |
72 | QObject::connect(a, "2""triggered()", this, "1""_q_actionTriggered()"); | - |
73 | QObject::connect(a, "2""changed()", this, "1""_q_actionChanged()"); | - |
74 | QObject::connect(a, "2""hovered()", this, "1""_q_actionHovered()"); | - |
75 | } executed: } Execution Count:588 | 588 |
76 | if(!a->d_func()->forceDisabled) { evaluated: !a->d_func()->forceDisabled yes Evaluation Count:590 | yes Evaluation Count:1 |
| 1-590 |
77 | a->setEnabled(d->enabled); | - |
78 | a->d_func()->forceDisabled = false; | - |
79 | } executed: } Execution Count:590 | 590 |
80 | if(!a->d_func()->forceInvisible) { evaluated: !a->d_func()->forceInvisible yes Evaluation Count:590 | yes Evaluation Count:1 |
| 1-590 |
81 | a->setVisible(d->visible); | - |
82 | a->d_func()->forceInvisible = false; | - |
83 | } executed: } Execution Count:590 | 590 |
84 | if(a->isChecked()) partially evaluated: a->isChecked() no Evaluation Count:0 | yes Evaluation Count:591 |
| 0-591 |
85 | d->current = a; never executed: d->current = a; | 0 |
86 | QActionGroup *oldGroup = a->d_func()->group; | - |
87 | if(oldGroup != this) { evaluated: oldGroup != this yes Evaluation Count:4 | yes Evaluation Count:587 |
| 4-587 |
88 | if (oldGroup) evaluated: oldGroup yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
89 | oldGroup->removeAction(a); executed: oldGroup->removeAction(a); Execution Count:1 | 1 |
90 | a->d_func()->group = this; | - |
91 | } executed: } Execution Count:4 | 4 |
92 | return a; executed: return a; Execution Count:591 | 591 |
93 | } | - |
94 | QAction *QActionGroup::addAction(const QString &text) | - |
95 | { | - |
96 | return new QAction(text, this); never executed: return new QAction(text, this); | 0 |
97 | } | - |
98 | QAction *QActionGroup::addAction(const QIcon &icon, const QString &text) | - |
99 | { | - |
100 | return new QAction(icon, text, this); never executed: return new QAction(icon, text, this); | 0 |
101 | } | - |
102 | | - |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | void QActionGroup::removeAction(QAction *action) | - |
110 | { | - |
111 | QActionGroupPrivate * const d = d_func(); | - |
112 | if (d->actions.removeAll(action)) { partially evaluated: d->actions.removeAll(action) yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
113 | if (action == d->current) partially evaluated: action == d->current no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
114 | d->current = 0; never executed: d->current = 0; | 0 |
115 | QObject::disconnect(action, "2""triggered()", this, "1""_q_actionTriggered()"); | - |
116 | QObject::disconnect(action, "2""changed()", this, "1""_q_actionChanged()"); | - |
117 | QObject::disconnect(action, "2""hovered()", this, "1""_q_actionHovered()"); | - |
118 | action->d_func()->group = 0; | - |
119 | } executed: } Execution Count:6 | 6 |
120 | } executed: } Execution Count:6 | 6 |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | QList<QAction*> QActionGroup::actions() const | - |
126 | { | - |
127 | const QActionGroupPrivate * const d = d_func(); | - |
128 | return d->actions; executed: return d->actions; Execution Count:5 | 5 |
129 | } | - |
130 | void QActionGroup::setExclusive(bool b) | - |
131 | { | - |
132 | QActionGroupPrivate * const d = d_func(); | - |
133 | d->exclusive = b; | - |
134 | } executed: } Execution Count:191 | 191 |
135 | | - |
136 | bool QActionGroup::isExclusive() const | - |
137 | { | - |
138 | const QActionGroupPrivate * const d = d_func(); | - |
139 | return d->exclusive; executed: return d->exclusive; Execution Count:2 | 2 |
140 | } | - |
141 | void QActionGroup::setEnabled(bool b) | - |
142 | { | - |
143 | QActionGroupPrivate * const d = d_func(); | - |
144 | d->enabled = b; | - |
145 | for(QList<QAction*>::const_iterator it = d->actions.constBegin(); it != d->actions.constEnd(); ++it) { evaluated: it != d->actions.constEnd() yes Evaluation Count:9 | yes Evaluation Count:4 |
| 4-9 |
146 | if(!(*it)->d_func()->forceDisabled) { evaluated: !(*it)->d_func()->forceDisabled yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
147 | (*it)->setEnabled(b); | - |
148 | (*it)->d_func()->forceDisabled = false; | - |
149 | } executed: } Execution Count:6 | 6 |
150 | } executed: } Execution Count:9 | 9 |
151 | } executed: } Execution Count:4 | 4 |
152 | | - |
153 | bool QActionGroup::isEnabled() const | - |
154 | { | - |
155 | const QActionGroupPrivate * const d = d_func(); | - |
156 | return d->enabled; executed: return d->enabled; Execution Count:10 | 10 |
157 | } | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | QAction *QActionGroup::checkedAction() const | - |
164 | { | - |
165 | const QActionGroupPrivate * const d = d_func(); | - |
166 | return d->current; executed: return d->current; Execution Count:3 | 3 |
167 | } | - |
168 | void QActionGroup::setVisible(bool b) | - |
169 | { | - |
170 | QActionGroupPrivate * const d = d_func(); | - |
171 | d->visible = b; | - |
172 | for(QList<QAction*>::Iterator it = d->actions.begin(); it != d->actions.end(); ++it) { evaluated: it != d->actions.end() yes Evaluation Count:9 | yes Evaluation Count:4 |
| 4-9 |
173 | if(!(*it)->d_func()->forceInvisible) { evaluated: !(*it)->d_func()->forceInvisible yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
174 | (*it)->setVisible(b); | - |
175 | (*it)->d_func()->forceInvisible = false; | - |
176 | } executed: } Execution Count:6 | 6 |
177 | } executed: } Execution Count:9 | 9 |
178 | } executed: } Execution Count:4 | 4 |
179 | | - |
180 | bool QActionGroup::isVisible() const | - |
181 | { | - |
182 | const QActionGroupPrivate * const d = d_func(); | - |
183 | return d->visible; executed: return d->visible; Execution Count:3 | 3 |
184 | } | - |
185 | | - |
186 | | - |
187 | | - |
| | |