Re: IKImageBrowseView and QuickLook panel
Re: IKImageBrowseView and QuickLook panel
- Subject: Re: IKImageBrowseView and QuickLook panel
- From: Graham Cox <email@hidden>
- Date: Fri, 31 Aug 2012 14:15:14 +1000
Hi all,
According to the documentation for IKImageBrowserView:
> setCanControlQuickLookPanel:
> Specifies whether the view can automatically take control of the QuickLook panel.
>
> - (void)setCanControlQuickLookPanel:(BOOL)flag
> Parameters
> flag
> YES, if the view can display the QuickLook panel, otherwise NO.
> Discussion
> When the browser view displays the QuickLook panel it sets itself as the QuickLook datasource. If the browser cells returned by the datasource return items that are URLs or paths, then the QuickLook panel will display the image at that location. Otherwise, the browser cell must implement theQLPreviewItem protocol and return the requested URL for the custom cell.
My browser cells do return image URLs most of the time, and the QuickLook panel shows the image. I call -setCanControlQuickLookPanel with YES to enable this.
However, if the file that the cell refers to is an SVG file, I asynchronously parse the SVG to generate a thumbnail and return it to the browser as an NSImage instead. That works - my browser item returns the correct imageRepresentationType according to what sort of file it's dealing with.
However, SVG images are not displaying in the QL panel.
According to the documentation quoted, if my cells do NOT return a URL, I need to implement the QLPreviewItem protocol in order to return a URL directly. I do this, but the protocol method -previewItemURL is never called and the panel doesn't show the image, just an endlessly rotating 'waiting' thingy.
Is the documentation wrong? Has anyone made anything like this work?
I noticed an issue related to this where my browser view items were being passed some other object class to the -isEqual: method. Because these were a different class they didn't respond to a selector I use to compare the items (specifically, the -imageUID). I fixed that by checking it responds to selector, but it was a bit suspicious that the IKImageBrowserView was using a mix of objects internally, not just the items I had passed to it. Might be legit though, but not having the source to the browser view, I just don't know.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden