| 80 | } |
| 81 | |
| 82 | void CommandActionPrivate::update(QAction *action, bool initialize) |
| 83 | { |
| 84 | if (!action) |
| 85 | return; |
| 86 | |
| 87 | disconnect(q, &CommandAction::changed, this, &CommandActionPrivate::updateToolTipWithKeySequence); |
| 88 | if (initialize) { |
| 89 | q->setSeparator(action->isSeparator()); |
| 90 | q->setMenuRole(action->menuRole()); |
| 91 | } |
| 92 | if (q->hasAttribute(CommandAction::UpdateIcon) || initialize) { |
| 93 | q->setIcon(action->icon()); |
| 94 | q->setIconText(action->iconText()); |
| 95 | q->setIconVisibleInMenu(action->isIconVisibleInMenu()); |
| 96 | } |
| 97 | if (q->hasAttribute(CommandAction::UpdateText) || initialize) { |
| 98 | q->setText(action->text()); |
| 99 | toolTip = action->toolTip(); |
| 100 | updateToolTipWithKeySequence(); |
| 101 | q->setStatusTip(action->statusTip()); |
| 102 | q->setWhatsThis(action->whatsThis()); |
| 103 | } |
| 104 | |
| 105 | q->setCheckable(action->isCheckable()); |
| 106 | if (!initialize) { |
| 107 | if (q->isChecked() != action->isChecked()) { |
| 108 | if (this->action) |
| 109 | disconnect(q, &CommandAction::toggled, this->action.data(), &QAction::setChecked); |
| 110 | q->setChecked(action->isChecked()); |
| 111 | if (this->action) |
| 112 | connect(q, &CommandAction::toggled, this->action.data(), &QAction::setChecked); |
| 113 | } |
| 114 | q->setEnabled(action->isEnabled()); |
| 115 | q->setVisible(action->isVisible()); |
| 116 | } |
| 117 | connect(q, &CommandAction::changed, this, &CommandActionPrivate::updateToolTipWithKeySequence); |
| 118 | } |
| 119 | |
| 120 | CommandAction::CommandAction(QObject *parent) |
| 121 | : QAction(parent), |
no test coverage detected