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
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

ZoomLevel in Camera App

how to use setZoomLevel in camera App?

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

Re: ZoomLevel in Camera App

You cannot programatically set the zoom level in the built in camera app or card.

 

If you are trying to set the zoom level for a camera control in Cascades, use cameraSettings.setZoomLevel.

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: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: ZoomLevel in Camera App

[ Edited ]

in order to use cameraSettings.setZoomLevel does it need to be configured in c++ somehow?

 

Camera {
attachedObjects: [ CameraSettings { id: settings } ]
}

 i tried accessing settings.setZoomLevel as you suggested but the only avaliable option is

settings.zoomlevelChanged(uint level)

 that ouptus the amount the zoom was changed

 

 

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: ZoomLevel in Camera App

it most certainly does...

assuming everythings setup for the camera, camerasettings & a context property

 

.cpp

void ApplicationUI::setZoomLevel(bb::cascades::multimedia::Camera *camera, int level)
{
	CameraSettings camsettings;
	camera->getSettings(&camsettings);
	camsettings.setZoomLevel(level);
	camera->applySettings(&camsettings);
}

 .hpp

Q_INVOKABLE void setZoomLevel(bb::cascades::multimedia::Camera *camera, int level);

 .qml

    Camera {
        id: camera
        objectName: "camera"
        property int zoomLevel
        onZoomLevelChanged: {
            cpp.setZoomLevel(camera, zoomLevel)
        }
    }

 

Highlighted
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: ZoomLevel in Camera App

Actually, you can use it in QML:

 

                    getSettings(cameraSettings);
                    cameraSettings.zoomLevel = slider.value;
                    applySettings(cameraSettings);

 I'm not sure why it doesn't appear in the QML autocomplete though. If you look at the header file you can see the Q_PROPERTY being set up.

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