QGIS API Documentation  3.17.0-Master (57c5a6fc26)
Signals | Public Member Functions | List of all members
QgsDataSourceSelectWidget Class Reference

The QgsDataSourceSelectWidget class embeds the browser view to select an existing data source. More...

#include <qgsdatasourceselectdialog.h>

Inheritance diagram for QgsDataSourceSelectWidget:
Inheritance graph
[legend]

Signals

void itemTriggered (const QgsMimeDataUtils::Uri &uri)
 Emitted when an item is triggered, e.g. More...
 
void selectionChanged ()
 Emitted when the current selection changes in the widget. More...
 
void validationChanged (bool isValid)
 This signal is emitted whenever the validation status of the widget changes. More...
 
- Signals inherited from QgsPanelWidget
void panelAccepted (QgsPanelWidget *panel)
 Emitted when the panel is accepted by the user. More...
 
void showPanel (QgsPanelWidget *panel)
 Emit when you require a panel to be show in the interface. More...
 
void widgetChanged ()
 Emitted when the widget state changes. More...
 

Public Member Functions

 QgsDataSourceSelectWidget (QgsBrowserGuiModel *browserModel=nullptr, bool setFilterByLayerType=false, QgsMapLayerType layerType=QgsMapLayerType::VectorLayer, QWidget *parent=nullptr)
 Constructs a QgsDataSourceSelectWidget, optionally filtering by layer type. More...
 
 ~QgsDataSourceSelectWidget () override
 
void setCaseSensitive (bool caseSensitive)
 Sets filter case sensitivity. More...
 
void setDescription (const QString &description)
 Sets a description label. More...
 
void setFilter ()
 Apply filter to the model. More...
 
void setFilterSyntax (QAction *)
 Sets filter syntax. More...
 
void setLayerTypeFilter (QgsMapLayerType layerType)
 Sets layer type filter to layerType and activates the filtering. More...
 
void showEvent (QShowEvent *e) override
 Scroll to last selected index and expand it's children. More...
 
void showFilterWidget (bool visible)
 Show/hide filter widget. More...
 
QgsMimeDataUtils::Uri uri () const
 Returns the (possibly invalid) uri of the selected data source. More...
 
- Public Member Functions inherited from QgsPanelWidget
 QgsPanelWidget (QWidget *parent=nullptr)
 Base class for any widget that can be shown as a inline panel. More...
 
bool autoDelete ()
 The the auto delete property on the widget. More...
 
void connectChildPanel (QgsPanelWidget *panel)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user. More...
 
void connectChildPanels (const QList< QgsPanelWidget *> &panels)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user. More...
 
bool dockMode ()
 Returns the dock mode state. More...
 
virtual QMenu * menuButtonMenu ()
 Returns the menu to use for the menu button for this panel, or nullptr if no menu button is required. More...
 
virtual QString menuButtonTooltip () const
 Returns the (translated) tooltip text to use for the menu button for this panel. More...
 
QString panelTitle ()
 The title of the panel. More...
 
void setAutoDelete (bool autoDelete)
 The the auto delete property on the widget. More...
 
virtual void setDockMode (bool dockMode)
 Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs. More...
 
void setPanelTitle (const QString &panelTitle)
 Set the title of the panel when shown in the interface. More...
 

Additional Inherited Members

- Public Slots inherited from QgsPanelWidget
void acceptPanel ()
 Accept the panel. More...
 
void openPanel (QgsPanelWidget *panel)
 Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the showPanel signal for connected slots to handle the open event. More...
 
- Static Public Member Functions inherited from QgsPanelWidget
static QgsPanelWidgetfindParentPanel (QWidget *widget)
 Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget. More...
 
- Protected Member Functions inherited from QgsPanelWidget
void keyPressEvent (QKeyEvent *event) override
 Overridden key press event to handle the esc event on the widget. More...
 

Detailed Description

