diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-01-04 23:49:17 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-02-15 14:25:01 +0000 |
commit | 85ecc44eee3eb8112faf9989570664ed9302073f (patch) | |
tree | cce4cd7a5c03f8f3c784d4a4ddc40a45e85ff863 /src/widgets/widgets/qplaintextedit.cpp | |
parent | 25e19acca692489cd5212920861b157278833eff (diff) |
Add missing QPlainTextEdit::createStandardContextMenu(QPoint)
[ChangeLog][QtWidgets] Added QPlainTextEdit::createStandardContextMenu(QPoint)
overload that takes the position in document coordinates. This method enables
the actions that are sensitive to the given position eg. where the user clicked.
Change-Id: I47ed7a1afc4fcfb3318c9b7af37867aeb7f2aa35
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/widgets/qplaintextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 21 |
1 files changed, 20 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 /*! |