QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
The QgsFileWidget class creates a widget for selecting a file or a folder. More...
#include <qgsfilewidget.h>
Public Types | |
enum | RelativeStorage { Absolute , RelativeProject , RelativeDefaultPath } |
The RelativeStorage enum determines if path is absolute, relative to the current project path or relative to a defined default path. More... | |
enum | StorageMode { GetFile , GetDirectory , GetMultipleFiles , SaveFile } |
The StorageMode enum determines if the file picker should pick files or directories. More... | |
Signals | |
void | fileChanged (const QString &path) |
Emitted whenever the current file or directory path is changed. More... | |
Public Member Functions | |
QgsFileWidget (QWidget *parent=nullptr) | |
QgsFileWidget creates a widget for selecting a file or a folder. More... | |
bool | confirmOverwrite () const |
Returns whether a confirmation will be shown when overwriting an existing file. More... | |
QString | defaultRoot () const |
returns the default root path More... | |
QString | dialogTitle () const |
returns the open file dialog title More... | |
QString | filePath () |
Returns the current file path(s) when multiple files are selected, they are quoted and separated by a single space (for example: '"/path/foo" "path/bar"') More... | |
bool | fileWidgetButtonVisible () const |
determines if the tool button is shown More... | |
QString | filter () const |
returns the filters used for QDialog::getOpenFileName More... | |
bool | fullUrl () const |
returns if the links shows the full path or not More... | |
QgsFilterLineEdit * | lineEdit () |
Returns a pointer to the widget's line edit, which can be used to customize the appearance and behavior of the line edit portion of the widget. More... | |
QFileDialog::Options | options () const |
Returns additional options used for QFileDialog. More... | |
QgsFileWidget::RelativeStorage | relativeStorage () const |
returns if the relative path is with respect to the project path or the default path More... | |
QString | selectedFilter () const |
Returns the selected filter from the last opened file dialog. More... | |
void | setConfirmOverwrite (bool confirmOverwrite) |
Sets whether a confirmation to overwrite an existing file will appear. More... | |
void | setDefaultRoot (const QString &defaultRoot) |
determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath More... | |
void | setDialogTitle (const QString &title) |
setDialogTitle defines the open file dialog title More... | |
void | setFilePath (QString path) |
Sets the file path. More... | |
void | setFileWidgetButtonVisible (bool visible) |
determines if the tool button is shown More... | |
void | setFilter (const QString &filter) |
setFilter sets the filter used by the model to filters. More... | |
void | setFullUrl (bool fullUrl) |
determines if the links shows the full path or not More... | |
void | setOptions (QFileDialog::Options options) |
setOptions sets additional options used for QFileDialog. More... | |
void | setReadOnly (bool readOnly) |
defines if the widget is readonly More... | |
void | setRelativeStorage (QgsFileWidget::RelativeStorage relativeStorage) |
determines if the relative path is with respect to the project path or the default path More... | |
void | setSelectedFilter (const QString &selectedFilter) |
Sets the selected filter when the file dialog opens. More... | |
void | setStorageMode (QgsFileWidget::StorageMode storageMode) |
determines the storage mode (i.e. file or directory) More... | |
void | setUseLink (bool useLink) |
determines if the file path will be shown as a link More... | |
QgsFileWidget::StorageMode | storageMode () const |
returns the storage mode (i.e. file or directory) More... | |
bool | useLink () const |
determines if the file path will be shown as a link More... | |
Static Public Member Functions | |
static QStringList | splitFilePaths (const QString &path) |
Split the the quoted and space separated path and returns a QString list. More... | |
Properties | |
QString | defaultRoot |
QString | dialogTitle |
bool | fileWidgetButtonVisible |
QString | filter |
bool | fullUrl |
QFileDialog::Options | options |
RelativeStorage | relativeStorage |
StorageMode | storageMode |
bool | useLink |
Friends | |
class | TestQgsFileWidget |
The QgsFileWidget class creates a widget for selecting a file or a folder.
Definition at line 36 of file qgsfilewidget.h.
The RelativeStorage enum determines if path is absolute, relative to the current project path or relative to a defined default path.
Enumerator | |
---|---|
Absolute | |
RelativeProject | |
RelativeDefaultPath |
Definition at line 76 of file qgsfilewidget.h.
The StorageMode enum determines if the file picker should pick files or directories.
Enumerator | |
---|---|
GetFile | Select a single file. |
GetDirectory | Select a directory. |
GetMultipleFiles | Select multiple files. |
SaveFile | Select a single new or pre-existing file. |
Definition at line 64 of file qgsfilewidget.h.
|
explicit |
QgsFileWidget creates a widget for selecting a file or a folder.
Definition at line 36 of file qgsfilewidget.cpp.
|
inline |
Returns whether a confirmation will be shown when overwriting an existing file.
Definition at line 159 of file qgsfilewidget.h.
QString QgsFileWidget::defaultRoot | ( | ) | const |
returns the default root path
Definition at line 201 of file qgsfilewidget.cpp.
QString QgsFileWidget::dialogTitle | ( | ) | const |
returns the open file dialog title
Definition at line 110 of file qgsfilewidget.cpp.
|
signal |
Emitted whenever the current file or directory path is changed.
QString QgsFileWidget::filePath | ( | ) |
Returns the current file path(s) when multiple files are selected, they are quoted and separated by a single space (for example: '"/path/foo" "path/bar"')
Definition at line 76 of file qgsfilewidget.cpp.
bool QgsFileWidget::fileWidgetButtonVisible | ( | ) | const |
determines if the tool button is shown
Definition at line 141 of file qgsfilewidget.cpp.
QString QgsFileWidget::filter | ( | ) | const |
returns the filters used for QDialog::getOpenFileName
Definition at line 120 of file qgsfilewidget.cpp.
bool QgsFileWidget::fullUrl | ( | ) | const |
returns if the links shows the full path or not
Definition at line 191 of file qgsfilewidget.cpp.
QgsFilterLineEdit * QgsFileWidget::lineEdit | ( | ) |
Returns a pointer to the widget's line edit, which can be used to customize the appearance and behavior of the line edit portion of the widget.
Definition at line 232 of file qgsfilewidget.cpp.
QFileDialog::Options QgsFileWidget::options | ( | ) | const |
Returns additional options used for QFileDialog.
Definition at line 131 of file qgsfilewidget.cpp.
QgsFileWidget::RelativeStorage QgsFileWidget::relativeStorage | ( | ) | const |
returns if the relative path is with respect to the project path or the default path
Definition at line 222 of file qgsfilewidget.cpp.
|
inline |
Returns the selected filter from the last opened file dialog.
Definition at line 147 of file qgsfilewidget.h.
|
inline |
Sets whether a confirmation to overwrite an existing file will appear.
By default, a confirmation will appear.
confirmOverwrite | If set to true , an overwrite confirmation will be shown |
Definition at line 154 of file qgsfilewidget.h.
void QgsFileWidget::setDefaultRoot | ( | const QString & | defaultRoot | ) |
determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
Definition at line 206 of file qgsfilewidget.cpp.
void QgsFileWidget::setDialogTitle | ( | const QString & | title | ) |
setDialogTitle defines the open file dialog title
Definition at line 115 of file qgsfilewidget.cpp.
void QgsFileWidget::setFilePath | ( | QString | path | ) |
Sets the file path.
Definition at line 94 of file qgsfilewidget.cpp.
void QgsFileWidget::setFileWidgetButtonVisible | ( | bool | visible | ) |
determines if the tool button is shown
Definition at line 146 of file qgsfilewidget.cpp.
void QgsFileWidget::setFilter | ( | const QString & | filter | ) |
setFilter sets the filter used by the model to filters.
The filter is used to specify the kind of files that should be shown.
filter | Only files that match the given filter are shown, it may be an empty string. If you want multiple filters, separate them with ';;', |
Definition at line 125 of file qgsfilewidget.cpp.
void QgsFileWidget::setFullUrl | ( | bool | fullUrl | ) |
determines if the links shows the full path or not
Definition at line 196 of file qgsfilewidget.cpp.
void QgsFileWidget::setOptions | ( | QFileDialog::Options | options | ) |
setOptions sets additional options used for QFileDialog.
These options affect the look and feel of the QFileDialog
Definition at line 136 of file qgsfilewidget.cpp.
void QgsFileWidget::setReadOnly | ( | bool | readOnly | ) |
defines if the widget is readonly
Definition at line 100 of file qgsfilewidget.cpp.
void QgsFileWidget::setRelativeStorage | ( | QgsFileWidget::RelativeStorage | relativeStorage | ) |
determines if the relative path is with respect to the project path or the default path
Definition at line 227 of file qgsfilewidget.cpp.
|
inline |
Sets the selected filter when the file dialog opens.
Definition at line 142 of file qgsfilewidget.h.
void QgsFileWidget::setStorageMode | ( | QgsFileWidget::StorageMode | storageMode | ) |
determines the storage mode (i.e. file or directory)
Definition at line 216 of file qgsfilewidget.cpp.
void QgsFileWidget::setUseLink | ( | bool | useLink | ) |
determines if the file path will be shown as a link
Definition at line 182 of file qgsfilewidget.cpp.
|
static |
Split the the quoted and space separated path and returns a QString list.
Definition at line 81 of file qgsfilewidget.cpp.
QgsFileWidget::StorageMode QgsFileWidget::storageMode | ( | ) | const |
returns the storage mode (i.e. file or directory)
Definition at line 211 of file qgsfilewidget.cpp.
bool QgsFileWidget::useLink | ( | ) | const |
determines if the file path will be shown as a link
Definition at line 177 of file qgsfilewidget.cpp.
|
friend |
Definition at line 240 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.
|
readwrite |
Definition at line 1 of file qgsfilewidget.h.