The QgsDataSourceSelectWidget class embeds the browser view to select an existing data source.

By default any layer type can be chosen, the valid layer type can be restricted by setting a layer type filter with setLayerTypeFilter(layerType) or by activating the filter directly from the constructor.

To retrieve the selected data source, uri() can be called and it will return a (possibly invalid) QgsMimeDataUtils::Uri.

Since
QGIS 3.14

Definition at line 46 of file qgsdatasourceselectdialog.h.

Constructor & Destructor Documentation

◆ QgsDataSourceSelectWidget()

QgsDataSourceSelectWidget::QgsDataSourceSelectWidget ( QgsBrowserGuiModel browserModel = nullptr,
bool  setFilterByLayerType = false,
QgsMapLayerType  layerType = QgsMapLayerType::VectorLayer,
QWidget *  parent = nullptr 
)

Constructs a QgsDataSourceSelectWidget, optionally filtering by layer type.

Parameters
browserModelan existing browser model (typically from app), if nullptr an instance will be created
setFilterByLayerTypeactivates filtering by layer type
layerTypesets the layer type filter, this is in effect only if filtering by layer type is also active
parentthe object

Definition at line 31 of file qgsdatasourceselectdialog.cpp.

◆ ~QgsDataSourceSelectWidget()

QgsDataSourceSelectWidget::~QgsDataSourceSelectWidget ( )
overridedefault

Member Function Documentation

◆ itemTriggered

void QgsDataSourceSelectWidget::itemTriggered ( const QgsMimeDataUtils::Uri uri)
signal

Emitted when an item is triggered, e.g.

via a double-click.

◆ selectionChanged

void QgsDataSourceSelectWidget::selectionChanged ( )
signal

Emitted when the current selection changes in the widget.

◆ setCaseSensitive()

void QgsDataSourceSelectWidget::setCaseSensitive ( bool  caseSensitive)

Sets filter case sensitivity.

Definition at line 256 of file qgsdatasourceselectdialog.cpp.

◆ setDescription()

void QgsDataSourceSelectWidget::setDescription ( const QString &  description)

Sets a description label.

Parameters
descriptiona description string
Note
the description will be displayed at the bottom of the dialog
Since
3.8

Definition at line 158 of file qgsdatasourceselectdialog.cpp.

◆ setFilter()

void QgsDataSourceSelectWidget::setFilter ( )

Apply filter to the model.

Definition at line 192 of file qgsdatasourceselectdialog.cpp.

◆ setFilterSyntax()

void QgsDataSourceSelectWidget::setFilterSyntax ( QAction *  action)

Sets filter syntax.

Definition at line 249 of file qgsdatasourceselectdialog.cpp.

◆ setLayerTypeFilter()

void QgsDataSourceSelectWidget::setLayerTypeFilter ( QgsMapLayerType  layerType)

Sets layer type filter to layerType and activates the filtering.

Definition at line 261 of file qgsdatasourceselectdialog.cpp.

◆ showEvent()

void QgsDataSourceSelectWidget::showEvent ( QShowEvent *  e)
override

Scroll to last selected index and expand it's children.

Definition at line 118 of file qgsdatasourceselectdialog.cpp.

◆ showFilterWidget()

void QgsDataSourceSelectWidget::showFilterWidget ( bool  visible)

Show/hide filter widget.

Definition at line 143 of file qgsdatasourceselectdialog.cpp.

◆ uri()

QgsMimeDataUtils::Uri QgsDataSourceSelectWidget::uri ( ) const

Returns the (possibly invalid) uri of the selected data source.

Definition at line 270 of file qgsdatasourceselectdialog.cpp.

◆ validationChanged

void QgsDataSourceSelectWidget::validationChanged ( bool  isValid)
signal

This signal is emitted whenever the validation status of the widget changes.

Parameters
isValidtrue if the current status of the widget is valid

The documentation for this class was generated from the following files: