OpenCoverage

qactiongroup.cpp

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

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