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

New Developer
Posts: 2
Registered: ‎04-21-2013
My Device: Z10
My Carrier: Vodafone CZ

contactPicker - QML - ContactSelectionMode.Attribute



is there any QML example how to use " ContactSelectionMode.Attribute" mode? I have used this code:


attachedObjects: [
                ContactPicker {
                    id: contactPicker
                    mode: ContactSelectionMode.Attribute
                    title: qsTr("Chose contact please:")
                    onContactAttributeSelected: {
                        callingNumber.text = attribute.value    ;


but without sucess (picker dialog open, but i can't select any item).


Thanks a lot.

New Contributor
Posts: 3
Registered: ‎04-28-2013
My Device: Z10
My Carrier: Rogers

Re: contactPicker - QML - ContactSelectionMode.Attribute



I could at least solve part of the puzzle. I think the mode needs to be put in quotes, mode: "Multiple". This works for multiple. I tried for attributes, but the picker didnt go to contact details so that attributes could be selected.


New Developer
Posts: 2
Registered: ‎04-21-2013
My Device: Z10
My Carrier: Vodafone CZ

Re: contactPicker - QML - ContactSelectionMode.Attribute

[ Edited ]

Hi, yes, you are right, "multiple" works. But i had no success with that Attribute. Finaly i had to create function in C++ and call the function from QML:


C++ function:


void myUtils::getNumberFromPicker() {
		ContactPicker* contactPicker = new ContactPicker();
	    contactPicker->setKindFilters(QSet<bb::pim::contacts::AttributeKind::Type>() << bb::pim::contacts::AttributeKind::Phone);
	    bool success=QObject::connect(contactPicker, SIGNAL(contactAttributeSelected(bb::cascades::pickers::SelectedContactAttribute)), this, SLOT(onContactAttributeSelected(bb::cascades::pickers::SelectedContactAttribute)));
//	    qDebug() << "Hello1";
//	    return 1;

 And than signal "processing":


void myUtils::onContactAttributeSelected(SelectedContactAttribute newCheckedState) {
    //calledNumber = "11123456789";
     calledNumber = newCheckedState.value();
//     emit calledNumberUpdated(calledNumber);
    //     qDebug() << pokus;






BR, T.

New Developer
Posts: 51
Registered: ‎04-15-2013
My Device: Z10
My Carrier: T-Mobile

Re: contactPicker - QML - ContactSelectionMode.Attribute

Two years later, ContactSelectionMode.Attribute still doesn't work in QML on 10.3.1.  The picker shows up but nothing can be selected (contact can be highlighted but details are not shown, and there is no Confirm button, just Cancel). Only Single or Multiple mode works correctly.  Even setting the Attribute mode from C++ doesn't help.


Let's see if at least handling the WHOLE picker in C++ can make it possible to use the Attribute mode....