Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to use copy and paste in QWebEngineView
Forum Update on Tuesday, May 27th 2025

How to use copy and paste in QWebEngineView

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 506 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hanson
    wrote on last edited by
    #1
    QAction* pasteAction =   ui->webEngineView->pageAction(QWebEnginePage::Paste);
    	pasteAction->setShortcut(QKeySequence("Ctrl+V"));
    	pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    	mUi->webEngineView->addAction(pasteAction);
    

    Is there somethings wrong?It does not work!

    “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.”
    —— Martin Golding

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Harborman
      wrote on last edited by Harborman
      #2

      I have the same problem, but in PyQt 5. Ended up using an alternative solution with an external "keyboard" library that mimics keyboard presses:

              if self.page().contextMenuData().isContentEditable() == True:  #check if an input field was right-clicked
                  self.menus = QMenu()
                  action1 = QAction("Paste text", self)
                  self.menus.addAction(action1)
                  self.menus.popup(event.globalPos())
                  action1.triggered.connect(self.paste_into_field)
      
      
         def paste_into_field(self):
              keyboard.press_and_release("ctrl+v")
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved