QgsExternalResourceWidget class

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.

Constructors, destructors, conversion operators

QgsExternalResourceWidget(QWidget* parent = nullptr) explicit
QgsExternalResourceWidget creates a widget with a file widget and a document viewer Both part of the widget are optional.

Public functions

auto defaultRoot() const -> QString
Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget::RelativeDefaultPath.
auto documentPath(QVariant::Type type = QVariant::String) const -> QVariant
documentPath returns the path of the current document in the widget
auto documentViewerContent() const -> QgsExternalResourceWidget::DocumentViewerContent
returns the type of content used in the document viewer
auto documentViewerHeight() const -> int
returns the height of the document viewer
auto documentViewerWidth() const -> int
returns the width of the document viewer
auto fileWidget() -> QgsFileWidget*
access the file widget to allow its configuration
auto fileWidgetVisible() const -> bool
returns if the file widget is visible in the widget
auto relativeStorage() const -> QgsFileWidget::RelativeStorage
Configures if paths are handled absolute or relative and if relative, which should be the base path.
void setDefaultRoot(const QString& defaultRoot)
Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget::RelativeDefaultPath.
void setDocumentViewerContent(QgsExternalResourceWidget::DocumentViewerContent content)
setDocumentViewerContent defines the type of content to be shown. Widget will be adapted accordingly
void setDocumentViewerHeight(int height)
setDocumentViewerWidth set the height of the document viewer.
void setDocumentViewerWidth(int width)
setDocumentViewerWidth set the width of the document viewer.
void setFileWidgetVisible(bool visible)
Sets the visiblity of the file widget in the layout.
void setReadOnly(bool readOnly)
defines if the widget is readonly
void setRelativeStorage(QgsFileWidget::RelativeStorage relativeStorage)
Configures if paths are handled absolute or relative and if relative, which should be the base path.

Signals

void valueChanged(const QString&)
emitteed as soon as the current document changes

Function documentation

QgsExternalResourceWidget::QgsExternalResourceWidget(QWidget* parent = nullptr) explicit

QgsExternalResourceWidget creates a widget with a file widget and a document viewer Both part of the widget are optional.

QVariant QgsExternalResourceWidget::documentPath(QVariant::Type type = QVariant::String) const

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

void QgsExternalResourceWidget::setDocumentViewerHeight(int height)

setDocumentViewerWidth set the height of the document viewer.

Parameters
height the height. Use 0 for automatic best display.

void QgsExternalResourceWidget::setDocumentViewerWidth(int width)

setDocumentViewerWidth set the width of the document viewer.

Parameters
width the width. Use 0 for automatic best display.