Qt - using Widgets and QLabel to display multiple images - image

So currently I am able to display images via URL's using QLabel, QNetworkManager and QPixmap. And then to display the image I use something like label->show(). Essentially I follow the same steps as in the pseudocode in this link:
http://developer.qt.nokia.com/forums/viewthread/7010
Now I am still somewhat new to Qt and am having difficulty extending this. What I want to do is be able to display multiple images from different URL's into essentially the same container. So basically I want to see two images in the same container/window. These images are specified by their width, height, x position and y position in the main window/container. I know that I should use widgets but I am not sure what exactly should I use? QFrame? QHBLayout? QScrollArea? etc. Any help would be appreciated.

You can use many QLabels inside a Layout to get the effect you want. The way you want to lay it out is up to you, and there's more than one layout manager. There's things like the grid layout, the box layout, etc. Have a look here for layouts. You can look at it in this simplified way:
One window has a layout and a layout has many items in it.
http://doc.qt.nokia.com/latest/layout.html
In reality widgets can contain many other widgets. To position them properly, you use the layout.

Related

How to lazy load images in a scroll view

I want to show a scroll view that has fairly large number of thumbnails. eg: https://cdn.vox-cdn.com/thumbor/sddJ5KHoGDbZfx8jcNey4iahmu0=/0x0:1395x1171/1200x800/filters:focal(587x475:809x697)/cdn.vox-cdn.com/uploads/chorus_image/image/57064313/Screen_Shot_2015-09-07_at_9.11.34_AM.0.0.png
I want to load the view as fast as possible without delaying it until all images are loaded. This essentially means I need to lazy load image content. While each image is downloaded, a placeholder image (fetched locally) should be shown. I certainly know how to do this from scratch, but wanted to know if there are standard solutions available. Can I setup Xamarin.Forms.Image class to get this behavior?
Is there any particular reason for which you want to use a ScrollView specifically ?
From what you're describing, it looks like you should actually be working with a ListView instead (which will improve performance by a LOT if you have a large list of images).
Then, like #SushiHangover said, there is FFImageLoading that can help you work with these images, or you can create you own Image class, to implement a custom solution on both android and iOS.
Glide is a faily easy to use solution for Android, and SDWebImage is also a good solution for iOS.

How to add container or panel in flash and resize them using actionscript 3.0

I want to show some image in a flash. When I click an image, the image is up as like as image shown below.
when i click the image:
but the problem is when i click the image in that group, there is a gap between images. I want to attach them. I can not solve the problem. please anybody help me to solve the problem.
If you're using Flex, this is fairly trivial. You set the cards in an HGroup (calculating the gap will be difficult, but not impossible) and simply remove selected cards from that group and place them in another. After the card is removed, your other cards will be realigned by the layout automatically.
If you're not using Flex, I suggest extracting the code you used to layout the cards in the first place into a separate function. When a card is selected, you move the card out of the DisplayObjectContainer it is currently in and place it in another and then simply call the layout function again. This is the same method as I would use with Flex, although a little less automated due to the lack of Flex's layout engine.

Lightbox for Flex

Ey. I've seen the other post about Lightbox gallery effect for Flex, but after having played around with it I cant seem to get it to work 100% (The image is as small as the thumb, and I cant make it bigger). And this also lacks some functionality I'd like to have.
So, one example would be, of course, this: http://lokeshdhakar.com/projects/lightbox2/
If you click any image on the image set you can swap between them with an arrow. This is what I'd like to have.
Also, it would be nice if it was possible to display the thumbnails for the other images in the same set under the bigger picture(when one image is already clicked).
I've tried to search for components like this, but I cant seem to find any other.
If any of you know of any nice components or snippets of code for this kind of effect then please let me know! =)
Kind regards,
Stian Berg Larsen
  
EDIT:
So I've searched around and tried a number of examples, but I cant seem to get any of them to work. There is always an error, and none of the examples are exactly what I want.
I simply need a way to show images like Lightbox. With a prev/next arrow and maybe a close button. Nothing more than that. How would I go about making this, or use an existing component?
Im using a TileGroup to hold all my thumbs (so that they will fill out the width of the Group with more images if there are room for it). If it's possible to generate this list of thumbnails dynamically too then that would be great, but basically what I need is to show images with a Lightbox style when I click them.
Thanks! =)
I ended up just making my own lightbox effect. :)
Created an Actionscript class (based on Group) and added image loading functionality, prev/next/close buttons and borders and such. Works like a charm :)

Sophisticated HTML5 Image Map?

I have an image of a living room, which I'm turning into a menu for a new site I'm working on. The idea is that you can click on certain items in the room, like a chair, desk, couch, etc and get taken to the desired page. I'm wondering if there is a clever way of doing this. Since the items are not simple shapes, I don't want to use a standard image map.
Thanks for you help!
I'm answering because a Google search brought me here...
Because you asked for a tool:
GIMP Has a really good Image map creation function.
Open your image in GIMP and select Filters > Web > ImageMap
From there you can create image maps by drawing on the image. Saving will generate HTML you can then tailor to your needs.
This tool looks to be a solid image mapper: http://www.image-maps.com/
I'd suggest doing this with a canvas and SVG's, it would make this quite a bit easier, and more professional.
As Korvin mentioned, doing this in SVG is probably the easiest option, because you can attach events to objects in SVG rather than having to manually specify a particular area in which to listen for events.
If you go this route, I recommend using the RaphaelJS library which has a nice syntax and the advantage of working in IE pre version 9. Here's a demo which, although it uses onmouseover instead of onclick, it might be close to what you're trying to achieve:
http://raphaeljs.com/australia.html

Stitching multiple images into one SL / WP7

I am trying to download a number of images, of differnet sizes, then after some cropping stitch them into one single image.
I am intending to do this in code on a WP7 device
My current approach uses n Image controls and waits for their ImageOpened events to fire. Once they have all been successfully opened I create a new Image for each and stick them into a StackPanel.
In then use WriteableBitmap to create a single image from the stacked images.
This code works 40/50% of the time. The rest of the time the layout engine decides to not bother laying them out in a horizontal stack. All the images get rendered on top of each other.
Is there a way of forcing the StackPanel to do a full layout pass? I have tried combinations of Arrange and Measure on both the Images and the StackPanel.
I found the article WP7: Generate Live Tile Images Locally (Without The Visual Tree). I am now using Henry Chong’s approach (which includes UpdateLayout) and my photo stitching is working great.
I cannot help but be amused by the fact that the answer to my question “how the hell do I force the layout to be updated” was answered with a method called “UpdateLayout” [dev exits stage left kicking himself]

Resources