The ctkPathListWidget lists files and/or directories.
More...
#include <Libs/Widgets/ctkPathListWidget.h>
|
QScopedPointer< ctkPathListWidgetPrivate > | d_ptr |
|
The ctkPathListWidget lists files and/or directories.
The ctkPathListWidget is a QListView sub-class tailored specifically for displaying lists of file and/or directory entries. A path denotes either a file or a directory. Paths can be relative or absolute and the range of valid paths can be constrained by setting file and directory options.
- See also
- ctkPathLineEdit, ctkDirectoryButton
Definition at line 47 of file ctkPathListWidget.h.
◆ Superclass
◆ anonymous enum
Enumerator |
---|
AbsolutePathRole | A role for getting the absolute path from items in this list views model.
|
Definition at line 74 of file ctkPathListWidget.h.
◆ Mode
Enumerator |
---|
Any | Allow all paths.
|
FilesOnly | Allow only file entries.
|
DirectoriesOnly | Allow only directory entries.
|
Definition at line 96 of file ctkPathListWidget.h.
◆ PathOption
Describes constraints on paths.
Enumerator |
---|
None | No constraints.
|
Exists | The path must exist in the file system.
|
Readable | The path must be readable by the current user.
|
Writable | The path must be writable by the current user.
|
Executable | The path must be executable by the current user.
|
Definition at line 81 of file ctkPathListWidget.h.
◆ ctkPathListWidget()
ctkPathListWidget::ctkPathListWidget |
( |
QWidget * |
parent = 0 | ) |
|
|
explicit |
◆ ~ctkPathListWidget()
virtual ctkPathListWidget::~ctkPathListWidget |
( |
| ) |
|
|
virtual |
◆ addPath
bool ctkPathListWidget::addPath |
( |
const QString & |
path | ) |
|
|
slot |
Depending on the mode and path constraints, add path to the entry list and emit signal pathListChanged().
- Parameters
-
- Returns
true
if the path was added, false
otherwise.
- See also
- pathListChanged()
◆ addPaths
QStringList ctkPathListWidget::addPaths |
( |
const QStringList & |
paths | ) |
|
|
slot |
Depending on the mode and path constraints, add paths to the entry list and emit signal pathListChanged().
- Parameters
-
- Returns
- The absolute paths of all added entries from paths.
- See also
- pathListChanged()
◆ clear
void ctkPathListWidget::clear |
( |
| ) |
|
|
slot |
Remove all paths from the list.
◆ contains()
bool ctkPathListWidget::contains |
( |
const QString & |
path | ) |
const |
Checks if an entry with the given path already exists.
- Returns
true
if the path has already been added, false
otherwise.
◆ count()
int ctkPathListWidget::count |
( |
| ) |
const |
- Returns
- The current entry count.
◆ currentPath()
QString ctkPathListWidget::currentPath |
( |
bool |
absolutePath = false | ) |
const |
Get the currently focused path entry.
- Parameters
-
absolutePath | If true , resolve all entries to absolute paths. |
- Returns
- The focused path entry or a null QString if no entry is focused.
◆ currentPathChanged
void ctkPathListWidget::currentPathChanged |
( |
const QString & |
currentAbsolutePath, |
|
|
const QString & |
previousAbsolutePath |
|
) |
| |
|
signal |
This signal is emitted whenever the current item changes.
- Parameters
-
currentAbsolutePath | The new current path entry. |
previousAbsolutePath | The path entry that previously had the focus. |
◆ directories()
QStringList ctkPathListWidget::directories |
( |
bool |
absolutePath = false | ) |
const |
Get all directory entries.
- Parameters
-
absolutePath | If true , resolve all entries to absolute paths. |
- Returns
- A list of all directory entries.
◆ directoryIcon()
QIcon ctkPathListWidget::directoryIcon |
( |
| ) |
const |
- Returns
- The QIcon used for directory entries.
◆ directoryOptions()
PathOptions ctkPathListWidget::directoryOptions |
( |
| ) |
const |
- Returns
- The directory entry constraints.
◆ editPath() [1/2]
bool ctkPathListWidget::editPath |
( |
const QModelIndex & |
index, |
|
|
const QString & |
newPath |
|
) |
| |
Changes the path value of index to newPath.
- Parameters
-
index | The model index for which the path will be changed. |
newPath | The new path replacing the path value of index. |
- See also
- editPath(const QString&, const QString&)
◆ editPath() [2/2]
bool ctkPathListWidget::editPath |
( |
const QString & |
oldPath, |
|
|
const QString & |
newPath |
|
) |
| |
Changes oldPath to the new value given by newPath. Does nothing if oldPath is not in the list or newPath does not fullfill the current path options (constraints).
- Parameters
-
oldPath | The path to be edited. |
newPath | The new path replacing oldPath. |
- Returns
true
if the old path was successfully changed, false
otherwise.
◆ fileIcon()
QIcon ctkPathListWidget::fileIcon |
( |
| ) |
const |
- Returns
- The QIcon used for file entries.
◆ fileOptions()
PathOptions ctkPathListWidget::fileOptions |
( |
| ) |
const |
- Returns
- The file entry constraints.
◆ files()
QStringList ctkPathListWidget::files |
( |
bool |
absolutePath = false | ) |
const |
Get all file entries.
- Parameters
-
absolutePath | If true , resolve all entries to absolute paths. |
- Returns
- A list of all file entries.
◆ isDirectory()
bool ctkPathListWidget::isDirectory |
( |
const QString & |
path | ) |
const |
- Returns
- Returns
true
if the given path is treated as a directory, false
otherwise.
◆ isFile()
bool ctkPathListWidget::isFile |
( |
const QString & |
path | ) |
const |
- Returns
- Returns
true
if the given path is treated as a file, false
otherwise.
◆ item() [1/2]
QStandardItem* ctkPathListWidget::item |
( |
const QString & |
absolutePath | ) |
const |
- Returns
- The item for the given absolute path or NULL if the the path is not known.
◆ item() [2/2]
QStandardItem* ctkPathListWidget::item |
( |
int |
row | ) |
const |
- Returns
- The item for row or NULL if row is out of range.
◆ itemAt() [1/2]
QStandardItem* ctkPathListWidget::itemAt |
( |
const QPoint & |
point | ) |
const |
- Returns
- The item for the entry located at the point point (in the widget coordinate system) or NULL if no ite could be found for point.
◆ itemAt() [2/2]
QStandardItem* ctkPathListWidget::itemAt |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
◆ mode()
Mode ctkPathListWidget::mode |
( |
| ) |
const |
- Returns
- The current widget mode.
◆ path()
QString ctkPathListWidget::path |
( |
int |
row | ) |
const |
- Returns
- The absolute path for row or a null QString if row is out of range.
◆ pathActivated
void ctkPathListWidget::pathActivated |
( |
const QString & |
absolutePath | ) |
|
|
signal |
This signal is emitted when the absolutePath entry is activated. The entry is activated when the user clicks or double clicks on it, depending on the system configuration. It is also activated when the user presses the activation key (on Windows and X11 this is the Return key, on Mac OS X it is Ctrl+0).
◆ pathAt() [1/2]
QString ctkPathListWidget::pathAt |
( |
const QPoint & |
point | ) |
const |
- Returns
- The absolute path for the entry located at the point point (in the widget coordinate system) or a null QString if no entry could be found for point.
◆ pathAt() [2/2]
QString ctkPathListWidget::pathAt |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
◆ pathClicked
void ctkPathListWidget::pathClicked |
( |
const QString & |
absolutePath | ) |
|
|
signal |
The user clicked on a path entry.
◆ pathDoubleClicked
void ctkPathListWidget::pathDoubleClicked |
( |
const QString & |
absolutePath | ) |
|
|
signal |
The user double-clicked on a path entry.
◆ paths()
QStringList ctkPathListWidget::paths |
( |
bool |
absolutePath = false | ) |
const |
Get all path entries.
- Parameters
-
absolutePath | If true , resolve all entries to absolute paths. |
- Returns
- A list of all entries.
◆ pathsChanged
void ctkPathListWidget::pathsChanged |
( |
const QStringList & |
added, |
|
|
const QStringList & |
removed |
|
) |
| |
|
signal |
This signal is emitted when paths are added or removed to the list.
- Parameters
-
added | The newly added absolute paths. |
removed | The removed absolute paths. |
◆ removePath
bool ctkPathListWidget::removePath |
( |
const QString & |
path | ) |
|
|
slot |
Remove path from the list. The signal pathListChanged() is emitted if the path was in the list.
- Parameters
-
- Returns
true
if path was removed, false
otherwise.
- See also
- pathListChanged()
◆ removePaths
QStringList ctkPathListWidget::removePaths |
( |
const QStringList & |
paths | ) |
|
|
slot |
Remove paths from the list.
- Parameters
-
paths | The paths to remove. |
- Returns
- The absolute paths of all removed entries from paths.
◆ removeSelectedPaths
void ctkPathListWidget::removeSelectedPaths |
( |
| ) |
|
|
slot |
Remove all currently selected paths from the list.
◆ row()
int ctkPathListWidget::row |
( |
const QString & |
path | ) |
const |
- Returns
- The row number for the given path or -1 if path is not in the list of current entries.
◆ selectedPaths()
QStringList ctkPathListWidget::selectedPaths |
( |
bool |
absolutePath = false | ) |
const |
Get all selected path entries.
- Parameters
-
absolutePath | If true , resolve all entries to absolute paths. |
- Returns
- A list of all selected entries.
◆ setDirectoryIcon()
void ctkPathListWidget::setDirectoryIcon |
( |
const QIcon & |
icon | ) |
|
Sets a QIcon to be used for directory entries.
- Parameters
-
icon | The new directory entry icon. |
◆ setDirectoryOptions()
void ctkPathListWidget::setDirectoryOptions |
( |
PathOptions |
directoryOptions | ) |
|
Set new directory entry constraints.
- Parameters
-
directoryOptions | The directory entry constraints. |
◆ setFileIcon()
void ctkPathListWidget::setFileIcon |
( |
const QIcon & |
icon | ) |
|
Sets a QIcon to be used for file entries.
- Parameters
-
icon | The new file entry icon. |
◆ setFileOptions()
void ctkPathListWidget::setFileOptions |
( |
PathOptions |
fileOptions | ) |
|
Set new file entry constraints.
- Parameters
-
fileOptions | The file entry constraints. |
◆ setMode
void ctkPathListWidget::setMode |
( |
Mode |
mode | ) |
|
|
slot |
Set the mode for controlling the path type.
- Parameters
-
◆ setPaths
void ctkPathListWidget::setPaths |
( |
const QStringList & |
paths | ) |
|
|
slot |
Remove all entries and set all valid entries in paths as the current list. The signal pathListChanged() is emitted if the old list of paths is different from the provided one.
- Parameters
-
- See also
- addPaths(), pathListChanged()
◆ unsetDirectoryIcon()
void ctkPathListWidget::unsetDirectoryIcon |
( |
| ) |
|
Un-set any custom directory icon.
◆ unsetFileIcon()
void ctkPathListWidget::unsetFileIcon |
( |
| ) |
|
Un-set any custom file icon.
◆ d_ptr
QScopedPointer<ctkPathListWidgetPrivate> ctkPathListWidget::d_ptr |
|
protected |
◆ directoryIcon
QIcon ctkPathListWidget::directoryIcon |
|
readwrite |
◆ directoryOptions
PathOptions ctkPathListWidget::directoryOptions |
|
readwrite |
◆ fileIcon
QIcon ctkPathListWidget::fileIcon |
|
readwrite |
◆ fileOptions
PathOptions ctkPathListWidget::fileOptions |
|
readwrite |
◆ mode
Mode ctkPathListWidget::mode |
|
readwrite |
◆ paths
QStringList ctkPathListWidget::paths |
|
readwrite |
The documentation for this class was generated from the following file: