From 484be9a4d6b24697a6355bf6a3f1cde52baedd32 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@qt.io> Date: Fri, 30 Sep 2016 12:14:43 +0200 Subject: [PATCH] MarkDownEditor: Hide context menu Most actions do not make sense. A custom context menu might be good for text actions, but would require reimplementing QWebEngineView. Change-Id: Idf94939c16469e1dcee96d9ecfd0eb5309589fdd Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> --- .../markdowneditor/doc/src/markdowneditor.qdoc | 9 +++++++-- examples/webenginewidgets/markdowneditor/mainwindow.cpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/webenginewidgets/markdowneditor/doc/src/markdowneditor.qdoc b/examples/webenginewidgets/markdowneditor/doc/src/markdowneditor.qdoc index 3a9908ea6..0239c1065 100644 --- a/examples/webenginewidgets/markdowneditor/doc/src/markdowneditor.qdoc +++ b/examples/webenginewidgets/markdowneditor/doc/src/markdowneditor.qdoc @@ -113,11 +113,16 @@ \quotefromfile webenginewidgets/markdowneditor/mainwindow.cpp \skipto MainWindow::MainWindow - \printto connect + \printto PreviewPage The constructor first calls \c setupUi to construct the widgets and menu actions according to the UI file. The text editor font is set to one - with a fixed character width. It then makes sure our custom + with a fixed character width, and the QWebEngineView widget is told not + to show a context menu. + + \printto connect + + Here the constructor makes sure our custom \c PreviewPage is used by the QWebEngineView instance in \c{ui->preview}. \printto ui->preview diff --git a/examples/webenginewidgets/markdowneditor/mainwindow.cpp b/examples/webenginewidgets/markdowneditor/mainwindow.cpp index 417858d8d..9981d177d 100644 --- a/examples/webenginewidgets/markdowneditor/mainwindow.cpp +++ b/examples/webenginewidgets/markdowneditor/mainwindow.cpp @@ -65,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); ui->editor->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + ui->preview->setContextMenuPolicy(Qt::NoContextMenu); PreviewPage *page = new PreviewPage(this); ui->preview->setPage(page); -- GitLab