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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10
My Carrier: Free mobile
Accepted Solution

can't connect fileSelected event from FilePicker



I succeded to have filepicker work with simple cascade UI, but i need now to instanciate it from C instead of qml.


I wrote the following code from the Filepicker sample in the documentation



pickers::FilePicker* filePicker = NULL;


void FSLSoundwork::canceled(){

// we are supposed to get here when cancel is pressed




void FSLSoundwork::FSLFileSelected(const QStringList& selectedFiles){
// we are supposed to get here when a file is selected



FSLSoundwork::FSLSoundwork(bb::cascades::Application *app)
: QObject(app)





filePicker = new pickers::FilePicker(pickers::FileType:Smiley Surprisedther);
QStringList filters;
filters << "*.lib" << "*.snd";
filePicker->setTitle("Select File");
filePicker->setMode(pickers::FilePickerMode:Smiley Tongueicker);


QObject::connect(filePicker, SIGNAL(filesSelected(const QStringList &selectedFiles)), this, SLOT(FSLFileSelected(const QStringList &selectedFiles)));
QObject::connect(filePicker, SIGNAL(canceled()), this, SLOT(canceled()));





the open function is working fine, but I can't get any event from the Picker.


Any idea what is wrong with my code?





Posts: 16
Registered: ‎09-17-2012
My Device: Developer

Re: can't connect fileSelected event from FilePicker

The name of the signal is fileSelected, not filesSelected.


Not sure if this has any effect, but you don't need to give the parameter a name when you use it in SIGNAL or SLOT; you just need the variable type.

Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10
My Carrier: Free mobile

Re: can't connect fileSelected event from FilePicker

Thanks a lot for your help.


Hi BB people that maintain documentation. There's a mistake in the sample at https://developer.blackberry.com/cascades/reference/bb__cascades__pickers__filepicker.html


It's written :


The following example creates a FilePicker in Picker mode with a file type of Pictures.

 FilePicker* filePicker = new FilePicker(FileType:Smiley Tongueicture);
    filePicker->setTitle("Select Picture");
    filePicker->setMode(FilePickerMode:Smiley Tongueicker);
Connect the signal fileSelected() with the slot.
    QObject::connect(filePicker, SIGNAL(filesSelected(const QStringList&)), this, SLOT(onFilesSelected(const QStringList&)));
    QObject::connect(filePicker, SIGNAL(canceled()), this, SLOT(onCanceled()));


Obviously the signal for fileselected must be:

QObject::connect(filePicker, SIGNAL(fileSelected(const QStringList&)), this, SLOT(onFilesSelected(const QStringList&)));