QtWebEngine vs QtWebKit context menu
Please bear with me if I am a touch uncertain about classes/terminology/behaviour here.
I inherited an application (Qt 4) using
QWebView. It allowed "preview" of HTML document, which the user could edit in-place via
The first thing I did was to port this to Qt 5.7. I therefore changed over to using
QWebEngineView, allowing the user to edit in-place via
All this went fine, and seemed to give identical behaviour. However, it appears there is one facility missing which is required. I cannot go back to look at the old code behaviour, but I have been shown an old screenshot with a right-click content menu where the user could select some text and then choose a font for the selection via a Fonts sub-item with choices Bold, Italic, Underline. Presumably this then changed the HTML source over the selected text.
The menu seemed to have items like: Cut, Copy, Paste, Select All, Fonts>, Direction>. The menu now, however, has only items: Copy, Unselect. Doubtless in part because it no longer "internally" supports
Am I correct in my description of this difference between
I see no evidence in our code of any handling of the old or new context menus. Are these indeed inbuilt from the Qt side?
I think I see we have
QWebEngineView::contextMenuEventso I can extend the context menu. I guess I need to roll my own to add something like font selection?
Assuming I can get through #3, I am worried about how I would know where to put what into which. Presumably I want to do something like wrap the selected text inside, say,
</b>. But the user is in "HTML editable-preview mode". Any "selection point coordinates" I might get back are going to point into "what is on the screen", not the underlying text of the HTML which is behind it? Will I have access to the corresponding HTML at the right "position", and will I be able to insert an HTML element entity like
<b>or will something likely treat the insertion as literal text, e.g. actually inserting
<b>which of course I don't want?
I should really appreciate some guidance in this area, at least to indicate whether this is going to be possible. Thanks in advance.