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. Paste in WebEngineView

Paste in WebEngineView

Scheduled Pinned Locked Moved Unsolved QtWebEngine
9 Posts 3 Posters 2.6k 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.
  • V Offline
    V Offline
    VRHans
    wrote on last edited by
    #1

    Is paste failing in webengineview a known issue?

    It works in the webengineview nanobrowser example - but there's some sort of 'action' mapping in that sample (that I do not know if it is necessary or not.)

    Is this something I need to manually add to my qml code in order for paste/copy to work?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @VRHans This barebones example works. Nothing extra is added.

      QtWebEngine::initialize();
      
      QQmlApplicationEngine engine;
      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
      
      

      main.qml

      WebEngineView {
          anchors.fill: parent
      }
      

      Which Qt version/OS are you using ?

      157

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VRHans
        wrote on last edited by
        #3

        5.7

        It doesn't work on OSX until I do what the nanobrowser sample does - which is hand connect the keyboard shortcuts to the web actions on the view.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @VRHans Ok. Which keyboard shortcut did you use for copy/paste ?

          157

          V 1 Reply Last reply
          0
          • p3c0P p3c0

            @VRHans Ok. Which keyboard shortcut did you use for copy/paste ?

            V Offline
            V Offline
            VRHans
            wrote on last edited by
            #5

            @p3c0

            I just used a subsection from the sample's BrowserWindow.qml:

                Action {
                    shortcut: StandardKey.Copy
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.Copy)
                }
                Action {
                    shortcut: StandardKey.Cut
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.Cut)
                }
                Action {
                    shortcut: StandardKey.Paste
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.Paste)
                }
                Action {
                    shortcut: "Shift+"+StandardKey.Paste
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle)
                }
                Action {
                    shortcut: StandardKey.SelectAll
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.SelectAll)
                }
                Action {
                    shortcut: StandardKey.Undo
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.Undo)
                }
                Action {
                    shortcut: StandardKey.Redo
                    onTriggered: currentWebView.triggerWebAction(WebEngineView.Redo)
                }
            
            1 Reply Last reply
            0
            • p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #6

              @VRHans Can you try setting javascriptCanAccessClipboard ?

              157

              V 1 Reply Last reply
              0
              • p3c0P p3c0

                @VRHans Can you try setting javascriptCanAccessClipboard ?

                V Offline
                V Offline
                VRHans
                wrote on last edited by
                #7

                @p3c0 As a replacement for the code above (which works)?

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #8

                  No. In the code that I posted.

                  157

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kanekotic
                    wrote on last edited by
                    #9

                    @p3c0 as a fallow up I tried the property you are talking about and it made my app crash (just the addition of that line). I don't know if this is a bug but it happened on qt 5.7.1.

                    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