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 Slots | Protected Attributes | Properties | List of all members
ctkPathLineEdit Class Reference

Advanced line edit to select a file or directory. More...

#include <Libs/Widgets/ctkPathLineEdit.h>

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

Public Types

enum  Filter {
  Dirs = 0x001 , Files = 0x002 , Drives = 0x004 , NoSymLinks = 0x008 ,
  AllEntries = Dirs | Files | Drives , TypeMask = 0x00f , Readable = 0x010 , Writable = 0x020 ,
  Executable = 0x040 , PermissionMask = 0x070 , Modified = 0x080 , Hidden = 0x100 ,
  System = 0x200 , AccessMask = 0x3F0 , AllDirs = 0x400 , CaseSensitive = 0x800 ,
  NoDotAndDotDot = 0x1000 , NoDot = 0x2000 , NoDotDot = 0x4000 , NoFilter = -1
}
 
enum  Option {
  ShowDirsOnly = 0x00000001 , DontResolveSymlinks = 0x00000002 , DontConfirmOverwrite = 0x00000004 , DontUseSheet = 0x00000008 ,
  DontUseNativeDialog = 0x00000010 , ReadOnly = 0x00000020 , HideNameFilterDetails = 0x00000040
}
 
enum  SizeAdjustPolicy { AdjustToContents , AdjustToContentsOnFirstShow , AdjustToMinimumContentsLength }
 

Public Slots

void addCurrentPathToHistory ()
 
void browse ()
 
void retrieveHistory ()
 
void setCurrentPath (const QString &path)
 

Signals

void currentPathChanged (const QString &path)
 
void validInputChanged (bool)
 

Public Member Functions

QComboBox * comboBox () const
 Return the combo box internally used by the path line edit. More...
 
 ctkPathLineEdit (const QString &label, const QStringList &nameFilters, Filters filters=ctkPathLineEdit::AllEntries, QWidget *parent=0)
 
 ctkPathLineEdit (QWidget *parent=0)
 
QString currentPath () const
 
Filters filters () const
 
const QString & label () const
 
int minimumContentsLength () const
 
virtual QSize minimumSizeHint () const
 
const QStringList & nameFilters () const
 
const Options & options () const
 
void setCurrentFileExtension (const QString &extension)
 
void setFilters (const Filters &filters)
 
void setLabel (const QString &label)
 
void setMinimumContentsLength (int lenght)
 
void setNameFilters (const QStringList &nameFilters)
 
void setOptions (const Options &options)
 
void setSettingKey (const QString &key)
 
void setShowBrowseButton (bool visible)
 
void setShowHistoryButton (bool visible)
 
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
 
QString settingKey () const
 
bool showBrowseButton () const
 
bool showHistoryButton () const
 
SizeAdjustPolicy sizeAdjustPolicy () const
 
virtual QSize sizeHint () const
 
virtual ~ctkPathLineEdit ()
 

Protected Slots

void setCurrentDirectory (const QString &directory)
 
void updateHasValidInput ()
 

Protected Attributes

QScopedPointer< ctkPathLineEditPrivate > d_ptr
 

Properties

QString currentPath
 
Filters filters
 
QString label
 
int minimumContentsLength
 
QStringList nameFilters
 
Options options
 
QString settingKey
 
bool showBrowseButton
 
bool showHistoryButton
 
SizeAdjustPolicy sizeAdjustPolicy
 

Detailed Description

Advanced line edit to select a file or directory.

See also
ctkDirectoryButton, ctkPathListWidget

Definition at line 61 of file ctkPathLineEdit.h.

Member Enumeration Documentation

◆ Filter

Enumerator
Dirs 
Files 
Drives 
NoSymLinks 
AllEntries 
TypeMask 
Readable 
Writable 
Executable 
PermissionMask 
Modified 
Hidden 
System 
AccessMask 
AllDirs 
CaseSensitive 
NoDotAndDotDot 
NoDot 
NoDotDot 
NoFilter 

Definition at line 118 of file ctkPathLineEdit.h.

◆ Option

Enumerator
ShowDirsOnly 
DontResolveSymlinks 
DontConfirmOverwrite 
DontUseSheet 
DontUseNativeDialog 
ReadOnly 
HideNameFilterDetails 

