Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How handle the pasted file from clipboard
Forum Updated to NodeBB v4.3 + New Features

How handle the pasted file from clipboard

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 526 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.
  • N Offline
    N Offline
    nannanko
    wrote on last edited by nannanko
    #1

    Hello, I am writing a instant message application with QML/Qt.
    I have a TextField as send message box. I want when the user pastes a file into the TextField, my application uploads it.
    I know maybe I could use onTextChanged, but I'm not satisfied since the user doesn't spend most of their time copying the uploaded file. But I didn't find any signal about pasting. I tried custom shortcut key override "Ctrl+v" but it doesn't work.
    Can anyone provide me with some advice? Thank you very much!

    1 Reply Last reply
    0
    • DiackneD Offline
      DiackneD Offline
      Diackne
      wrote on last edited by
      #2

      Hi,
      please, can you explain better your problem... if I understood you can do some like this :

         Rectangle {
              color: "blue"
              width: 100
              height: 100
              DropArea {
                     anchors.fill: parent
                     onDropped: {
                         console.log("Something was Dropped");
                         console.log(clipboard.getText())
                     }
                 }
          }
      

      the clipboard you need to pass from C++ to qml you have examples here :
      https://stackoverflow.com/questions/40092352/passing-qclipboard-to-qml

      check this documentation QClipboard https://doc.qt.io/qt-6/qclipboard.html for more information about mechanism to copy and paste data between applications

      https://doc.qt.io/qt-6/qguiapplication.html#clipboard

      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