Class: QgsFileWidget¶
-
class
qgis.gui.
QgsFileWidget
(parent: QWidget = None)¶ Bases:
PyQt5.QtWidgets.QWidget
QgsFileWidget creates a widget for selecting a file or a folder.
The QgsFileWidget class creates a widget for selecting a file or a folder.
Enums
Methods
Returns whether a confirmation will be shown when overwriting an existing file
returns the default root path
returns the open file dialog title
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”’)
determines if the tool button is shown
returns the filters used for QDialog.getOpenFileName
returns if the links shows the full path or not
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.
returns if the relative path is with respect to the project path or the default path
Returns the selected filter from the last opened file dialog.
Sets whether a confirmation to overwrite an existing file will appear.
determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
setDialogTitle defines the open file dialog title
Sets the file path
determines if the tool button is shown
setFilter sets the filter used by the model to filters.
determines if the links shows the full path or not
defines if the widget is readonly
determines if the relative path is with respect to the project path or the default path
Sets the selected filter when the file dialog opens.
determines the storage mode (i.e.
determines if the file path will be shown as a link
Split the the quoted and space separated
path
and returns a QString listreturns the storage mode (i.e.
determines if the file path will be shown as a link
Signals
emitted as soon as the current file or directory is changed [signal]
Attributes
-
Absolute
= 0¶
-
GetDirectory
= 1¶
-
GetFile
= 0¶
-
GetMultipleFiles
= 2¶
-
RelativeDefaultPath
= 2¶
-
RelativeProject
= 1¶
-
class
RelativeStorage
¶ Bases:
int
-
SaveFile
= 3¶
-
class
StorageMode
¶ Bases:
int
-
actionEvent
()¶
-
changeEvent
()¶
-
childEvent
()¶
-
closeEvent
()¶
-
confirmOverwrite
(self) → bool¶ Returns whether a confirmation will be shown when overwriting an existing file
-
connectNotify
()¶
-
contextMenuEvent
()¶
-
create
()¶
-
customEvent
()¶
-
defaultRoot
(self) → str¶ returns the default root path
-
destroy
()¶
-
dialogTitle
(self) → str¶ returns the open file dialog title
-
disconnectNotify
()¶
-
dragEnterEvent
()¶
-
dragLeaveEvent
()¶
-
dragMoveEvent
()¶
-
dropEvent
()¶
-
enterEvent
()¶
-
event
()¶
-
fileChanged
¶ emitted as soon as the current file or directory is changed [signal]
-
filePath
(self) → str¶ 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”’)
See also
-
fileWidgetButtonVisible
(self) → bool¶ determines if the tool button is shown
-
filter
(self) → str¶ returns the filters used for QDialog.getOpenFileName
-
focusInEvent
()¶
-
focusNextChild
()¶
-
focusNextPrevChild
()¶
-
focusOutEvent
()¶
-
focusPreviousChild
()¶
-
fullUrl
(self) → bool¶ returns if the links shows the full path or not
-
hideEvent
()¶
-
initPainter
()¶
-
inputMethodEvent
()¶
-
isSignalConnected
()¶
-
keyPressEvent
()¶
-
keyReleaseEvent
()¶
-
leaveEvent
()¶
-
lineEdit
(self) → QgsFilterLineEdit¶ 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.
New in version 3.0.
-
metric
()¶
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
()¶
-
mousePressEvent
()¶
-
mouseReleaseEvent
()¶
-
moveEvent
()¶
-
nativeEvent
()¶
-
paintEvent
()¶
-
receivers
()¶
-
relativeStorage
(self) → QgsFileWidget.RelativeStorage¶ returns if the relative path is with respect to the project path or the default path
-
resizeEvent
()¶
-
selectedFilter
(self) → str¶ Returns the selected filter from the last opened file dialog.
-
sender
()¶
-
senderSignalIndex
()¶
-
setConfirmOverwrite
(self, confirmOverwrite: bool)¶ Sets whether a confirmation to overwrite an existing file will appear. By default, a confirmation will appear.
- Parameters
confirmOverwrite – If set to true, an overwrite confirmation will be shown
-
setDefaultRoot
(self, defaultRoot: str)¶ determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
-
setDialogTitle
(self, title: str)¶ setDialogTitle defines the open file dialog title
Note
if not defined, the title is “Select a file” or “Select a directory” or “Select one or more files” depending on the configuration.
-
setFilePath
(self, path: str)¶ Sets the file path
-
setFileWidgetButtonVisible
(self, visible: bool)¶ determines if the tool button is shown
-
setFilter
(self, filter: str)¶ setFilter sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.
- Parameters
filter – Only files that match the given filter are shown, it may be an empty string. If you want multiple filters, separate them with ‘;;’,
-
setFullUrl
(self, fullUrl: bool)¶ determines if the links shows the full path or not
-
setReadOnly
(self, readOnly: bool)¶ defines if the widget is readonly
-
setRelativeStorage
(self, relativeStorage: QgsFileWidget.RelativeStorage)¶ determines if the relative path is with respect to the project path or the default path
-
setSelectedFilter
(self, selectedFilter: str)¶ Sets the selected filter when the file dialog opens.
-
setStorageMode
(self, storageMode: QgsFileWidget.StorageMode)¶ determines the storage mode (i.e. file or directory)
-
setUseLink
(self, useLink: bool)¶ determines if the file path will be shown as a link
-
showEvent
()¶
-
splitFilePaths
(path: str) → List[str]¶ Split the the quoted and space separated
path
and returns a QString listSee also
-
storageMode
(self) → QgsFileWidget.StorageMode¶ returns the storage mode (i.e. file or directory)
-
tabletEvent
()¶
-
timerEvent
()¶
-
updateMicroFocus
()¶
-
useLink
(self) → bool¶ determines if the file path will be shown as a link
-
wheelEvent
()¶
-