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.- Parameters
parent –
-
Absolute
= 0¶
-
GetDirectory
= 1¶
-
GetFile
= 0¶
-
GetMultipleFiles
= 2¶
-
RelativeDefaultPath
= 2¶
-
RelativeProject
= 1¶
-
class
RelativeStorage
¶ Bases:
int
-
baseClass
¶ alias of
QgsFileWidget
-
-
SaveFile
= 3¶
-
class
StorageMode
¶ Bases:
int
-
baseClass
¶ alias of
QgsFileWidget
-
-
actionEvent
(self, QActionEvent)¶
-
changeEvent
(self, QEvent)¶
-
childEvent
(self, QChildEvent)¶
-
closeEvent
(self, QCloseEvent)¶
-
confirmOverwrite
(self) → bool¶ Returns whether a confirmation will be shown when overwriting an existing file
- Return type
bool
-
connectNotify
(self, QMetaMethod)¶
-
contextMenuEvent
(self, QContextMenuEvent)¶
-
create
(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
-
customEvent
(self, QEvent)¶
-
defaultRoot
(self) → str¶ returns the default root path
- Return type
str
-
destroy
(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
-
dialogTitle
(self) → str¶ returns the open file dialog title
- Return type
str
-
disconnectNotify
(self, QMetaMethod)¶
-
dragEnterEvent
(self, QDragEnterEvent)¶
-
dragLeaveEvent
(self, QDragLeaveEvent)¶
-
dragMoveEvent
(self, QDragMoveEvent)¶
-
dropEvent
(self, QDropEvent)¶
-
enterEvent
(self, QEvent)¶
-
event
(self, QEvent) → bool¶
-
fileChanged
¶ Emitted whenever the current file or directory
path
is changed. [signal]- Parameters
path (str) –
-
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
- Return type
str
-
fileWidgetButtonVisible
(self) → bool¶ determines if the tool button is shown
- Return type
bool
-
filter
(self) → str¶ returns the filters used for QDialog.getOpenFileName
- Return type
str
-
focusInEvent
(self, QFocusEvent)¶
-
focusNextChild
(self) → bool¶
-
focusNextPrevChild
(self, bool) → bool¶
-
focusOutEvent
(self, QFocusEvent)¶
-
focusPreviousChild
(self) → bool¶
-
fullUrl
(self) → bool¶ returns if the links shows the full path or not
- Return type
bool
-
hideEvent
(self, QHideEvent)¶
-
initPainter
(self, QPainter)¶
-
inputMethodEvent
(self, QInputMethodEvent)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
keyPressEvent
(self, QKeyEvent)¶
-
keyReleaseEvent
(self, QKeyEvent)¶
-
leaveEvent
(self, QEvent)¶
-
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.
- Return type
-
metric
(self, QPaintDevice.PaintDeviceMetric) → int¶
-
mouseDoubleClickEvent
(self, QMouseEvent)¶
-
mouseMoveEvent
(self, QMouseEvent)¶
-
mousePressEvent
(self, QMouseEvent)¶
-
mouseReleaseEvent
(self, QMouseEvent)¶
-
moveEvent
(self, QMoveEvent)¶
-
nativeEvent
(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]¶
-
paintEvent
(self, QPaintEvent)¶
-
receivers
(self, PYQT_SIGNAL) → int¶
-
relativeStorage
(self) → QgsFileWidget.RelativeStorage¶ returns if the relative path is with respect to the project path or the default path
- Return type
-
resizeEvent
(self, QResizeEvent)¶
-
selectedFilter
(self) → str¶ Returns the selected filter from the last opened file dialog.
- Return type
str
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setConfirmOverwrite
(self, confirmOverwrite: bool)¶ Sets whether a confirmation to overwrite an existing file will appear. By default, a confirmation will appear.
- Parameters
confirmOverwrite (bool) – 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
- Parameters
defaultRoot (str) –
-
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.
- Parameters
title (str) –
-
setFilePath
(self, path: str)¶ Sets the file path
- Parameters
path (str) –
-
setFileWidgetButtonVisible
(self, visible: bool)¶ determines if the tool button is shown
- Parameters
visible (bool) –
-
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 (str) – 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
- Parameters
fullUrl (bool) –
-
setReadOnly
(self, readOnly: bool)¶ defines if the widget is readonly
- Parameters
readOnly (bool) –
-
setRelativeStorage
(self, relativeStorage: QgsFileWidget.RelativeStorage)¶ determines if the relative path is with respect to the project path or the default path
- Parameters
relativeStorage (QgsFileWidget.RelativeStorage) –
-
setSelectedFilter
(self, selectedFilter: str)¶ Sets the selected filter when the file dialog opens.
- Parameters
selectedFilter (str) –
-
setStorageMode
(self, storageMode: QgsFileWidget.StorageMode)¶ determines the storage mode (i.e. file or directory)
- Parameters
storageMode (QgsFileWidget.StorageMode) –
-
setUseLink
(self, useLink: bool)¶ determines if the file path will be shown as a link
- Parameters
useLink (bool) –
-
showEvent
(self, QShowEvent)¶
-
splitFilePaths
(path: str) → List[str]¶ Split the the quoted and space separated
path
and returns a QString listSee also
- Parameters
path (str) –
- Return type
List[str]
-
storageMode
(self) → QgsFileWidget.StorageMode¶ returns the storage mode (i.e. file or directory)
- Return type
-
tabletEvent
(self, QTabletEvent)¶
-
timerEvent
(self, QTimerEvent)¶
-
updateMicroFocus
(self)¶
-
useLink
(self) → bool¶ determines if the file path will be shown as a link
- Return type
bool
-
wheelEvent
(self, QWheelEvent)¶