QLPreviewPanel Class Reference

Inherits from
Conforms to
Availability
Available in OS X v10.6 and later.
Companion guide
Declared in
QLPreviewPanel.h
Related sample code

Overview

The QLPreviewPanel class implements the Quick Look preview panel—a user interface object that displays the preview of a list of items.

Every application has a single shared instance of QLPreviewPanel (see sharedPreviewPanelExists). The preview panel follows the responder chain and adapts to the first responder willing to control it. A preview panel controller provides the content through methods defined in the QLPreviewPanelDataSource protocol.

You can not subclass QLPreviewPanel; you can, however, customize its behavior using a delegate (see delegate and the QLPreviewPanelDelegate Protocol informal protocol).

Tasks

Accessing the Shared Panel

Accessing the Preview Panel Controller

Managing the Preview Items

The Panel’s Delegate

Managing Full Screen Mode

Properties

currentController

The current first responder accepting to control the preview panel.

@property(readonly) id currentController
Discussion

You should never change the preview panel’s state (its delegate, datasource, and so on) if you are not controlling it.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

currentPreviewItem

The currently previewed item.

@property(readonly) id <QLPreviewItem> currentPreviewItem
Discussion

The value is nil if there is no current preview item.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

currentPreviewItemIndex

The index of the current preview item.

@property NSInteger currentPreviewItemIndex
Discussion

The value is NSNotFound if there is no current preview item.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

dataSource

The preview panel data source.

@property(assign) id <QLPreviewPanelDataSource> dataSource
Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
QLPreviewPanel.h

delegate

The preview panel’s delegate.

@property(assign) id <QLPreviewPanelDelegate> delegate
Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
QLPreviewPanel.h

displayState

The preview panel’s display state.

@property(retain) id displayState
Discussion

The value is an opaque object—you cannot create your own display state.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

inFullScreenMode

Indicates whether the panel is in full screen mode.

@property(readonly, getter=isInFullScreenMode) BOOL inFullScreenMode
Discussion

The value is YES if the panel is currently open and in full screen mode, otherwise it is NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

Class Methods

sharedPreviewPanel

Returns the shared Quick Look preview panel instance.

+ (QLPreviewPanel *)sharedPreviewPanel
Return Value

The shared Quick Look preview panel instance for the application.

Discussion

This method creates the panel if it doesn’t exist yet. Use sharedPreviewPanelExists if you want to determine whether the panel exists without creating it.

Availability
  • Available in OS X v10.6 and later.
Related Sample Code
Declared In
QLPreviewPanel.h

sharedPreviewPanelExists

Returns a Boolean value that indicates whether the shared Quick Look preview panel instance has been created.

+ (BOOL)sharedPreviewPanelExists
Return Value

YES if the shared Quick Look preview panel instance has been created, otherwise NO.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

Instance Methods

enterFullScreenMode:withOptions:

Instructs the panel to enter full screen mode.

- (BOOL)enterFullScreenMode:(NSScreen *)screen withOptions:(NSDictionary *)options
Parameters
screen

This parameter is not currently used—pass nil.

options

This parameter is not currently used—pass nil.

Return Value

YES if the panel was able to enter full screen mode, otherwise NO.

Discussion

If panel is not on-screen, the panel will go directly to full screen mode.

The panel will choose the appropriate screen depending on where the panel is or, if entering fullscreen directly, where the panel is supposed to zoom from (see QLPreviewPanelDelegate Protocol).

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

exitFullScreenModeWithOptions:

Instructs the panel to exit full screen mode.

- (void)exitFullScreenModeWithOptions:(NSDictionary *)options
Parameters
options

This parameter is not currently used—pass nil.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

refreshCurrentPreviewItem

Asks the preview panel to recompute the preview of the current preview item.

- (void)refreshCurrentPreviewItem
Discussion

This method does not refresh the visible item if it has not changed.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

reloadData

Asks the preview panel to reload its data from its data source.

- (void)reloadData
Discussion

This method does not refresh the visible item if it has not changed.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h

updateController

Asks the preview panel to update its current controller.

- (void)updateController
Discussion

The preview panel automatically updates its controller (by searching the responder chain) whenever the main or key window changes. You should only invoke this method if the responder chain changes without explicit notice.

Availability
  • Available in OS X v10.6 and later.
Declared In
QLPreviewPanel.h