How do I use QLPreviewPanel
? I know it wasn't a public API before, but it is in 10.6. How can I use it to show a preview of a file in a standard QuickLook panel?
Check out the QuickLookDownloader code. It walks you through a couple of things you need to do to incorporate QLPreviewPanel
into your code. Some of these include:
QLPreviewItem
protocol - this tells Quick Look where to find the file you want to preview (and you are previewing files - you can't pass in custom data).QLPreviewPanel
(if you're worked with NSTableView
s before, this should be pretty familiar).QLPreviewPanelController
protocol (where you assign the data source and delegate).Items 1-3 are handled in the MyDocument
class of the sample code. Toggling the display is mostly handled in the AppDelegate
class. There's also support in the DownloadsTableView
class that toggles the QLPreviewPanel
via the space key, a la the Finder.