| 107 | { |
| 108 | ElaMenu* menu = new ElaMenu(this); |
| 109 | menu->setMenuItemHeight(27); |
| 110 | menu->setAttribute(Qt::WA_DeleteOnClose); |
| 111 | QAction* action = nullptr; |
| 112 | if (!isReadOnly()) |
| 113 | { |
| 114 | action = menu->addElaIconAction(ElaIconType::ArrowRotateLeft, tr("撤销"), QKeySequence::Undo); |
| 115 | action->setEnabled(isUndoAvailable()); |
| 116 | connect(action, &QAction::triggered, this, &ElaLineEdit::undo); |
| 117 | |
| 118 | action = menu->addElaIconAction(ElaIconType::ArrowRotateRight, tr("恢复"), QKeySequence::Redo); |
| 119 | action->setEnabled(isRedoAvailable()); |
| 120 | connect(action, &QAction::triggered, this, &ElaLineEdit::redo); |
| 121 | menu->addSeparator(); |
| 122 | } |
| 123 | #ifndef QT_NO_CLIPBOARD |
| 124 | if (!isReadOnly()) |
| 125 | { |
| 126 | action = menu->addElaIconAction(ElaIconType::KnifeKitchen, tr("剪切"), QKeySequence::Cut); |
| 127 | action->setEnabled(!isReadOnly() && hasSelectedText() && echoMode() == QLineEdit::Normal); |
nothing calls this directly
no test coverage detected