| 85 | menu->addSeparator(); |
| 86 | const uint se = stepEnabled(); |
| 87 | QAction* up = menu->addElaIconAction(ElaIconType::Plus, tr("增加")); |
| 88 | up->setEnabled(se & StepUpEnabled); |
| 89 | QAction* down = menu->addElaIconAction(ElaIconType::Minus, tr("减少")); |
| 90 | down->setEnabled(se & StepDownEnabled); |
| 91 | menu->addSeparator(); |
| 92 | |
| 93 | const QAbstractSpinBox* that = this; |
| 94 | const QPoint pos = (event->reason() == QContextMenuEvent::Mouse) |
| 95 | ? event->globalPos() |
| 96 | : mapToGlobal(QPoint(event->pos().x(), 0)) + QPoint(width() / 2, height() / 2); |
| 97 | const QAction* action = menu->exec(pos); |
| 98 | delete menu; |
| 99 | if (that && action) |
| 100 | { |
| 101 | if (action == up) |
| 102 | { |
| 103 | stepBy(1); |
| 104 | } |
| 105 | else if (action == down) |
| 106 | { |
nothing calls this directly
no outgoing calls
no test coverage detected