FEAT(ui): Add ability to paste and send messages using a keyboard shortcut

As requested in Issue #4257 this commit implements the ability to paste and send messages whit a single keyboard shortcut.
The keyboard shortcut is Ctrl + Shift + V, as requested.
I tried to add the shortcut into the "paste and send" drop down menu item but the shortcut is not visible to me, maybe it's because my screen resolution.

Implements #4257
This commit is contained in:
Moritz Kempe 2020-10-11 20:34:41 +02:00
parent 0045cb5574
commit 6fd35b5dee

View File

@ -90,6 +90,7 @@ void ChatbarTextEdit::contextMenuEvent(QContextMenuEvent *qcme) {
QMenu *menu = createStandardContextMenu();
QAction *action = new QAction(tr("Paste and &Send") + QLatin1Char('\t'), menu);
action->setShortcut(Qt::CTRL + Qt::Key_Shift + Qt::Key_V);
action->setEnabled(!QApplication::clipboard()->text().isEmpty());
connect(action, SIGNAL(triggered()), this, SLOT(pasteAndSend_triggered()));
if (menu->actions().count() > 6)
@ -250,6 +251,9 @@ bool ChatbarTextEdit::event(QEvent *evt) {
} else if (kev->key() == Qt::Key_Down && kev->modifiers() == Qt::ControlModifier) {
historyDown();
return true;
} else if (kev->key() == Qt::Key_V && (kev->modifiers() & Qt::ControlModifier) && (kev->modifiers() & Qt::ShiftModifier)) {
pasteAndSend_triggered();
return true;
}
}
return QTextEdit::event(evt);