Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void WebView::createContextMenu(QMenu *menu, const WebHitTestResult &hitTest)
- {
- // cppcheck-suppress variableScope
- int spellCheckActionCount = 0;
- if (!hitTest.linkUrl().isEmpty() && hitTest.linkUrl().scheme() != QL1S("javascript")) {
- createLinkContextMenu(menu, hitTest);
- }
- if (!hitTest.imageUrl().isEmpty()) {
- createImageContextMenu(menu, hitTest);
- }
- if (!hitTest.mediaUrl().isEmpty()) {
- createMediaContextMenu(menu, hitTest);
- }
- if (hitTest.isContentEditable()) {
- // This only checks if the menu is empty (only spellchecker actions added)
- if (menu->actions().count() == spellCheckActionCount) {
- menu->addAction(pageAction(QWebEnginePage::Undo));
- menu->addAction(pageAction(QWebEnginePage::Redo));
- menu->addSeparator();
- menu->addAction(pageAction(QWebEnginePage::Cut));
- menu->addAction(pageAction(QWebEnginePage::Copy));
- menu->addAction(pageAction(QWebEnginePage::Paste));
- }
- if (hitTest.tagName() == QL1S("input")) {
- QAction *act = menu->addAction(QString());
- act->setVisible(false);
- checkForForm(act, hitTest.pos());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment