05-10-2012 02:26 AM
I am using Imageview to display the images which are in assets,i want to resize them,i tried using resize image using scaling method in c++.I am not able to do it,How do it?
Is there any way apart from scaling method?
Solved! Go to Solution.
05-10-2012 02:59 AM
a) You can use generic method, VisualNode::setScale(), and scale whole control, but this is probably not recommended
b) You can use ImageView::setScalingMethod() and set preferredWidth and preferredHeight - your image will be scaled using selected method to preferred sizes.
If you want for ex. to double size of the image, you can use ImageTracker to load image, read it's width and height, and then set loaded image to your image view with calculated preferred sizes.
hope it helps
05-10-2012 03:04 AM - edited 05-10-2012 03:05 AM
How do i scale using Image Scaling
ImageView *imageView = new ImageView(); Image imageAsset = Image(QUrl("asset:///images/background.png")); imageView->setImage(imageAsset);
When i use imageView->setScalingMethod(),
How do i set the property?
i dont know how to se the scalingMethod,There is no sample reference for this in API to set the scaling property,can you help me on this
05-10-2012 03:09 AM
Quick and dirty example:
ImageView * iv = new ImageView(); iv->setImageSource(QUrl("asset:///fooo.png")); iv->setScalingMethod(ScalingMethod::AspectFill); iv->setPreferredSize(768, 1024);
In practice you'll want to load image using ImageTracker, wait for signal that it's loaded, and then set Image on imageview. From ImageTracker you can also read dimensions of Image.