QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
The QgsDataSourceSelectWidget class embeds the browser view to select an existing data source. More...
#include <qgsdatasourceselectdialog.h>
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 QgsPanelWidget * | findParentPanel (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. | |
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.
Definition at line 46 of file qgsdatasourceselectdialog.h.
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.
browserModel | an existing browser model (typically from app), if nullptr an instance will be created |
setFilterByLayerType | activates filtering by layer type |
layerType | sets the layer type filter, this is in effect only if filtering by layer type is also active |
parent | the object |
Definition at line 37 of file qgsdatasourceselectdialog.cpp.
|
overridedefault |
|
override |
Definition at line 172 of file qgsdatasourceselectdialog.cpp.
|
override |
Definition at line 185 of file qgsdatasourceselectdialog.cpp.
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.
Definition at line 253 of file qgsdatasourceselectdialog.cpp.
|
signal |
Emitted when an item is triggered, e.g.
via a double-click.
|
signal |
Emitted when the current selection changes in the widget.
void QgsDataSourceSelectWidget::setCaseSensitive | ( | bool | caseSensitive | ) |
Sets filter case sensitivity.
Definition at line 320 of file qgsdatasourceselectdialog.cpp.
void QgsDataSourceSelectWidget::setDescription | ( | const QString & | description | ) |
Sets a description label.
description | a description string |
Definition at line 219 of file qgsdatasourceselectdialog.cpp.
void QgsDataSourceSelectWidget::setFilter | ( | ) |
Apply filter to the model.
Definition at line 258 of file qgsdatasourceselectdialog.cpp.
void QgsDataSourceSelectWidget::setFilterSyntax | ( | QAction * | action | ) |
Sets filter syntax.
Definition at line 313 of file qgsdatasourceselectdialog.cpp.
void QgsDataSourceSelectWidget::setLayerTypeFilter | ( | Qgis::LayerType | layerType | ) |
Sets layer type filter to layerType and activates the filtering.
Definition at line 325 of file qgsdatasourceselectdialog.cpp.
|
override |
Scroll to last selected index and expand it's children.
Definition at line 127 of file qgsdatasourceselectdialog.cpp.
void QgsDataSourceSelectWidget::showFilterWidget | ( | bool | visible | ) |
Show/hide filter widget.
Definition at line 204 of file qgsdatasourceselectdialog.cpp.
QgsMimeDataUtils::Uri QgsDataSourceSelectWidget::uri | ( | ) | const |
Returns the (possibly invalid) uri of the selected data source.
Definition at line 335 of file qgsdatasourceselectdialog.cpp.
|
signal |
This signal is emitted whenever the validation status of the widget changes.
isValid | true if the current status of the widget is valid |