QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
The QgsExternalStorageFileWidget class creates a widget for selecting a file or a folder and stores it to a given external storage backend if defined. More...
#include <qgsexternalstoragefilewidget.h>
Public Member Functions | |
QgsExternalStorageFileWidget (QWidget *parent=nullptr) | |
QgsExternalStorageFileWidget creates a widget for selecting a file or a folder. | |
const QgsExpressionContext & | expressionContext () const |
Returns expression context used for storage url expression evaluation. | |
QgsExternalStorage * | externalStorage () const |
Returns external storage used to store selected file names, nullptr if none have been defined. | |
QgsMessageBar * | messageBar () const |
Returns message bar used to report messages. | |
void | setExpressionContext (const QgsExpressionContext &context) |
Set expression context to be used when for storage URL expression evaluation. | |
void | setMessageBar (QgsMessageBar *messageBar) |
Set messageBar to report messages. | |
void | setReadOnly (bool readOnly) override |
Sets whether the widget should be read only. | |
void | setStorageAuthConfigId (const QString &authCfg) |
Sets the authentication configuration ID to be used for the current external storage (if defined) | |
void | setStorageType (const QString &storageType) |
Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QString if there is no storage defined. | |
void | setStorageUrlExpression (const QString &urlExpression) |
Set urlExpression expression, which once evaluated, provide the URL used to store selected documents. | |
const QString & | storageAuthConfigId () const |
Returns the authentication configuration ID used for the current external storage (if defined) | |
QString | storageType () const |
Returns storage type unique identifier as defined in QgsExternalStorageRegistry. | |
QgsExpression * | storageUrlExpression () const |
Returns expression, which once evaluated, provide the URL used to store selected documents. | |
QString | storageUrlExpressionString () const |
Returns the original, unmodified expression string, which once evaluated, provide the URL used to store selected documents. | |
Public Member Functions inherited from QgsFileWidget | |
QgsFileWidget (QWidget *parent=nullptr) | |
QgsFileWidget creates a widget for selecting a file or a folder. | |
bool | confirmOverwrite () const |
Returns whether a confirmation will be shown when overwriting an existing file. | |
QString | defaultRoot () const |
Returns the default root path. | |
QString | dialogTitle () const |
Returns the open file dialog title. | |
QString | filePath () |
Returns the current file path(s). | |
bool | fileWidgetButtonVisible () const |
Returns true if the tool button is shown. | |
QString | filter () const |
returns the filters used for QDialog::getOpenFileName | |
bool | fullUrl () const |
Returns true if the links shown use the full path. | |
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. | |
QSize | minimumSizeHint () const override |
QFileDialog::Options | options () const |
Returns the additional options used for QFileDialog. | |
QgsFileWidget::RelativeStorage | relativeStorage () const |
Returns if the relative path is with respect to the project path or the default path. | |
QString | selectedFilter () const |
Returns the selected filter from the last opened file dialog. | |
void | setConfirmOverwrite (bool confirmOverwrite) |
Sets whether a confirmation to overwrite an existing file will appear. | |
void | setDefaultRoot (const QString &defaultRoot) |
Returns the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath. | |
void | setDialogTitle (const QString &title) |
Sets the title to use for the open file dialog. | |
void | setFilePath (const QString &path) |
Sets the current file path. | |
void | setFileWidgetButtonVisible (bool visible) |
Sets whether the tool button is visible. | |
void | setFilter (const QString &filter) |
setFilter sets the filter used by the model to filters. | |
void | setFullUrl (bool fullUrl) |
Sets whether links shown use the full path. | |
void | setOptions (QFileDialog::Options options) |
Set additional options used for QFileDialog. | |
void | setRelativeStorage (QgsFileWidget::RelativeStorage relativeStorage) |
Sets whether the relative path is with respect to the project path or the default path. | |
void | setSelectedFilter (const QString &selectedFilter) |
Sets the selected filter when the file dialog opens. | |
void | setStorageMode (QgsFileWidget::StorageMode storageMode) |
Sets the widget's storage mode (i.e. | |
void | setUseLink (bool useLink) |
Sets whether the file path will be shown as a link. | |
QgsFileWidget::StorageMode | storageMode () const |
Returns the widget's storage mode (i.e. | |
bool | useLink () const |
Returns true if the file path will be shown as a link. | |
Static Public Member Functions | |
static QgsExpressionContextScope * | createFileWidgetScope () |
Creates and Returns an expression context scope specific to QgsExternalStorageFileWidget It defines the variable containing the user selected file name. | |
Static Public Member Functions inherited from QgsFileWidget | |
static QStringList | splitFilePaths (const QString &path) |
Split the the quoted and space separated path and returns a list of strings. | |
Protected Member Functions | |
void | addFileWidgetScope () |
Add file widget specific scope to expression context. | |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dropEvent (QDropEvent *event) override |
void | setSelectedFileNames (QStringList fileNames) override |
Called whenever user select fileNames from dialog. | |
void | updateLayout () override |
Update buttons visibility. | |
Protected Member Functions inherited from QgsFileWidget | |
QString | relativePath (const QString &filePath, bool removeRelative) const |
Returns a filePath with relative path options applied (or not) ! | |
void | setFilePaths (const QStringList &filePaths) |
Update filePath according to filePaths list. | |
QString | toUrl (const QString &path) const |
returns a HTML code with a link to the given file path | |
Properties | |
QString | auth |
QString | storageType |
QString | storageUrlExpression |
Properties inherited from QgsFileWidget | |
QString | defaultRoot |
QString | dialogTitle |
bool | fileWidgetButtonVisible |
QString | filter |
bool | fullUrl |
QFileDialog::Options | options |
RelativeStorage | relativeStorage |
StorageMode | storageMode |
bool | useLink |
Friends | |
class | TestQgsExternalResourceWidgetWrapper |
class | TestQgsExternalStorageFileWidget |
Additional Inherited Members | |
Public Types inherited from QgsFileWidget | |
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 inherited from QgsFileWidget | |
void | fileChanged (const QString &path) |
Emitted whenever the current file or directory path is changed. | |
Static Protected Member Functions inherited from QgsFileWidget | |
static bool | isMultiFiles (const QString &path) |
Returns true if path is a multifiles. | |
Protected Attributes inherited from QgsFileWidget | |
bool | mButtonVisible = true |
bool | mConfirmOverwrite = true |
QString | mDefaultRoot |
QString | mDialogTitle |
QString | mFilePath |
QToolButton * | mFileWidgetButton = nullptr |
QString | mFilter |
bool | mFullUrl = false |
bool | mIsLinkEdited = false |
QHBoxLayout * | mLayout = nullptr |
QgsFileDropEdit * | mLineEdit = nullptr |
QToolButton * | mLinkEditButton = nullptr |
QLabel * | mLinkLabel = nullptr |
QFileDialog::Options | mOptions = QFileDialog::Options() |
bool | mReadOnly = false |
RelativeStorage | mRelativeStorage = Absolute |
QString | mSelectedFilter |
StorageMode | mStorageMode = GetFile |
bool | mUseLink = false |
The QgsExternalStorageFileWidget class creates a widget for selecting a file or a folder and stores it to a given external storage backend if defined.
Definition at line 40 of file qgsexternalstoragefilewidget.h.
|
explicit |
QgsExternalStorageFileWidget creates a widget for selecting a file or a folder.
Definition at line 37 of file qgsexternalstoragefilewidget.cpp.
|
protected |
Add file widget specific scope to expression context.
Definition at line 131 of file qgsexternalstoragefilewidget.cpp.
|
static |
Creates and Returns an expression context scope specific to QgsExternalStorageFileWidget It defines the variable containing the user selected file name.
Definition at line 140 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotected |
Definition at line 277 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotected |
Definition at line 290 of file qgsexternalstoragefilewidget.cpp.
const QgsExpressionContext & QgsExternalStorageFileWidget::expressionContext | ( | ) | const |
Returns expression context used for storage url expression evaluation.
Definition at line 150 of file qgsexternalstoragefilewidget.cpp.
QgsExternalStorage * QgsExternalStorageFileWidget::externalStorage | ( | ) | const |
Returns external storage used to store selected file names, nullptr if none have been defined.
If no external storage has been defined, QgsExternalStorageFileWidget will only update file path according to selected files.
Definition at line 93 of file qgsexternalstoragefilewidget.cpp.
QgsMessageBar * QgsExternalStorageFileWidget::messageBar | ( | ) | const |
Returns message bar used to report messages.
Definition at line 161 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setExpressionContext | ( | const QgsExpressionContext & | context | ) |
Set expression context to be used when for storage URL expression evaluation.
Definition at line 124 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setMessageBar | ( | QgsMessageBar * | messageBar | ) |
Set messageBar to report messages.
Definition at line 156 of file qgsexternalstoragefilewidget.cpp.
|
overridevirtual |
Sets whether the widget should be read only.
Reimplemented from QgsFileWidget.
Definition at line 77 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotectedvirtual |
Called whenever user select fileNames from dialog.
Reimplemented from QgsFileWidget.
Definition at line 185 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setStorageAuthConfigId | ( | const QString & | authCfg | ) |
Sets the authentication configuration ID to be used for the current external storage (if defined)
Definition at line 98 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setStorageType | ( | const QString & | storageType | ) |
Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QString if there is no storage defined.
If no external storage has been defined, QgsExternalStorageFileWidget will only update file path according to selected files.
Definition at line 56 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setStorageUrlExpression | ( | const QString & | urlExpression | ) |
Set urlExpression expression, which once evaluated, provide the URL used to store selected documents.
This is used only if an external storage has been defined
Definition at line 108 of file qgsexternalstoragefilewidget.cpp.
const QString & QgsExternalStorageFileWidget::storageAuthConfigId | ( | ) | const |
Returns the authentication configuration ID used for the current external storage (if defined)
Definition at line 103 of file qgsexternalstoragefilewidget.cpp.
QString QgsExternalStorageFileWidget::storageType | ( | ) | const |
Returns storage type unique identifier as defined in QgsExternalStorageRegistry.
Returns null QString if there is no storage defined, only file selection.
Definition at line 88 of file qgsexternalstoragefilewidget.cpp.
QgsExpression * QgsExternalStorageFileWidget::storageUrlExpression | ( | ) | const |
Returns expression, which once evaluated, provide the URL used to store selected documents.
This is used only if an external storage has been defined. Returns null if no expression has been set.
Definition at line 113 of file qgsexternalstoragefilewidget.cpp.
QString QgsExternalStorageFileWidget::storageUrlExpressionString | ( | ) | const |
Returns the original, unmodified expression string, which once evaluated, provide the URL used to store selected documents.
This is used only if an external storage has been defined. Returns null if no expression has been set.
Definition at line 118 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotectedvirtual |
Update buttons visibility.
Reimplemented from QgsFileWidget.
Definition at line 166 of file qgsexternalstoragefilewidget.cpp.
|
friend |
Definition at line 201 of file qgsexternalstoragefilewidget.h.
|
friend |
Definition at line 202 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 53 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 52 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 54 of file qgsexternalstoragefilewidget.h.