QGIS API Documentation  2.99.0-Master (6a61179)
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Friends | List of all members
QgsDualView Class Reference

This widget is used to show the attributes of a set of features of a QgsVectorLayer. More...

#include <qgsdualview.h>

Inheritance diagram for QgsDualView:
Inheritance graph
[legend]

Public Types

enum  ViewMode { AttributeTable = 0, AttributeEditor = 1 }
 The view modes, in which this widget can present information. More...
 

Public Slots

void copyCellContent () const
 Copy the content of the selected cell in the clipboard. More...
 
void openConditionalStyles ()
 
bool saveEditChanges ()
 saveEditChanges More...
 
void setCurrentEditSelection (const QgsFeatureIds &fids)
 Set the current edit selection in the AttributeEditor mode. More...
 
void setMultiEditEnabled (bool enabled)
 Sets whether multi edit mode is enabled. More...
 
void toggleSearchMode (bool enabled)
 Toggles whether search mode should be enabled in the form. More...
 

Signals

void displayExpressionChanged (const QString &expression)
 Is emitted, whenever the display expression is successfully changed. More...
 
void filterChanged ()
 Is emitted, whenever the filter changes. More...
 
void filterExpressionSet (const QString &expression, QgsAttributeForm::FilterType type)
 Is emitted when a filter expression is set using the view. More...
 
void formModeChanged (QgsAttributeForm::Mode mode)
 Emitted when the form changes mode. More...
 

Public Member Functions

 QgsDualView (QWidget *parent=nullptr)
 Constructor. More...
 
int featureCount ()
 Returns the number of features on the layer. More...
 
int filteredFeatureCount ()
 Returns the number of features which are currently visible, according to the filter restrictions. More...
 
QgsFeatureIds filteredFeatures ()
 Get a list of currently visible feature ids. More...
 
QgsAttributeTableFilterModel::FilterMode filterMode ()
 Get the filter mode. More...
 
void init (QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request=QgsFeatureRequest(), const QgsAttributeEditorContext &context=QgsAttributeEditorContext())
 Has to be called to initialize the dual view. More...
 
QgsAttributeTableModelmasterModel () const
 Returns the model which has the information about all features (not only filtered) More...
 
void setAttributeTableConfig (const QgsAttributeTableConfig &config)
 Set the attribute table config which should be used to control the appearance of the attribute table. More...
 
void setFeatureSelectionManager (QgsIFeatureSelectionManager *featureSelectionManager)
 Set the feature selection model. More...
 
void setFilteredFeatures (const QgsFeatureIds &filteredFeatures)
 Set a list of currently visible features. More...
 
void setFilterMode (QgsAttributeTableFilterModel::FilterMode filterMode)
 Set the filter mode. More...
 
void setRequest (const QgsFeatureRequest &request)
 Set the request. More...
 
void setSelectedOnTop (bool selectedOnTop)
 Toggle the selectedOnTop flag. More...
 
void setSortExpression (const QString &sortExpression, Qt::SortOrder sortOrder=Qt::AscendingOrder)
 Set the expression used for sorting the table and feature list. More...
 
void setView (ViewMode view)
 Change the current view mode. More...
 
QString sortExpression () const
 Get the expression used for sorting the table and feature list. More...
 
QgsAttributeTableViewtableView ()
 Returns the table view. More...
 
ViewMode view () const
 Returns the current view mode. More...
 

Protected Member Functions

void columnBoxInit ()
 Initializes widgets which depend on the attributes of this layer. More...
 

Friends

class TestQgsDualView
 

Detailed Description

This widget is used to show the attributes of a set of features of a QgsVectorLayer.

The attributes can be edited. It supports two different layouts: the table layout, in which the attributes for the features are shown in a table and the editor layout, where the features are shown as a selectable list and the attributes for the currently selected feature are shown in a form.

Definition at line 40 of file qgsdualview.h.

Member Enumeration Documentation

§ ViewMode

The view modes, in which this widget can present information.

Relates to the QStackedWidget stacks.

Enumerator
AttributeTable 

Shows the features and attributes in a table layout.

AttributeEditor 

Show a list of the features, where one can be chosen and the according attribute dialog will be presented in the neighbouring frame.

Definition at line 52 of file qgsdualview.h.

Constructor & Destructor Documentation

§ QgsDualView()

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

Constructor.

Parameters
parentThe parent widget

Definition at line 40 of file qgsdualview.cpp.

Member Function Documentation

§ columnBoxInit()

void QgsDualView::columnBoxInit ( )
protected

Initializes widgets which depend on the attributes of this layer.

Definition at line 120 of file qgsdualview.cpp.

§ copyCellContent

void QgsDualView::copyCellContent ( ) const
slot

Copy the content of the selected cell in the clipboard.

Note
added in QGIS 1.16

Definition at line 357 of file qgsdualview.cpp.

§ displayExpressionChanged

void QgsDualView::displayExpressionChanged ( const QString &  expression)
signal

Is emitted, whenever the display expression is successfully changed.

Parameters
expressionThe expression that was applied

§ featureCount()

int QgsDualView::featureCount ( )

Returns the number of features on the layer.

Returns
Number of features

Definition at line 347 of file qgsdualview.cpp.

§ filterChanged

void QgsDualView::filterChanged ( )
signal

Is emitted, whenever the filter changes.

§ filteredFeatureCount()

int QgsDualView::filteredFeatureCount ( )

Returns the number of features which are currently visible, according to the filter restrictions.

Returns
Number of features

Definition at line 352 of file qgsdualview.cpp.

§ filteredFeatures()

