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. QWebEnginePage- copy images and text to clipboard?
Forum Updated to NodeBB v4.3 + New Features

QWebEnginePage- copy images and text to clipboard?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 2 Posters 1.2k 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.
  • D Offline
    D Offline
    donquibeats
    wrote on last edited by
    #1

    I've got a PyQt5 app which uses a QtWebEngineView to display a programmatically generated bit of HTML, which includes a large number of image thumbnails and accompanying text notes.

    The users want to be able to select a section of the output to the clipboard, so that that section can be pasted into a program like Word or Outlook.

    When the programmatically generated HTML is opened in a browser like Chrome, selecting the relevant part and then pasting it works as expected, and the images appear.

    However in the QtWebEngineView, triggering the copy action will copy the text, but not the images, which show as empty space. This is true when the user selects and presses Ctrl+C, and it's also the case when I call .triggerAction(QWebEnginePage.Copy) on the QWebEnginePage.

    Does QtWebEngineView supporting copyinig images to the clipboard the same way that Chrome does? If so, how would I access this ability?

    JonBJ 1 Reply Last reply
    0
    • D donquibeats

      I've got a PyQt5 app which uses a QtWebEngineView to display a programmatically generated bit of HTML, which includes a large number of image thumbnails and accompanying text notes.

      The users want to be able to select a section of the output to the clipboard, so that that section can be pasted into a program like Word or Outlook.

      When the programmatically generated HTML is opened in a browser like Chrome, selecting the relevant part and then pasting it works as expected, and the images appear.

      However in the QtWebEngineView, triggering the copy action will copy the text, but not the images, which show as empty space. This is true when the user selects and presses Ctrl+C, and it's also the case when I call .triggerAction(QWebEnginePage.Copy) on the QWebEnginePage.

      Does QtWebEngineView supporting copyinig images to the clipboard the same way that Chrome does? If so, how would I access this ability?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @donquibeats
      Does triggerAction(QWebEnginePage.CopyImageToClipboard) work?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        donquibeats
        wrote on last edited by
        #3

        @JonB Thanks for the response.
        .copyImageToClipboard doesn't work in this case. The user selection spans several HTML items including text and images, so when more than just a single image is selected, it doesn't give the desired result.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          donquibeats
          wrote on last edited by
          #4

          I should add that .triggerAction(QWebEnginePage.Copy) almost does what's wanted. It copies the area of the HTML that the user has selected, and this can be pasted. The only problem is that any images that are within that selection disappear when pasted into another program or document.

          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