QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
void selectionChanged ()
 Emitted when the current selection changes in the widget.
 
void validationChanged (bool isValid)
 This signal is emitted whenever the validation status of the widget changes.
 
- Signals inherited from QgsPanelWidget
void panelAccepted (QgsPanelWidget *panel)
 Emitted when the panel is accepted by the user.
 
void showPanel (QgsPanelWidget *panel)
 Emit when you require a panel to be show in the interface.
 
void widgetChanged ()
 Emitted when the widget state changes.
 

Public Member Functions

 QgsDataSourceSelectWidget (QgsBrowserGuiModel *browserModel=nullptr, bool setFilterByLayerType=false, Qgis::LayerType layerType=Qgis::LayerType::Vector, QWidget *parent=nullptr)
 Constructs a QgsDataSourceSelectWidget, optionally filtering by layer type.
 
 ~QgsDataSourceSelectWidget () override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
void expandPath (const QString &path, bool selectPath=false)
 Expands out a file path in the view.
 
void setCaseSensitive (bool caseSensitive)
 Sets filter case sensitivity.
 
void setDescription (const QString &description)
 Sets a description label.
 
void setFilter ()
 Apply filter to the model.
 
void setFilterSyntax (QAction *)
 Sets filter syntax.
 
void setLayerTypeFilter (Qgis::LayerType layerType)
 Sets layer type filter to layerType and activates the filtering.
 
void showEvent (QShowEvent *e) override
 Scroll to last selected index and expand it's children.
 
void showFilterWidget (bool visible)
 Show/hide filter widget.
 
QgsMimeDataUtils::Uri uri () const
 Returns the (possibly invalid) uri of the selected data source.
 
- Public Member Functions inherited from QgsPanelWidget
 QgsPanelWidget (QWidget *parent=nullptr)
 Base class for any widget that can be shown as a inline panel.
 
virtual bool applySizeConstraintsToStack () const
 Returns true if the size constraints and hints for the panel widget should be applied to the parent QgsPanelWidgetStack which this panel is shown in.
 
bool autoDelete ()
 The the auto delete property on the widget.
 
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.
 
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.
 
bool dockMode ()
 Returns the dock mode state.
 
virtual QMenu * menuButtonMenu ()
 Returns the menu to use for the menu button for this panel, or nullptr if no menu button is required.
 
virtual QString menuButtonTooltip () const
 Returns the (translated) tooltip text to use for the menu button for this panel.
 
QString panelTitle ()
 The title of the panel.
 
void setAutoDelete (bool autoDelete)
 The the auto delete property on the widget.
 
virtual void setDockMode (bool dockMode)
 Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
 
void setPanelTitle (const QString &panelTitle)
 Set the title of the panel when shown in the interface.
 

Additional Inherited Members

- Public Slots inherited from QgsPanelWidget
void acceptPanel ()
 Accept the panel.
 
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.
 
- 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.
 
- Protected Member Functions inherited from QgsPanelWidget
void keyPressEvent (QKeyEvent *event) override
 Overridden key press event to handle the esc event on the widget.
 

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,
Qgis::LayerType  layerType = Qgis::LayerType::Vector,
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 37 of file qgsdatasourceselectdialog.cpp.

◆ ~QgsDataSourceSelectWidget()

QgsDataSourceSelectWidget::~QgsDataSourceSelectWidget ( )
overridedefault

Member Function Documentation

◆ dragEnterEvent()

void QgsDataSourceSelectWidget::dragEnterEvent ( QDragEnterEvent *  event)
override

Definition at line 173 of file qgsdatasourceselectdialog.cpp.

◆ dropEvent()

void QgsDataSourceSelectWidget::dropEvent ( QDropEvent *  event)
override

Definition at line 186 of file qgsdatasourceselectdialog.cpp.

◆ expandPath()

void QgsDataSourceSelectWidget::expandPath ( const QString &  path,
bool  selectPath = false 
)

Expands out a file path in the view.

The path must correspond to a valid directory existing on the file system.

Since QGIS 3.38 the selectPath argument can be used to automatically select the path too.

Since
QGIS 3.28

Definition at line 253 of file qgsdatasourceselectdialog.cpp.

◆ 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 318 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
QGIS 3.8

Definition at line 220 of file qgsdatasourceselectdialog.cpp.

◆ setFilter()

void QgsDataSourceSelectWidget::setFilter ( )

Apply filter to the model.

Definition at line 258 of file qgsdatasourceselectdialog.cpp.

◆ setFilterSyntax()

void QgsDataSourceSelectWidget::setFilterSyntax ( QAction *  action)

Sets filter syntax.

Definition at line 311 of file qgsdatasourceselectdialog.cpp.

◆ setLayerTypeFilter()

void QgsDataSourceSelectWidget::setLayerTypeFilter ( Qgis::LayerType  layerType)

Sets layer type filter to layerType and activates the filtering.

Definition at line 323 of file qgsdatasourceselectdialog.cpp.

◆ showEvent()

void QgsDataSourceSelectWidget::showEvent ( QShowEvent *  e)
override

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

Definition at line 128 of file qgsdatasourceselectdialog.cpp.

◆ showFilterWidget()

void QgsDataSourceSelectWidget::showFilterWidget ( bool  visible)

Show/hide filter widget.

Definition at line 205 of file qgsdatasourceselectdialog.cpp.

◆ uri()

QgsMimeDataUtils::Uri QgsDataSourceSelectWidget::uri ( ) const

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

Definition at line 333 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: