QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
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. More... | |
const QgsExpressionContext & | expressionContext () const |
Returns expression context used for storage url expression evaluation. More... | |
QgsExternalStorage * | externalStorage () const |
Returns external storage used to store selected file names, nullptr if none have been defined. More... | |
QgsMessageBar * | messageBar () const |
Returns message bar used to report messages. More... | |
void | setExpressionContext (const QgsExpressionContext &context) |
Set expression context to be used when for storage URL expression evaluation. More... | |
void | setMessageBar (QgsMessageBar *messageBar) |
Set messageBar to report messages. More... | |
void | setReadOnly (bool readOnly) override |
Sets whether the widget should be read only. More... | |
void | setStorageAuthConfigId (const QString &authCfg) |
Sets the authentication configuration ID to be used for the current external storage (if defined) More... | |
void | setStorageType (const QString &storageType) |
Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QString if there is no storage defined. More... | |
void | setStorageUrlExpression (const QString &urlExpression) |
Set urlExpression expression, which once evaluated, provide the URL used to store selected documents. More... | |
const QString & | storageAuthConfigId () const |
Returns the authentication configuration ID used for the current external storage (if defined) More... | |
QString | storageType () const |
Returns storage type unique identifier as defined in QgsExternalStorageRegistry. More... | |
QgsExpression * | storageUrlExpression () const |
Returns expression, which once evaluated, provide the URL used to store selected documents. More... | |
QString | storageUrlExpressionString () const |
Returns the original, unmodified expression string, which once evaluated, provide the URL used to store selected documents. More... | |
Public Member Functions inherited from QgsFileWidget | |
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). More... | |
bool | fileWidgetButtonVisible () const |
Returns true if the tool button is shown. More... | |
QString | filter () const |
returns the filters used for QDialog::getOpenFileName More... | |
bool | fullUrl () const |
Returns true if the links shown use the full path. 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 the 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) |
Returns 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) |
Sets the title to use for the open file dialog. More... | |
void | setFilePath (const QString &path) |
Sets the current file path. More... | |
void | setFileWidgetButtonVisible (bool visible) |
Sets whether the tool button is visible. More... | |
void | setFilter (const QString &filter) |
setFilter sets the filter used by the model to filters. More... | |
void | setFullUrl (bool fullUrl) |
Sets whether links shown use the full path. More... | |
void | setOptions (QFileDialog::Options options) |
Set additional options used for QFileDialog. More... | |
virtual void | setReadOnly (bool readOnly) |
Sets whether the widget should be read only. More... | |
void | setRelativeStorage (QgsFileWidget::RelativeStorage relativeStorage) |
Sets whether 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) |
Sets the widget's storage mode (i.e. More... | |
void | setUseLink (bool useLink) |
Sets whether the file path will be shown as a link. More... | |
QgsFileWidget::StorageMode | storageMode () const |
Returns the widget's storage mode (i.e. More... | |
bool | useLink () const |
Returns true if the file path will be shown as a link. More... | |
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. More... | |
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. More... | |
Protected Member Functions | |
void | addFileWidgetScope () |
Add file widget specific scope to expression context. More... | |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dropEvent (QDropEvent *event) override |
void | setSelectedFileNames (QStringList fileNames) override |
Called whenever user select fileNames from dialog. More... | |
void | updateLayout () override |
Update buttons visibility. More... | |
Protected Member Functions inherited from QgsFileWidget | |
QString | relativePath (const QString &filePath, bool removeRelative) const |
Returns a filePath with relative path options applied (or not) ! More... | |
void | setFilePaths (const QStringList &filePaths) |
Update filePath according to filePaths list. More... | |
virtual void | setSelectedFileNames (QStringList fileNames) |
Called whenever user select fileNames from dialog. More... | |
QString | toUrl (const QString &path) const |
returns a HTML code with a link to the given file path More... | |
virtual void | updateLayout () |
Update buttons visibility. More... | |
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. More... | |
Static Protected Member Functions inherited from QgsFileWidget | |
static bool | isMultiFiles (const QString &path) |
Returns true if path is a multifiles. More... | |
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 36 of file qgsexternalstoragefilewidget.cpp.
|
protected |
Add file widget specific scope to expression context.
Definition at line 130 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 139 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotected |
Definition at line 281 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotected |
Definition at line 294 of file qgsexternalstoragefilewidget.cpp.
const QgsExpressionContext & QgsExternalStorageFileWidget::expressionContext | ( | ) | const |
Returns expression context used for storage url expression evaluation.
Definition at line 148 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 92 of file qgsexternalstoragefilewidget.cpp.
QgsMessageBar * QgsExternalStorageFileWidget::messageBar | ( | ) | const |
Returns message bar used to report messages.
Definition at line 159 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 123 of file qgsexternalstoragefilewidget.cpp.
void QgsExternalStorageFileWidget::setMessageBar | ( | QgsMessageBar * | messageBar | ) |
Set messageBar to report messages.
Definition at line 154 of file qgsexternalstoragefilewidget.cpp.
|
overridevirtual |
Sets whether the widget should be read only.
Reimplemented from QgsFileWidget.
Definition at line 76 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 97 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 55 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 107 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 102 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 87 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 112 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 117 of file qgsexternalstoragefilewidget.cpp.
|
overrideprotectedvirtual |
Update buttons visibility.
Reimplemented from QgsFileWidget.
Definition at line 164 of file qgsexternalstoragefilewidget.cpp.
|
friend |
Definition at line 204 of file qgsexternalstoragefilewidget.h.
|
friend |
Definition at line 205 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 40 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 40 of file qgsexternalstoragefilewidget.h.
|
readwrite |
Definition at line 40 of file qgsexternalstoragefilewidget.h.