how to read and write clipboard in plasma qml?

Sebastian Kügler sebas at kde.org
Tue Jul 23 12:53:00 UTC 2013


Hi,

On Friday, July 19, 2013 22:39:42 Bruce Ouyang wrote:
> i have googled and found no solution. it seems i have to utilize LauchApp to
> call a python script for accessing clipboard ps: xclip command is not my
> solution because it may be absent in some KDE distributions.

You can use a QML TextEdit as helper, this allows you to access the clipboard.

so if

TextEdit {
  visible: false
  text: myStuff
  onCompleted: { 
    text = "This is going to be copied"
    selectAll()
    copy()
  }
  [...]
}

Same mechanism with paste(), just the other way round.

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Plasma-devel mailing list