QgsFeatureIds QgsDualView::filteredFeatures ( )
inline

Get a list of currently visible feature ids.

Definition at line 148 of file qgsdualview.h.

§ filterExpressionSet

void QgsDualView::filterExpressionSet ( const QString &  expression,
QgsAttributeForm::FilterType  type 
)
signal

Is emitted when a filter expression is set using the view.

Parameters
expressionfilter expression
typefilter type
Note
added in QGIS 2.16

§ filterMode()

QgsAttributeTableFilterModel::FilterMode QgsDualView::filterMode ( )
inline

Get the filter mode.

Returns
the filter mode

Definition at line 112 of file qgsdualview.h.

§ formModeChanged

void QgsDualView::formModeChanged ( QgsAttributeForm::Mode  mode)
signal

Emitted when the form changes mode.

Parameters
modenew mode

§ init()

void QgsDualView::init ( QgsVectorLayer layer,
QgsMapCanvas mapCanvas,
const QgsFeatureRequest request = QgsFeatureRequest(),
const QgsAttributeEditorContext context = QgsAttributeEditorContext() 
)

Has to be called to initialize the dual view.

Parameters
layerThe layer which should be used to fetch features
mapCanvasThe mapCanvas (used for the FilterMode QgsAttributeTableFilterModel::ShowVisible
requestUse a modified request to limit the shown features
contextThe context in which this view is shown

Definition at line 71 of file qgsdualview.cpp.

§ masterModel()

QgsAttributeTableModel* QgsDualView::masterModel ( ) const
inline

Returns the model which has the information about all features (not only filtered)

Returns
The master model

Definition at line 155 of file qgsdualview.h.

§ openConditionalStyles

void QgsDualView::openConditionalStyles ( )
slot

Definition at line 272 of file qgsdualview.cpp.

§ saveEditChanges

bool QgsDualView::saveEditChanges ( )
slot

saveEditChanges

Returns
true if the saving was ok. false is possible due to connected validation logic.

Definition at line 267 of file qgsdualview.cpp.

§ setAttributeTableConfig()

void QgsDualView::setAttributeTableConfig ( const QgsAttributeTableConfig config)

Set the attribute table config which should be used to control the appearance of the attribute table.

Definition at line 672 of file qgsdualview.cpp.

§ setCurrentEditSelection

void QgsDualView::setCurrentEditSelection ( const QgsFeatureIds fids)
slot

Set the current edit selection in the AttributeEditor mode.

Parameters
fidsA list of edited features (Currently only one at a time is supported)

Definition at line 261 of file qgsdualview.cpp.

§ setFeatureSelectionManager()

void QgsDualView::setFeatureSelectionManager ( QgsIFeatureSelectionManager featureSelectionManager)

Set the feature selection model.

Parameters
featureSelectionManagerthe feature selection model

Definition at line 661 of file qgsdualview.cpp.

§ setFilteredFeatures()

void QgsDualView::setFilteredFeatures ( const QgsFeatureIds filteredFeatures)

Set a list of currently visible features.

Parameters
filteredFeaturesA list of feature ids

Definition at line 651 of file qgsdualview.cpp.

§ setFilterMode()

void QgsDualView::setFilterMode ( QgsAttributeTableFilterModel::FilterMode  filterMode)

Set the filter mode.

Parameters
filterMode

Definition at line 190 of file qgsdualview.cpp.

§ setMultiEditEnabled

void QgsDualView::setMultiEditEnabled ( bool  enabled)
slot

Sets whether multi edit mode is enabled.

Note
added in QGIS 2.16

Definition at line 278 of file qgsdualview.cpp.

§ setRequest()

void QgsDualView::setRequest ( const QgsFeatureRequest request)

Set the request.

Parameters
requestThe request

Definition at line 656 of file qgsdualview.cpp.

§ setSelectedOnTop()

void QgsDualView::setSelectedOnTop ( bool  selectedOnTop)

Toggle the selectedOnTop flag.

If enabled, selected features will be moved to top.

Parameters
selectedOnTopTrue: Show selected features on top. False: Use defined sorting column.

Definition at line 196 of file qgsdualview.cpp.

§ setSortExpression()

void QgsDualView::setSortExpression ( const QString &  sortExpression,
Qt::SortOrder  sortOrder = Qt::AscendingOrder 
)

Set the expression used for sorting the table and feature list.

Definition at line 680 of file qgsdualview.cpp.

§ setView()

void QgsDualView::setView ( QgsDualView::ViewMode  view)

Change the current view mode.

Parameters
viewThe view mode to set
See also
view()

Definition at line 180 of file qgsdualview.cpp.

§ sortExpression()

QString QgsDualView::sortExpression ( ) const

Get the expression used for sorting the table and feature list.

Definition at line 692 of file qgsdualview.cpp.

§ tableView()

QgsAttributeTableView* QgsDualView::tableView ( )
inline

Returns the table view.

Returns
The table view

Definition at line 176 of file qgsdualview.h.

§ toggleSearchMode

void QgsDualView::toggleSearchMode ( bool  enabled)
slot

Toggles whether search mode should be enabled in the form.

Parameters
enabledset to true to switch on search mode
Note
added in QGIS 2.16

Definition at line 286 of file qgsdualview.cpp.

§ view()

QgsDualView::ViewMode QgsDualView::view ( ) const

Returns the current view mode.

See also
setView()
Note
added in QGIS 2.16

Definition at line 185 of file qgsdualview.cpp.

Friends And Related Function Documentation

§ TestQgsDualView

friend class TestQgsDualView
friend

Definition at line 345 of file qgsdualview.h.


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