CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Signals | Public Member Functions | Protected Attributes | Properties | List of all members
ctkDirectoryButton Class Reference

#include <Libs/Widgets/ctkDirectoryButton.h>

Inheritance diagram for ctkDirectoryButton:
Inheritance graph
[legend]
Collaboration diagram for ctkDirectoryButton:
Collaboration graph
[legend]

Public Types

enum  Option {
  ShowDirsOnly = 0x00000001, DontResolveSymlinks = 0x00000002, DontConfirmOverwrite = 0x00000004, DontUseSheet = 0x00000008,
  DontUseNativeDialog = 0x00000010, ReadOnly = 0x00000020, HideNameFilterDetails = 0x00000040
}
 

Public Slots

void browse ()
 

Signals

void directoryChanged (const QString &)
 
void directorySelected (const QString &)
 

Public Member Functions

QFileDialog::AcceptMode acceptMode () const
 
const QString & caption () const
 
 ctkDirectoryButton (QWidget *parent=0)
 
 ctkDirectoryButton (const QString &directory, QWidget *parent=0)
 
 ctkDirectoryButton (const QIcon &icon, const QString &directory, QWidget *parent=0)
 
QString directory () const
 
QIcon icon () const
 
const Options & options () const
 
void setAcceptMode (QFileDialog::AcceptMode mode)
 
void setCaption (const QString &caption)
 
void setDirectory (const QString &path)
 
void setIcon (const QIcon &icon)
 
void setOptions (const Options &options)
 
void setText (const QString &text)
 
const QString & text () const
 
virtual ~ctkDirectoryButton ()
 Destructor. More...
 

Protected Attributes

QScopedPointer< ctkDirectoryButtonPrivate > d_ptr
 

Properties

QFileDialog::AcceptMode acceptMode
 
QString caption
 
QString directory
 
QIcon icon
 
Options options
 
QString text
 

Detailed Description

ctkDirectoryButton is a QPushButton to select a directory path. The absolute path is displayed on the button. When clicked, a file dialog pops up to select a new directory path.

See also
ctkPathLineEdit, ctkPathListWidget, QPushButton, QDir

Definition at line 43 of file ctkDirectoryButton.h.

Member Enumeration Documentation

Enumerator
ShowDirsOnly 
DontResolveSymlinks 
DontConfirmOverwrite 
DontUseSheet 
DontUseNativeDialog 
ReadOnly 
HideNameFilterDetails 

Definition at line 77 of file ctkDirectoryButton.h.

Constructor & Destructor Documentation

ctkDirectoryButton::ctkDirectoryButton ( QWidget *  parent = 0)

Constructor Creates a default ctkDirectoryButton that points to the application current directory.

ctkDirectoryButton::ctkDirectoryButton ( const QString &  directory,
QWidget *  parent = 0 
)

Constructor Creates a ctkDirectoryButton that points to the given directory path

ctkDirectoryButton::ctkDirectoryButton ( const QIcon &  icon,
const QString &  directory,
QWidget *  parent = 0 
)
virtual ctkDirectoryButton::~ctkDirectoryButton ( )
virtual

Destructor.

Member Function Documentation

QFileDialog::AcceptMode ctkDirectoryButton::acceptMode ( ) const
See also
setAcceptMode QFileDialog::AcceptMode
void ctkDirectoryButton::browse ( )
slot

browse() opens a pop up where the user can select a new directory for the button. browse() is automatically called when the button is clicked.

const QString& ctkDirectoryButton::caption ( ) const

Get the caption of the directory dialog

See also
setCaption
QString ctkDirectoryButton::directory ( ) const
void ctkDirectoryButton::directoryChanged ( const QString &  )
signal

directoryChanged is emitted when the current directory changes. Programatically or by the user via the file dialog that pop up when clicking on the button.

See also
directorySelected
void ctkDirectoryButton::directorySelected ( const QString &  )
signal

directorySelected() is emitted anytime the current directory is set (even if the new directory is the same than the current value). This is particularly useful when the browse dialog is accepted without changing the current directory.

See also
directoryChanged
QIcon ctkDirectoryButton::icon ( ) const
const Options& ctkDirectoryButton::options ( ) const
void ctkDirectoryButton::setAcceptMode ( QFileDialog::AcceptMode  mode)
See also
acceptMode QFileDialog::AcceptMode
void ctkDirectoryButton::setCaption ( const QString &  caption)

Set the caption of the directory dialog

See also
caption
void ctkDirectoryButton::setDirectory ( const QString &  path)

Set/get the current directory If path is empty, the program's working directory, ("."), is used. By default, directory is the current working directory.

void ctkDirectoryButton::setIcon ( const QIcon &  icon)

The icon of the button By default use QStyle::SP_DirIcon

void ctkDirectoryButton::setOptions ( const Options &  options)

Options of the file dialog pop up.

See also
QFileDialog::getExistingDirectory
void ctkDirectoryButton::setText ( const QString &  text)

Set the text of the button. If null (not just empty), the directory path is used as text. This doesn't set the "directory", just the displayed text.

See also
setDirectory
const QString& ctkDirectoryButton::text ( ) const

Return the text of the button if any. Doesn't return the directory path.

See also
directory

Member Data Documentation

QScopedPointer<ctkDirectoryButtonPrivate> ctkDirectoryButton::d_ptr
protected

Definition at line 165 of file ctkDirectoryButton.h.

Property Documentation

QFileDialog::AcceptMode ctkDirectoryButton::acceptMode
readwrite

This property holds the accept mode of the dialog. The action mode defines whether the dialog is for opening or saving files. By default, this property is set to AcceptOpen. If set to QFileDialog::AcceptSave mode, the regular behavior of QFileDialog will be extended to prevent user from selecting read-only folder. The caveat is that writable folder existing in a readonly one won't be selectable. AcceptOpen by default.

Definition at line 53 of file ctkDirectoryButton.h.

QString ctkDirectoryButton::caption
readwrite

This property holds the title of the file dialog used to select a new directory If caption is not set, internally use QWidget::tooltip()

Definition at line 57 of file ctkDirectoryButton.h.

QString ctkDirectoryButton::directory
readwrite

Definition at line 54 of file ctkDirectoryButton.h.

QIcon ctkDirectoryButton::icon
readwrite

This property holds the icon displayed on the button. QStyle::SP_DirIcon by default.

Definition at line 63 of file ctkDirectoryButton.h.

Options ctkDirectoryButton::options
readwrite

Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the public API. We need to create a custom property that will be used when instanciating a QFileDialog in ctkDirectoryButton::browse()

Definition at line 70 of file ctkDirectoryButton.h.

QString ctkDirectoryButton::text
readwrite

This property holds the text to display on the button. If null (by default), the current directory path is displayed instead.

Definition at line 60 of file ctkDirectoryButton.h.


The documentation for this class was generated from the following file: