forked from qt-creator/qt-creator
Add a ShowContextMenu action
Allow users without physical MenuKey to open the context menu Change-Id: Id886a5614e26d614cba6ceb3b08a9df6148e9655 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Jesus Fernandez
parent
9a0eca15c5
commit
f3cd5cdb7e
@@ -1323,6 +1323,13 @@ void TextEditorWidget::selectWordUnderCursor()
|
||||
setTextCursor(tc);
|
||||
}
|
||||
|
||||
void TextEditorWidget::showContextMenu()
|
||||
{
|
||||
QTextCursor tc = textCursor();
|
||||
const QPoint cursorPos = mapToGlobal(cursorRect(tc).bottomRight() + QPoint(1,1));
|
||||
qGuiApp->postEvent(this, new QContextMenuEvent(QContextMenuEvent::Keyboard, cursorPos));
|
||||
}
|
||||
|
||||
void TextEditorWidget::copyLineUp()
|
||||
{
|
||||
d->copyLineUpDown(true);
|
||||
|
||||
Reference in New Issue
Block a user