Class: QgsExternalResourceWidget

class qgis.gui.QgsExternalResourceWidget

Bases: PyQt5.QtWidgets.QWidget

Widget to display file path with a push button for an “open file” dialog It can also be used to display a picture or a web page.

QgsExternalResourceWidget(parent: Optional[QWidget] = None) QgsExternalResourceWidget creates a widget with a file widget and a document viewer Both part of the widget are optional.

See also

QgsFileWidget

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

defaultRoot

Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget.RelativeDefaultPath.

destroy

disconnectNotify

documentPath

documentPath returns the path of the current document in the widget

documentViewerContent

returns the type of content used in the document viewer

documentViewerHeight

returns the height of the document viewer

documentViewerWidth

returns the width of the document viewer

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

fileWidget

Returns file widget to allow its configuration

fileWidgetVisible

returns if the file widget is visible in the widget

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

messageBar

Returns message bar used to report messages

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

relativeStorage

Configures if paths are handled absolute or relative and if relative, which should be the base path.

resizeEvent

sender

senderSignalIndex

setDefaultRoot

Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget.RelativeDefaultPath.

setDocumentPath

param documentPath:

setDocumentViewerContent

setDocumentViewerContent defines the type of content to be shown.

setDocumentViewerHeight

setDocumentViewerWidth set the height of the document viewer.

setDocumentViewerWidth

setDocumentViewerWidth set the width of the document viewer.

setFileWidgetVisible

Sets the visibility of the file widget in the layout

setMessageBar

Set messageBar to report messages

setReadOnly

defines if the widget is readonly

setRelativeStorage

Configures if paths are handled absolute or relative and if relative, which should be the base path.

setStorageAuthConfigId

Sets the authentication configuration ID to be used for the current external storage (if defined)

setStorageType

Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QString if there is no storage defined, only file selection.

sharedPainter

showEvent

storageAuthConfigId

Returns the authentication configuration ID used for the current external storage (if defined)

storageType

Returns storage type unique identifier as defined in QgsExternalStorageRegistry.

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

valueChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

Attributes

Audio

Image

NoContent

Video

Web

Audio = 3
class DocumentViewerContent

Bases: int

Image = 1
NoContent = 0
Video = 4
Web = 2
actionEvent(self, a0: QActionEvent | None)
changeEvent(self, a0: QEvent | None)
childEvent(self, a0: QChildEvent | None)
closeEvent(self, a0: QCloseEvent | None)
connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, a0: QContextMenuEvent | None)
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, a0: QEvent | None)
defaultRoot(self) str

Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget.RelativeDefaultPath.

Return type:

str

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, signal: QMetaMethod)
documentPath(self, type: QMetaType.Type = QMetaType.Type.QString) Any

documentPath returns the path of the current document in the widget

Parameters:

type (QMetaType.Type = QMetaType.Type.QString) – determines the type of the returned null variant if the document is not defined yet

documentPath(self, type: QVariant.Type) -> Any documentPath returns the path of the current document in the widget

Parameters:

type – determines the type of the returned null variant if the document is not defined yet

Deprecated since version QGIS: 3.38 use the method with a QMetaType.Type argument instead

Return type:

Any

documentViewerContent(self) QgsExternalResourceWidget.DocumentViewerContent

returns the type of content used in the document viewer

Return type:

QgsExternalResourceWidget.DocumentViewerContent

documentViewerHeight(self) int

returns the height of the document viewer

Return type:

int

documentViewerWidth(self) int

returns the width of the document viewer

Return type:

int

dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)
enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
fileWidget(self) QgsExternalStorageFileWidget | None

Returns file widget to allow its configuration

Return type:

Optional[QgsExternalStorageFileWidget]

fileWidgetVisible(self) bool

returns if the file widget is visible in the widget

Return type:

bool

focusInEvent(self, a0: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, a0: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, a0: QHideEvent | None)
initPainter(self, painter: QPainter | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
keyPressEvent(self, a0: QKeyEvent | None)
keyReleaseEvent(self, a0: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
messageBar(self) QgsMessageBar | None

Returns message bar used to report messages

Added in version 3.22.

Return type:

Optional[QgsMessageBar]

metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
paintEvent(self, a0: QPaintEvent | None)
receivers(self, signal: PYQT_SIGNAL) int
relativeStorage(self) QgsFileWidget.RelativeStorage

Configures if paths are handled absolute or relative and if relative, which should be the base path.

Return type:

QgsFileWidget.RelativeStorage

resizeEvent(self, a0: QResizeEvent | None)
sender(self) QObject | None
senderSignalIndex(self) int
setDefaultRoot(self, defaultRoot: str | None)

Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget.RelativeDefaultPath.

Parameters:

defaultRoot (Optional[str])

setDocumentPath(self, documentPath: Any)
Parameters:

documentPath (Any)

setDocumentViewerContent(self, content: QgsExternalResourceWidget.DocumentViewerContent)

setDocumentViewerContent defines the type of content to be shown. Widget will be adapted accordingly

Parameters:

content (QgsExternalResourceWidget.DocumentViewerContent)

setDocumentViewerHeight(self, height: int)

setDocumentViewerWidth set the height of the document viewer.

Parameters:

height (int) – the height. Use 0 for automatic best display.

setDocumentViewerWidth(self, width: int)

setDocumentViewerWidth set the width of the document viewer.

Parameters:

width (int) – the width. Use 0 for automatic best display.

setFileWidgetVisible(self, visible: bool)

Sets the visibility of the file widget in the layout

Parameters:

visible (bool)

setMessageBar(self, messageBar: QgsMessageBar | None)

Set messageBar to report messages

Added in version 3.22.

Parameters:

messageBar (Optional[QgsMessageBar])

setReadOnly(self, readOnly: bool)

defines if the widget is readonly

Parameters:

readOnly (bool)

setRelativeStorage(self, relativeStorage: QgsFileWidget.RelativeStorage)

Configures if paths are handled absolute or relative and if relative, which should be the base path.

Parameters:

relativeStorage (QgsFileWidget.RelativeStorage)

setStorageAuthConfigId(self, authCfg: str | None)

Sets the authentication configuration ID to be used for the current external storage (if defined)

Added in version 3.22.

Parameters:

authCfg (Optional[str])

setStorageType(self, storageType: str | None)

Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QString if there is no storage defined, only file selection.

See also

storageType()

Added in version 3.22.

Parameters:

storageType (Optional[str])

sharedPainter(self) QPainter | None
showEvent(self, a0: QShowEvent | None)
storageAuthConfigId(self) str

Returns the authentication configuration ID used for the current external storage (if defined)

Added in version 3.22.

Return type:

str

storageType(self) str

Returns storage type unique identifier as defined in QgsExternalStorageRegistry. Returns null QString if there is no storage defined, only file selection.

See also

setStorageType()

Added in version 3.22.

Return type:

str

tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, a0: QTimerEvent | None)
updateMicroFocus(self)
valueChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

wheelEvent(self, a0: QWheelEvent | None)