Definition at line 143 of file ctkPathLineEdit.h.

◆ SizeAdjustPolicy

Enumerator
AdjustToContents 

The path line edit will always adjust to the contents.

AdjustToContentsOnFirstShow 

The path line edit will adjust to its contents the first time it is shown.

AdjustToMinimumContentsLength 

The combobox will adjust to minimumContentsLength. For performance reasons use this policy on large models.

Definition at line 156 of file ctkPathLineEdit.h.

Constructor & Destructor Documentation

◆ ctkPathLineEdit() [1/2]

ctkPathLineEdit::ctkPathLineEdit ( QWidget *  parent = 0)

Default constructor

◆ ctkPathLineEdit() [2/2]

ctkPathLineEdit::ctkPathLineEdit ( const QString &  label,
const QStringList &  nameFilters,
Filters  filters = ctkPathLineEdit::AllEntries,
QWidget *  parent = 0 
)

Constructor /param label Used in file dialogs /param nameFilters Regular expression (in wildcard mode) used to help the user to complete the line, example: "Images (*.jpg *.gif *.png)" /param parent Parent widget

◆ ~ctkPathLineEdit()

virtual ctkPathLineEdit::~ctkPathLineEdit ( )
virtual

Member Function Documentation

◆ addCurrentPathToHistory

void ctkPathLineEdit::addCurrentPathToHistory ( )
slot

Save the current value (this->currentPath()) into the history. That value will be retrieved next time retrieveHistory() is called.

See also
retrieveHistory(), showHistoryButton, settingKey

◆ browse

void ctkPathLineEdit::browse ( )
slot

Open a QFileDialog to select a file or directory and set current text to it You would probably connect a browse push button like this: connect(myPushButton,SIGNAL(clicked()),myPathLineEdit,SLOT(browse())) As a conveniency, such button is provided by default via the browseButton

See also
showBrowseButton

◆ comboBox()

QComboBox* ctkPathLineEdit::comboBox ( ) const

Return the combo box internally used by the path line edit.

◆ currentPath()

QString ctkPathLineEdit::currentPath ( ) const

◆ currentPathChanged

void ctkPathLineEdit::currentPathChanged ( const QString &  path)
signal

◆ filters()

Filters ctkPathLineEdit::filters ( ) const

◆ label()

const QString& ctkPathLineEdit::label ( ) const

◆ minimumContentsLength()

int ctkPathLineEdit::minimumContentsLength ( ) const

◆ minimumSizeHint()

virtual QSize ctkPathLineEdit::minimumSizeHint ( ) const
virtual

The width returned, in pixels, is the length of the file name (with no path) if any. Otherwise, it's enough for 15 to 20 characters.

◆ nameFilters()

const QStringList& ctkPathLineEdit::nameFilters ( ) const

◆ options()

const Options& ctkPathLineEdit::options ( ) const

◆ retrieveHistory

void ctkPathLineEdit::retrieveHistory ( )
slot

Load the history of the paths that have been saved in the application settings with addCurrentPathToHistory(). The history is identified using settingKey

See also
addCurrentPathToHistory(), showHistoryButton, settingKey

◆ setCurrentDirectory

void ctkPathLineEdit::setCurrentDirectory ( const QString &  directory)
protectedslot

◆ setCurrentFileExtension()

void ctkPathLineEdit::setCurrentFileExtension ( const QString &  extension)

Change the current extension of the edit line. If there is no extension yet, set it

◆ setCurrentPath

void ctkPathLineEdit::setCurrentPath ( const QString &  path)
slot

◆ setFilters()

void ctkPathLineEdit::setFilters ( const Filters &  filters)

◆ setLabel()

void ctkPathLineEdit::setLabel ( const QString &  label)

◆ setMinimumContentsLength()

void ctkPathLineEdit::setMinimumContentsLength ( int  lenght)

◆ setNameFilters()

void ctkPathLineEdit::setNameFilters ( const QStringList &  nameFilters)

◆ setOptions()

void ctkPathLineEdit::setOptions ( const Options &  options)

Options of the file dialog pop up.

