Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_widgets_qtextedit.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5void MyTextEdit::contextMenuEvent(QContextMenuEvent *event)
6{
7 QMenu *menu = createStandardContextMenu();
8 menu->addAction(tr("My Menu Item"));
9 //...
10 menu->exec(event->globalPos());
11 delete menu;
12}
14
15
17edit->textCursor().insertText(text);
19
20
22edit->textCursor().insertHtml(fragment);
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:594
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition qmenu.h:26
QAction * exec()
Executes this menu synchronously.
Definition qmenu.cpp:2613
void addAction(QAction *action)
Appends the action action to this widget's list of actions.
Definition qwidget.cpp:3117
QString text
struct _cl_event * event
#define tr(X)
QMenu menu
[5]