Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
marcelnijman
Posts: 118
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C
Accepted Solution

clipboard

Will there be clipboard support? I would like to read/write to the cut and paste buffer. A user could then for instance select text in any app, then start my app, which would process that text, and put the result back on the clipboard. Or it could put an image on the clipboard that the user could then use in another app.

BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: clipboard

Hey there,

 

Unfortunately this is not yet currently supported;

 

Martin

 

Developer
dkonigs
Posts: 256
Registered: ‎07-25-2008
My Device: Bold 9900

Re: clipboard

For a more useful answer, I'll ammend that by saying that the Qt-friendly BB10 APIs do not currently provide Clipboard support, and I'm not sure if Qt's own clipboard APIs are working on BB10 yet.

 

However...  QNX itself does have a clipboard API, and it does actually work.  For a very brief example, here's how you take a QString and stick it in the clipboard:

 


#include <clipboard/clipboard.h>

 

void copyText(QString text) {

    if(empty_clipboard() == 0) {
        QByteArray data = text.toUtf8();
        set_clipboard_data("text/plain", data.size(), data);
    }
}


I suggest spending some time investigating clipboard.h for additional documentation on what you can use it for.

Trusted Contributor
marcelnijman
Posts: 118
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C

Re: clipboard

Thanks! That's what I was looking for. And do you happen to know which library I should link against?

Developer
dkonigs
Posts: 256
Registered: ‎07-25-2008
My Device: Bold 9900

Re: clipboard

Oh yeah, the one bit I forgot :-)

 

Its (quite obviously) named libclipboard.

 

So I added "LIBS += -lclipboard" to my project's .pro file.

Developer
soaman
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: clipboard

Thanks for sharing this! :smileyhappy:

--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Developer
helex
Posts: 293
Registered: ‎02-14-2012
My Device: Nokia N950 / BB Playbook

Re: clipboard

[ Edited ]

This solution is not very well working. My app is at example only able to read the clipboard data while it is in the foreground and there is no Signal emittet if there are changes.

 

Polling the clipboard to watch for changes is not a very good solution, too. :smileysad:

 

Are there any kind of information when QClipboard will get supported?