FileBrowser Class Reference

A widget to allow the user to browse for files. More...

#include <FileBrowser.h>

List of all members.

Signals

void filenameChanged (const QString &filename)

Public Member Functions

 FileBrowser (QWidget *pParent=NULL)
 ~FileBrowser ()
void setFilename (const QString &filename)
void setFilename (const Filename &filename)
QString getFilename () const
void setBrowseCaption (const QString &caption)
QString getBrowseCaption () const
void setBrowseDirectory (const QString &directory)
QString getBrowseDirectory () const
void setBrowseFileFilters (const QString &filters)
QString getBrowseFileFilters () const
void setBrowseExistingFile (bool bExistingFile)
bool isBrowseExistingFile () const

Protected Slots

void browse ()

Protected Member Functions

bool eventFilter (QObject *pObject, QEvent *pEvent)


Detailed Description

A widget to allow the user to browse for files.

The FileBrowser extends the QWidget class to provide a single QWidget capable of performing typical file-browsing tasks. This class associates an editable text-entry field with a button which brings up a file selection dialog by calling either the QFileDialog::getOpenFileName() method or the QFileDialog::getSaveFileName() method. Selecting a file through the file selection dialog will populate the text field.

Definition at line 29 of file FileBrowser.h.


Constructor & Destructor Documentation

FileBrowser::FileBrowser ( QWidget *  pParent = NULL  ) 

Creates a FileBrowser with no file selected.

Parameters:
pParent The parent widget.

FileBrowser::~FileBrowser (  ) 

Destroys the widget and all child widget items.


Member Function Documentation

void FileBrowser::setFilename ( const QString &  filename  ) 

Sets the name of the file.

This method sets the name of the file to be displayed in the FileBrowser.

Parameters:
filename The name of the file.

void FileBrowser::setFilename ( const Filename filename  ) 

Sets the name of the file.

This method sets the name of the file to be displayed in the FileBrowser.

Parameters:
filename The name of the file.

QString FileBrowser::getFilename (  )  const

Gets the name of the file.

This method gets the name of the file displayed in the FileBrowser.

Returns:
The name of the file.

void FileBrowser::setBrowseCaption ( const QString &  caption  ) 

Sets the browse caption.

This method sets the browse caption of the FileBrowser. For more information on browse captions, please refer to the QFileDialog::getOpenFileName documentation.

Parameters:
caption The browse caption.

QString FileBrowser::getBrowseCaption (  )  const

Gets the browse caption.

This method gets the browse caption of the FileBrowser. For more information on browse captions, please refer to the QFileDialog::getOpenFileName documentation.

Returns:
The browse caption.

void FileBrowser::setBrowseDirectory ( const QString &  directory  ) 

Sets the browse directory.

This method sets the browse directory of the FileBrowser. For more information on browse directories, please refer to the QFileDialog::getOpenFileName documentation.

Parameters:
directory The browse directory.

QString FileBrowser::getBrowseDirectory (  )  const

Gets the browse directory.

This method gets the browse directory of the FileBrowser. For more information on browse directories, please refer to the QFileDialog::getOpenFileName documentation.

Returns:
The browse directory.

void FileBrowser::setBrowseFileFilters ( const QString &  filters  ) 

Sets the browse file filters.

This method sets the browse file filters of the FileBrowser. For more information on browse file filters, please refer to the QFileDialog::getOpenFileName documentation.

Parameters:
filters The browse file filters.

QString FileBrowser::getBrowseFileFilters (  )  const

Gets the browse file filters.

This method gets the browse file filters of the FileBrowser. For more information on browse file filters, please refer to the QFileDialog::getOpenFileName documentation.

Returns:
The browse file filters.

void FileBrowser::setBrowseExistingFile ( bool  bExistingFile  ) 

Sets the file selection dialog to only browse for existing files.

By default if this method is not called, isBrowseExistingFile() returns true.

Parameters:
bExistingFile Set this value to true to browse only for existing files. Set the value to false to allow non-existent files to be selected.
See also:
QFileDialog::getOpenFileName(), QFileDialog::getSaveFileName()

bool FileBrowser::isBrowseExistingFile (  )  const

Queries whether the file selection dialog only browses for existing files.

Returns:
Returns true if the file selection dialog only browses for existing files. Returns false if non-existent files can be selected. Returns true by default if setBrowseExistingFile() has not been called on this instance of the file browser.
See also:
QFileDialog::getOpenFileName(), QFileDialog::getSaveFileName()

void FileBrowser::filenameChanged ( const QString &  filename  )  [signal]

This signal is emitted when the filename is changed.

bool FileBrowser::eventFilter ( QObject *  pObject,
QEvent *  pEvent 
) [protected]

Sends a focus out event if needed based on the current editing status.

Parameters:
pObject The object prompting the event.
pEvent The event invoked by the object.
Returns:
Returns the value returned by the default QWidget implementation.

void FileBrowser::browse (  )  [protected, slot]

Calls QFileDialog::getOpenFileName to allow the user to specify a file.

If no browse directory has been set, then the current file's directory will be used as the initial directory.


Software Development Kit - Opticks 4.9.0 Build 16218