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
Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

@marcossit

 

Thanks man!

 

But I know how to copy.

I need paste from Clipboard.

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

Wait Help ~:smileyhappy:

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

No one knows how it's done?!

:No:

Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

Plz Help :Helpsmilie: :Balloon:

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Paste Text In Clipboard

I'd love to help you but I still don't quite understand what you are trying to achieve, sorry.

Which bit is not working for you, putting text in the clipboard or retrieving it?

Your example seems to show you copying a Labels text property to the clipboard, is that what you want to do?

Maybe a list of steps with what you want to do with the step that isn't working indicated may help us understand?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks!

 

Sorry if not explained well.

 

I made this app to test copy and paste text to another apps.

Copy the text worked, but the paste does not work.

The problem now is to paste the text from the clipboard.

Example:

When I copy email from BB hub then I go to my app and I click the paste I need paste the email in TextArea or label.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Paste Text In Clipboard

Okay, well I've just quickly written this and it works for me...

 

Clipboard.qml

import bb.cascades 1.2
import custom.lib 1.0

import "controls"

RecipePage {
    RecipeContainer {
        Button {
            text: "Paste clipboard contents"
            onClicked: {
                ta.text = clip.text;
            }
            
            attachedObjects: [
                Clipboard {
                    id: clip
                }
            ]
        }
        TextArea {
            id: ta
        }
    }
}

 

Where the Clipboard object is defined as such,

 

Clipboard.h

#ifndef CLIPBOARD_H_
#define CLIPBOARD_H_

#include <QObject>

class Clipboard: public QObject {

	Q_OBJECT
	Q_PROPERTY(QString text READ text)

public:
	Clipboard();
	virtual ~Clipboard();

	QString text();
};

#endif /* CLIPBOARD_H_ */

 Clipboard.cpp

#include "Clipboard.h"

#include <bb/system/Clipboard>

Clipboard::Clipboard() {
	// TODO Auto-generated constructor stub

}

Clipboard::~Clipboard() {
	// TODO Auto-generated destructor stub
}

QString Clipboard::text() {
	bb::system::Clipboard clipboard;
	QByteArray data = clipboard.value("text/plain");
	if (!data.isEmpty()) {
	    // process data from clipboard
		return QString::fromAscii(data, data.size());
	}

	return "";
}

 

Hope that helps.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks!

 

But does not work.

And when click the Button do not show any error.

 

Qml debugging is enabled. Only use this in a safe environment!
OrientationSupportPrivate::getSupportedDisplayOrientation:  auto 
OrientationSupportPrivate::initDirectionAndOrientation: 
CS Debugging enabled: false 

 

 

Why add "Clipboard" in attachedObjects?

Can you make a project?

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Paste Text In Clipboard

[ Edited ]

Here you go...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 45
Registered: ‎11-16-2013
My Device: Z10

Re: Paste Text In Clipboard

@BBSJdev

 

Thanks man. :Clap:

 

My problem was in applicationui.cpp