how to add 2 images to one TTTableImageItem - three20

I want to add 2 images to one TTTableImageItem? but now I can just add one image and one Text like this: [TTTableImageItem itemWithText:#"" imageURL:#"bundle://sunny.png"]
thanks

You will need to subclass TTTableViewItemCell or TTTableImageItemCell and TTTableImageItem to achieve that. Look at TTTableImageItemCell how the image view is created and layouted.
Your TTTableImageItem subclass will just be a data structure class transporting the image urls, the cell subclass is the actual cell to use in the tableView.

Related

2 Image in root of tree in nattable

I have inserted one image in the tree body in one of my columns with
new TreeImagePainter(true, GUIHelper.getImage("right"), GUIHelper.getImage("right_down"), image);
in class TreeConfiguration, but I need to add one more image beside root rows.
Moreover I need to dynamicly obtain this image from some other class, where data is already read . As it turns out i can't because either this class is null or it is called later than it should. Could you guild me how to do that.
Kind Regards
The painting of the tree structure with node icons etc. is done by the IndentedTreeImagePainter. The TreeImagePainter is used as a decorator to the base painter for the content (typically text). If you need an additional icon you need to wrap the IndentedTreeImagePainter with another CellPainterDecorator.
Or in case the additional icon should be on the right of the tree icon, maybe the base painter can already be a CellPainterDecorator that combines both, an ImagePainter and a TextPainter.
If you only want to show that icon on root nodes, you will need some more customization, probably with a custom painter.
Sorry, I don't really understand your requirement.

How to extract images from Images in Form?

I have an old VB6 project which has a form containing a number of Image objects. That was the way the author had stored images to use on buttons etc. on other forms.
How can I extract the images from these objects to something like a JPG or BMP?
I was hoping for something to put into the Immediate window. I don't mind doing it one by one.
SavePicture MyImage.Picture, "mypic.bmp"

Qt - using Widgets and QLabel to display multiple images

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 to imagelist

I m working in delphi-2010
i have an imagelist,in which i have added some .png images.
and i have also picture for showing the picture from imagelist.
i want to show the picture on picture box from imagelist.
i wrote the following code,but here addImage(,) takes 2 argument
one is Values:TCustomImagelist
and another is Index of Image
how i identify the value of customimagelist.
image1.Picture:=imagelist1.AddImage( , );
TImageList.AddImage adds a single image from one TImageList to another. I don't think this is what you intended.
If you want to show one of the images from a TImageList in a TImage, you could use something like this:
imageList1.GetBitmap(0, image1.Picture.Bitmap);

RubyCocoa: Thumbnail Images in NSTableView

I'm trying to display an NSTableView of:
| thumbnail | filename |
I created the NSTableView in IB and delegated it to a class. In the class, I bypassed a model just to get a POC implementation and created the data source delegate methods. They populate the text cells just fine. However, now I'm at the step where the first cell needs to contain a small thumbnail of the image.
What I want to do (and I'm sure it's stupid-simple) is grab the image icon -- and it's fair to assume that all files are jpegs and have thumbnails embedded -- and put that icon, scaled to 64x64 into the table cell. There's lots of code on how to generate thumbnails but I don't see much that gets me to working code. Here's what I have:
# This works if I am only populating text values in the when 'Image'
def tableView_objectValueForTableColumn_row_(image_table, column, row)
thumbnailImage(75)
case column.headerCell.stringValue
when 'File Name'
(0..99).to_a[row].to_s
when 'Image'
# here's where I want to return a square 64x64 image or ImageCell
thumbnailImage(64)
else
'???'
end
end
# Creates square thumbnail
def thumbnailImage(size)
file = "file://localhost/Users/sxross/Downloads/iStock_000004561564XSmall.jpg"
image = CGImageSourceCreateWithURL(CFURLCreateWithString(nil, file, nil), nil)
thumb = CGImageSourceCreateThumbnailAtIndex(image, 0, nil)
thumb
end
def numberOfRowsInTableView(view)
100
end
What I'm grappling with is what the missing steps are to get the thumbnailImage method to provide me with something that can be an appropriate data object to return from the data source.
Any help is amazingly appreciated.
BTW: IknowIknowIknow, I should be using MacRuby but it doesn't run on my 32-bit Core Duo. Sadly.
I bypassed a model …
Don't do that. In Cocoa, it's easier to do things with a model than without.
What I'm grappling with is what the missing steps are to get the thumbnailImage method to provide me with something that can be an appropriate data object to return from the data source.
CGImageSourceCreateThumbnailAtIndex returns a CGImage. You need tableView_objectValueForTableColumn_row_ to return an NSImage. Therefore, use NSImage's initWithCGImage_size_ method.
If you're running Leopard, that method isn't available, so you'll need to create an NSBitmapImageRep with the CGImage instead, and then create an NSImage of the correct size and add that representation to it.

Resources