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


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.


Reply
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Trying to bring the edited pic back into container

I have managed to take the image in a particular container that was picked via filepicker and bring it into the photoeditor...however...I have tried everything to bring the finished edited pic back into the container...I feel like I am close...but it just doesn't work.

 

This is what I have done...

 

 

void Halfy::getPhotoEditor(const QString fileName)
        {

            bb::system::InvokeManager manager;
            bb::system::InvokeRequest request;
            InvokeManager* invokeManager;

            // Setup what to show and in what target.
           request.setUri(QUrl::fromLocalFile(fileName));
           request.setTarget("sys.pictureeditor.cardeditor");
           request.setAction("bb.action.EDIT");
           InvokeTargetReply *targetReply = manager.invoke(request);

            invokeManager = new bb::system::InvokeManager();
                        invokeManager->setParent(this);
                        connect(invokeManager,
                        SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this,
                        SLOT(childCardDone(const bb::system::CardDoneMessage&)));

            //Setting the parent to "this" will make the manager live on after this function is destroyed
            manager.setParent(this);

           if (targetReply == NULL) {
           qDebug() << "InvokeTargetReply is NULL: targetReply = " << targetReply;
            } else {
               targetReply->setParent(this);
           }

        }
    void Halfy::childCardDone(const bb::system::CardDoneMessage &message)
    {
         message.data();
    }

 

This is how I get it in QML file.

 

ActionItem {
                            title: "Editor"
                            imageSource: "asset:///menuicons/Edit.png"
                            onTriggered: {
                                _app.getPhotoEditor(picker.selectedFile)
                            }
                        }

 

 

 

Thank you so much...

Dpcanada

Simplify your Life...
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Trying to bring the edited pic back into container

You are close. All that is left should be to set the imageView URL to the file path that is returned to you in message.data(). Have you tried that?

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Re: Trying to bring the edited pic back into container

Thank you so much for your reply...I am not sure how to set the imageView URL to the path...does it go inbetween the brackets of the message.data() statement?  I have tried to put the imgView in there but it returns an error. The file picker I am using is below.

 

something like this?

message.data(imgView.imageSource)

but no luck...

 

 

The other issue I am having is now I am getting a bug notice in the bolded text below....it is saying that it is not been tagged as a Qt slot and that to make sure that all paramenters all fully qualified....I am not sure what went wrong.

 

 

invokeManager = new bb::system::InvokeManager();
                            invokeManager->setParent(this);
                            connect(invokeManager,
                            SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this,
                            SLOT(childCardDone(const bb::system::CardDoneMessage&)));

 

 

This is the filepicker layout and I have bolded the imgView.imagesource statement.

FilePicker {
                id: picker
                title: qsTr("Select a Picture")
                property string selectedFile
                mode: FilePickerMode.Picker
                type: FileType.Picture
                directories: [ "/accounts/1000/shared/camera" ]
                viewMode: FilePickerViewMode.GridView
                sortBy: FilePickerSortFlag.Date
                sortOrder: FilePickerSortOrder.Descending
                //imageCropEnabled: true
                onFileSelected: {
                    selectedFile = selectedFiles[0]
                    imgView.imageSource = "file://" + selectedFile
                    imgView.visible = true
                    imgView.scaleX = 1
                    imgView.scaleY = 1
                    imgView.rotationZ = 0

                }

            }

 


I really appreciate your guidance...again close but so far...trying to read everything on this matter.

 

Dpcanada

Simplify your Life...
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Re: Trying to bring the edited pic back into container

Figured out the bug issue...now on the the original problem...linking the path....

 

I am not sure how to set the imageView URL to the path as you said to do...does it go inbetween the brackets of the message.data() statement?  I have tried to put the imgView in there but it returns an error. The file picker I am using is below.

 

something like this?

message.data(imgView.imageSource)

but no luck...

 

thx so much again.

 

Dpcanada

Simplify your Life...
Highlighted
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Re: Trying to bring the edited pic back into container

I was able to read the signals coming from the cardDoneMessage...

 

 

void Halfy::childCardDone(const bb::system::CardDoneMessage &message)
        {
            //Qstring filePath

            if (message.reason() == "done")

                qDebug() << message.reason() << "\n";
                qDebug() << message.dataType() << "\n";
                qDebug() << message.data() << "\n";

            //filePath = selectedFile;
            //filePath=
                message.data();
        }

 

This is what it said in the console box...

 

FilePickerPrivate:Smiley SurprisednCardInvokeRequestFinished()  . error= 0
Received childCardDone message:  "save"
Received a message from the card: "[{"uri":"file:///accounts/1000/shared/camera/IMG_00002640_hdr.jpg"}]"
messageFromChildCard():  "/accounts/1000/shared/camera/IMG_00002640_hdr.jpg"
"image/jpg"
"/tmp/IMG_00002640_hdr_edit4.jpg"

 

So it is all working...I just can't get it to write ontop of the existing pic...it is going to the tmp folder instead...trying to connect it back  to the imgView container.

 

Thx

Dpcanada

 

Getting closer.

Simplify your Life...
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Trying to bring the edited pic back into container

message.data() just returns the data, it doesn't modify the data you put in. What you would want to do is communicate that data back to QML, so you can assign it to the imageView. There are a number of ways to do that, depending on the structure of your program.

 

You probably want to take a look at this for starters: https://developer.blackberry.com/native/documentation/cascades/dev/integrating_cpp_qml/

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker