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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Regular Contributor
marcelnijman
Posts: 74
Registered: ‎06-19-2012
My Carrier: none
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.

Please use plain text.
BlackBerry Development Advisor
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Carrier: N/A

Re: clipboard

Hey there,

 

Unfortunately this is not yet currently supported;

 

Martin

 

Please use plain text.
Developer
dkonigs
Posts: 205
Registered: ‎07-25-2008

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.

Please use plain text.
Regular Contributor
marcelnijman
Posts: 74
Registered: ‎06-19-2012
My Carrier: none

Re: clipboard

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

Please use plain text.
Developer
dkonigs
Posts: 205
Registered: ‎07-25-2008

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.

Please use plain text.
Developer
soaman
Posts: 610
Registered: ‎03-03-2011
My Carrier: Mobitel

Re: clipboard

Thanks for sharing this! :smileyhappy:

--------------------------------------------------------

Follow our developer blog on Slovenia BlackBerry Developer Group!
Please use plain text.
Developer
helex
Posts: 193
Registered: ‎02-14-2012
My Carrier: -

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?

Please use plain text.