Subgroup: File
Class: QgsFileWidget¶
-
class
qgis.gui.
QgsFileWidget
¶ Bases:
PyQt5.QtWidgets.QWidget
The QgsFileWidget class creates a widget for selecting a file or a folder.
Methods
acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
autoFillBackground
backgroundRole
baseSize
blockSignals
changeEvent
childAt
childAt(self, int, int) -> QWidget childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
close
closeEvent
colorCount
confirmOverwrite
Returns whether a confirmation will be shown when overwriting an existing file connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createWindowContainer
cursor
customEvent
defaultRoot
returns the default root path deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
dialogTitle
returns the open file dialog title disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
filePath
Returns the current file path(s) fileWidgetButtonVisible
determines if the tool button is shown filter
returns the filters used for QDialog.getOpenFileName find
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
fullUrl
returns if the links shows the full path or not geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse
grabMouse(self, Union[QCursor, Qt.CursorShape]) grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
inherits
initPainter
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
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. locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maximumHeight
maximumSize
maximumWidth
metaObject
metric
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move
move(self, int, int) moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
pos
previousInFocusChain
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. raise_
receivers
rect
relativeStorage
returns if the relative path is with respect to the project path or the default path releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render
render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren)) repaint
repaint(self, int, int, int, int) resize
resize(self, int, int) resizeEvent
restoreGeometry
saveGeometry
scroll
scroll(self, int, int, QRect) selectedFilter
Returns the selected filter from the last opened file dialog. sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize
setBaseSize(self, QSize) setConfirmOverwrite
Sets whether a confirmation to overwrite an existing file will appear. setContentsMargins
setContentsMargins(self, QMargins) setContextMenuPolicy
setCursor
setDefaultRoot
determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath setDialogTitle
setDialogTitle defines the open file dialog title setDisabled
setEnabled
setFilePath
Sets the file path setFileWidgetButtonVisible
determines if the tool button is shown setFilter
setFilter sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown. setFixedHeight
setFixedSize
setFixedSize(self, int, int) setFixedWidth
setFocus
setFocus(self, Qt.FocusReason) setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFullUrl
determines if the links shows the full path or not setGeometry
setGeometry(self, int, int, int, int) setGraphicsEffect
setHidden
setInputMethodHints
setLayout
setLayoutDirection
setLocale
setMask
setMask(self, QRegion) setMaximumHeight
setMaximumSize
setMaximumSize(self, QSize) setMaximumWidth
setMinimumHeight
setMinimumSize
setMinimumSize(self, QSize) setMinimumWidth
setMouseTracking
setObjectName
setPalette
setParent
setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType]) setProperty
setReadOnly
defines if the widget is readonly setRelativeStorage
determines if the relative path is with respect to the project path or the default path setSelectedFilter
Sets the selected filter when the file dialog opens. setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement
setSizeIncrement(self, QSize) setSizePolicy
setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy) setStatusTip
setStorageMode
determines the storage mode (i.e. file or directory) setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setUseLink
determines if the file path will be shown as a link setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
splitFilePaths
Split the the quoted and space separated path
and returns a QString liststackUnder
startTimer
statusTip
storageMode
returns the storage mode (i.e. file or directory) style
styleSheet
tabletEvent
testAttribute
thread
timerEvent
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update
update(self, QRect) updateGeometry
updateMicroFocus
updatesEnabled
useLink
determines if the file path will be shown as a link visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y
Attributes
Absolute
DrawChildren
DrawWindowBackground
GetDirectory
GetFile
GetMultipleFiles
IgnoreMask
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
RelativeDefaultPath
RelativeProject
SaveFile
customContextMenuRequested
customContextMenuRequested(self, QPoint) [signal] destroyed
destroyed(self, QObject = None) [signal] fileChanged
emitted as soon as the current file or directory is changed [signal] objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
windowIconChanged
windowIconChanged(self, QIcon) [signal] windowIconTextChanged
windowIconTextChanged(self, str) [signal] windowTitleChanged
windowTitleChanged(self, str) [signal] -
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
filePaths()
-
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
()¶
-