| 45 | |
| 46 | void ElaPlainTextEdit::contextMenuEvent(QContextMenuEvent* event) |
| 47 | { |
| 48 | ElaMenu* menu = new ElaMenu(this); |
| 49 | menu->setMenuItemHeight(27); |
| 50 | menu->setAttribute(Qt::WA_DeleteOnClose); |
| 51 | QAction* action = nullptr; |
| 52 | if (!isReadOnly()) |
| 53 | { |
| 54 | action = menu->addElaIconAction(ElaIconType::ArrowRotateLeft, "撤销", QKeySequence::Undo); |
| 55 | action->setEnabled(isUndoRedoEnabled() ? document()->isUndoAvailable() : false); |
| 56 | connect(action, &QAction::triggered, this, &ElaPlainTextEdit::undo); |
| 57 | |
| 58 | action = menu->addElaIconAction(ElaIconType::ArrowRotateRight, "恢复", QKeySequence::Redo); |
| 59 | action->setEnabled(isUndoRedoEnabled() ? document()->isRedoAvailable() : false); |
| 60 | connect(action, &QAction::triggered, this, &ElaPlainTextEdit::redo); |
| 61 | menu->addSeparator(); |
| 62 | } |
| 63 | #ifndef QT_NO_CLIPBOARD |
| 64 | if (!isReadOnly()) |
| 65 | { |
| 66 | action = menu->addElaIconAction(ElaIconType::KnifeKitchen, "剪切", QKeySequence::Cut); |
nothing calls this directly
no outgoing calls
no test coverage detected