See also
QFileDialog::getExistingDirectory

◆ setSettingKey()

void ctkPathLineEdit::setSettingKey ( const QString &  key)

◆ setShowBrowseButton()

void ctkPathLineEdit::setShowBrowseButton ( bool  visible)

◆ setShowHistoryButton()

void ctkPathLineEdit::setShowHistoryButton ( bool  visible)

◆ setSizeAdjustPolicy()

void ctkPathLineEdit::setSizeAdjustPolicy ( SizeAdjustPolicy  policy)

◆ settingKey()

QString ctkPathLineEdit::settingKey ( ) const

◆ showBrowseButton()

bool ctkPathLineEdit::showBrowseButton ( ) const

◆ showHistoryButton()

bool ctkPathLineEdit::showHistoryButton ( ) const

◆ sizeAdjustPolicy()

SizeAdjustPolicy ctkPathLineEdit::sizeAdjustPolicy ( ) const

the policy describing how the size of the combobox changes when the content changes

The default value is AdjustToContentsOnFirstShow.

See also
SizeAdjustPolicy

◆ sizeHint()

virtual QSize ctkPathLineEdit::sizeHint ( ) const
virtual

The width returned, in pixels, is the entire length of the current path if any. Otherwise, it's enough for 15 to 20 characters.

◆ updateHasValidInput

void ctkPathLineEdit::updateHasValidInput ( )
protectedslot

◆ validInputChanged

void ctkPathLineEdit::validInputChanged ( bool  )
signal

the signal is emit when the state of hasValidInput changed

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkPathLineEditPrivate> ctkPathLineEdit::d_ptr
protected

Definition at line 273 of file ctkPathLineEdit.h.

Property Documentation

◆ currentPath

QString ctkPathLineEdit::currentPath
readwrite

Definition at line 284 of file ctkPathLineEdit.h.

◆ filters

Filters ctkPathLineEdit::filters
readwrite

Definition at line 284 of file ctkPathLineEdit.h.

◆ label

QString ctkPathLineEdit::label
readwrite

Definition at line 284 of file ctkPathLineEdit.h.

◆ minimumContentsLength

int ctkPathLineEdit::minimumContentsLength
readwrite

This property holds the minimum number of characters that should fit into the path line edit. The default value is 0. If this property is set to a positive value, the minimumSizeHint() and sizeHint() take it into account.

Definition at line 284 of file ctkPathLineEdit.h.

◆ nameFilters

QStringList ctkPathLineEdit::nameFilters
readwrite

This property holds the list of regular expressions (in wildcard mode) used to help the user complete a line. For example: "Images (*.jpg *.gif *.png)"

Definition at line 284 of file ctkPathLineEdit.h.

◆ options

Options ctkPathLineEdit::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 ctkPathLineEdit::browse()

Definition at line 284 of file ctkPathLineEdit.h.

◆ settingKey

QString ctkPathLineEdit::settingKey
readwrite

This property controls the key used to search the settings for recorded paths. If multiple path line edits share the same key, their history is then shared. If an empty key string is given, the object name is used as key. Setting the key automatically retrieve the history from settings Empty by default.

See also
retrieveHistory(), addCurrentPathToHistory(), showHistoryButton

Definition at line 284 of file ctkPathLineEdit.h.

◆ showBrowseButton

bool ctkPathLineEdit::showBrowseButton
readwrite

This property controls whether the browse ("...") button is visible or not. Clicking on the button calls opens a dialog to select the current path. True by default

See also
browse()

Definition at line 284 of file ctkPathLineEdit.h.

◆ showHistoryButton

bool ctkPathLineEdit::showHistoryButton
readwrite

This property controls whether the history button (arrow button that opens the history menu) is visible or not. True by default.

See also
retrieveHistory(), addCurrentPathToHistory(), settingKey

Definition at line 284 of file ctkPathLineEdit.h.

◆ sizeAdjustPolicy

SizeAdjustPolicy ctkPathLineEdit::sizeAdjustPolicy
readwrite

This property holds the policy describing how the size of the path line edit widget changes when the content changes. The default value is AdjustToContentsOnFirstShow.

Definition at line 284 of file ctkPathLineEdit.h.


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