diff options
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 21 | ||||
-rw-r--r-- | src/widgets/widgets/qplaintextedit.h | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 010c837ea0..93c9ddc285 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2331,9 +2331,12 @@ void QPlainTextEdit::zoomInF(float range) #ifndef QT_NO_CONTEXTMENU /*! This function creates the standard context menu which is shown - when the user clicks on the line edit with the right mouse + when the user clicks on the text edit with the right mouse button. It is called from the default contextMenuEvent() handler. The popup menu's ownership is transferred to the caller. + + We recommend that you use the createStandardContextMenu(QPoint) version instead + which will enable the actions that are sensitive to where the user clicked. */ QMenu *QPlainTextEdit::createStandardContextMenu() @@ -2341,6 +2344,22 @@ QMenu *QPlainTextEdit::createStandardContextMenu() Q_D(QPlainTextEdit); return d->control->createStandardContextMenu(QPointF(), this); } + +/*! + \since 5.5 + This function creates the standard context menu which is shown + when the user clicks on the text edit with the right mouse + button. It is called from the default contextMenuEvent() handler + and it takes the \a position in document coordinates where the mouse click was. + This can enable actions that are sensitive to the position where the user clicked. + The popup menu's ownership is transferred to the caller. +*/ + +QMenu *QPlainTextEdit::createStandardContextMenu(const QPoint &position) +{ + Q_D(QPlainTextEdit); + return d->control->createStandardContextMenu(position, this); +} #endif // QT_NO_CONTEXTMENU /*! diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 2e9b619558..69bd2ab647 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -149,6 +149,7 @@ public: virtual QVariant loadResource(int type, const QUrl &name); #ifndef QT_NO_CONTEXTMENU QMenu *createStandardContextMenu(); + QMenu *createStandardContextMenu(const QPoint &position); #endif QTextCursor cursorForPosition(const QPoint &pos) const; |