| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qactiongroup.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 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) { } 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 | - | |||||||
| 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 | ((!(action != 0)) ? qt_assert_x("QWidgetGroup::_q_actionChanged", "internal error",__FILE__,72) : qt_noop()); | - | ||||||
| 29 | if(exclusive
| 0 | ||||||
| 30 | if (action->isChecked()
| 0 | ||||||
| 31 | if (action != current
| 0 | ||||||
| 32 | if(current
| 0 | ||||||
| 33 | current->setChecked(false); never executed: current->setChecked(false); | 0 | ||||||
| 34 | current = action; | - | ||||||
| 35 | } never executed: end of block | 0 | ||||||
| 36 | } never executed: else if (action == currentend of block
| 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 | - | |||||||
| 42 | void 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 | - | |||||||
| 50 | void 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 | ||||||
| 57 | QActionGroup::QActionGroup(QObject* parent) : QObject(*new QActionGroupPrivate, parent) | - | ||||||
| 58 | { | - | ||||||
| 59 | } never executed: end of block | 0 | ||||||
| 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)
| 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
| 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
| 0 | ||||||
| 81 | a->setVisible(d->visible); | - | ||||||
| 82 | a->d_func()->forceInvisible = false; | - | ||||||
| 83 | } never executed: end of block | 0 | ||||||
| 84 | if(a->isChecked()
| 0 | ||||||
| 85 | d->current = a; never executed: d->current = a; | 0 | ||||||
| 86 | QActionGroup *oldGroup = a->d_func()->group; | - | ||||||
| 87 | if(oldGroup != this
| 0 | ||||||
| 88 | if (oldGroup
| 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: a;return a;never executed: return a; | 0 | ||||||
| 94 | } | - | ||||||
| 95 | QAction *QActionGroup::addAction(const QString &text) | - | ||||||
| 96 | { | - | ||||||
| 97 | return never executed: new QAction(text, this);return new QAction(text, this);never executed: return new QAction(text, this); | 0 | ||||||
| 98 | } | - | ||||||
| 99 | QAction *QActionGroup::addAction(const QIcon &icon, const QString &text) | - | ||||||
| 100 | { | - | ||||||
| 101 | return never executed: new QAction(icon, text, this);return new QAction(icon, text, this);never executed: return new QAction(icon, text, this); | 0 | ||||||
| 102 | } | - | ||||||
| 103 | - | |||||||
| 104 | - | |||||||
| 105 | - | |||||||
| 106 | - | |||||||
| 107 | - | |||||||
| 108 | - | |||||||
| 109 | - | |||||||
| 110 | void QActionGroup::removeAction(QAction *action) | - | ||||||
| 111 | { | - | ||||||
| 112 | QActionGroupPrivate * const d = d_func(); | - | ||||||
| 113 | if (d->actions.removeAll(action)
| 0 | ||||||
| 114 | if (action == d->current
| 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 | - | |||||||
| 126 | QList<QAction*> QActionGroup::actions() const | - | ||||||
| 127 | { | - | ||||||
| 128 | const QActionGroupPrivate * const d = d_func(); | - | ||||||
| 129 | return never executed: d->actions;return d->actions;never executed: return d->actions; | 0 | ||||||
| 130 | } | - | ||||||
| 131 | void QActionGroup::setExclusive(bool b) | - | ||||||
| 132 | { | - | ||||||
| 133 | QActionGroupPrivate * const d = d_func(); | - | ||||||
| 134 | d->exclusive = b; | - | ||||||
| 135 | } never executed: end of block | 0 | ||||||
| 136 | - | |||||||
| 137 | bool QActionGroup::isExclusive() const | - | ||||||
| 138 | { | - | ||||||
| 139 | const QActionGroupPrivate * const d = d_func(); | - | ||||||
| 140 | return never executed: d->exclusive;return d->exclusive;never executed: return d->exclusive; | 0 | ||||||
| 141 | } | - | ||||||
| 142 | void 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()
| 0 | ||||||
| 147 | if(!(*it)->d_func()->forceDisabled
| 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 | - | |||||||
| 154 | bool QActionGroup::isEnabled() const | - | ||||||
| 155 | { | - | ||||||
| 156 | const QActionGroupPrivate * const d = d_func(); | - | ||||||
| 157 | return never executed: d->enabled;return d->enabled;never executed: return d->enabled; | 0 | ||||||
| 158 | } | - | ||||||
| 159 | - | |||||||
| 160 | - | |||||||
| 161 | - | |||||||
| 162 | - | |||||||
| 163 | - | |||||||
| 164 | QAction *QActionGroup::checkedAction() const | - | ||||||
| 165 | { | - | ||||||
| 166 | const QActionGroupPrivate * const d = d_func(); | - | ||||||
| 167 | return never executed: d->current;return d->current;never executed: return d->current; | 0 | ||||||
| 168 | } | - | ||||||
| 169 | void 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()
| 0 | ||||||
| 174 | if(!(*it)->d_func()->forceInvisible
| 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 | - | |||||||
| 181 | bool QActionGroup::isVisible() const | - | ||||||
| 182 | { | - | ||||||
| 183 | const QActionGroupPrivate * const d = d_func(); | - | ||||||
| 184 | return never executed: d->visible;return d->visible;never executed: return d->visible; | 0 | ||||||
| 185 | } | - | ||||||
| 186 | - | |||||||
| 187 | - | |||||||
| Switch to Source code | Preprocessed file |