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 (const QIcon &icon, const QString &directory, QWidget *parent=0)
 
 ctkDirectoryButton (const QString &directory, QWidget *parent=0)
 
 ctkDirectoryButton (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

◆ Option

Enumerator
ShowDirsOnly 
DontResolveSymlinks 
DontConfirmOverwrite 
DontUseSheet 
DontUseNativeDialog 
ReadOnly 
HideNameFilterDetails 

Definition at line 77 of file ctkDirectoryButton.h.

Constructor & Destructor Documentation

◆ ctkDirectoryButton() [1/3]

ctkDirectoryButton::ctkDirectoryButton ( QWidget *  parent = 0)

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

◆ ctkDirectoryButton() [2/3]

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

Constructor Creates a ctkDirectoryButton that points to the given directory path

◆ ctkDirectoryButton() [3/3]

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

◆ ~ctkDirectoryButton()

virtual ctkDirectoryButton::~ctkDirectoryButton ( )
virtual

Destructor.

Member Function Documentation

◆ acceptMode()

QFileDialog::AcceptMode ctkDirectoryButton::acceptMode ( ) const
See also
setAcceptMode QFileDialog::AcceptMode

◆ browse

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.

◆ caption()

const QString& ctkDirectoryButton::caption ( ) const

Get the caption of the directory dialog

See also
setCaption

◆ directory()

QString ctkDirectoryButton::directory ( ) const

◆ directoryChanged

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

◆ 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

◆ icon()

QIcon ctkDirectoryButton::icon ( ) const

◆ options()

const Options& ctkDirectoryButton::options ( ) const

◆ setAcceptMode()

void ctkDirectoryButton::setAcceptMode ( QFileDialog::AcceptMode  mode)
See also
acceptMode QFileDialog::AcceptMode

◆ setCaption()

void ctkDirectoryButton::setCaption ( const QString &  caption)

Set the caption of the directory dialog

See also
caption

◆ setDirectory()

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.

◆ setIcon()

void ctkDirectoryButton::setIcon ( const QIcon &  icon)

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

◆ setOptions()

void ctkDirectoryButton::setOptions ( const Options &  options)

Options of the file dialog pop up.

See also
QFileDialog::getExistingDirectory

◆ setText()

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

◆ text()

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

◆ d_ptr

QScopedPointer<ctkDirectoryButtonPrivate> ctkDirectoryButton::d_ptr
protected

Definition at line 165 of file ctkDirectoryButton.h.

Property Documentation

◆ acceptMode

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 173 of file ctkDirectoryButton.h.

◆ caption

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 173 of file ctkDirectoryButton.h.

◆ directory

QString ctkDirectoryButton::directory
readwrite

Definition at line 173 of file ctkDirectoryButton.h.

◆ icon

QIcon ctkDirectoryButton::icon
readwrite

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

Definition at line 173 of file ctkDirectoryButton.h.

◆ options

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 173 of file ctkDirectoryButton.h.

◆ text

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 173 of file ctkDirectoryButton.h.


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