QGIS API Documentation
2.4.0-Chugiak
|
This widget is used to show the attributes of a set of features of a QgsVectorLayer. More...
#include <qgsdualview.h>
Public Types | |
enum | ViewMode { AttributeTable = 0, AttributeEditor = 1 } |
The view modes, in which this widget can present information. More... | |
Public Slots | |
void | setCurrentEditSelection (const QgsFeatureIds &fids) |
Set the current edit selection in the AttributeEditor mode. More... | |
bool | saveEditChanges () |
saveEditChanges 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... | |
Public Member Functions | |
QgsDualView (QWidget *parent=0) | |
Constructor. More... | |
void | init (QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request=QgsFeatureRequest(), QgsAttributeEditorContext context=QgsAttributeEditorContext()) |
Has to be called to initialize the dual view. More... | |
void | setView (ViewMode view) |
Change the current view mode. More... | |
void | setFilterMode (QgsAttributeTableFilterModel::FilterMode filterMode) |
Set the filter mode. More... | |
QgsAttributeTableFilterModel::FilterMode | filterMode () |
void | setSelectedOnTop (bool selectedOnTop) |
Toggle the selectedOnTop flag. 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... | |
void | setFilteredFeatures (QgsFeatureIds filteredFeatures) |
Set a list of currently visible features. More... | |
QgsFeatureIds | filteredFeatures () |
QgsAttributeTableModel * | masterModel () const |
Returns the model which has the information about all features (not only filtered) More... | |
void | setRequest (const QgsFeatureRequest &request) |
void | setFeatureSelectionManager (QgsIFeatureSelectionManager *featureSelectionManager) |
Protected Member Functions | |
void | columnBoxInit () |
Initializes widgets which depend on the attributes of this layer. More... | |
Private Slots | |
void | on_mFeatureList_aboutToChangeEditSelection (bool &ok) |
void | on_mFeatureList_currentEditSelectionChanged (const QgsFeature &feat) |
Changes the currently visible feature within the attribute editor. More... | |
void | previewExpressionBuilder () |
void | previewColumnChanged (QObject *previewAction) |
void | viewWillShowContextMenu (QMenu *menu, QModelIndex atIndex) |
void | previewExpressionChanged (const QString expression) |
void | featureFormAttributeChanged () |
Will be called whenever the currently shown feature form changes. More... | |
virtual void | progress (int i, bool &cancel) |
Will be called periodically, when loading layers from slow data providers. More... | |
virtual void | finished () |
Will be called, once all the features are loaded. More... | |
Private Member Functions | |
void | initLayerCache (QgsVectorLayer *layer) |
void | initModels (QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request) |
Private Attributes | |
QgsAttributeEditorContext | mEditorContext |
QgsAttributeTableModel * | mMasterModel |
QgsAttributeTableFilterModel * | mFilterModel |
QgsFeatureListModel * | mFeatureListModel |
QgsAttributeForm * | mAttributeForm |
QgsCachedFeatureIterator * | mFeatureCache |
QSignalMapper * | mPreviewActionMapper |
QMenu * | mPreviewColumnsMenu |
QgsVectorLayerCache * | mLayerCache |
QProgressDialog * | mProgressDlg |
QgsIFeatureSelectionManager * | mFeatureSelectionManager |
QgsDistanceArea | mDistanceArea |
Friends | |
class | TestQgsDualView |
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 42 of file qgsdualview.h.
The view modes, in which this widget can present information.
Relates to the QStackedWidget stacks.
Definition at line 53 of file qgsdualview.h.
|
explicit |
Constructor.
parent | The parent widget |
Definition at line 36 of file qgsdualview.cpp.
References displayExpressionChanged(), QgsApplication::getThemeIcon(), mPreviewActionMapper, mPreviewColumnsMenu, previewColumnChanged(), previewExpressionBuilder(), and previewExpressionChanged().
|
protected |
Initializes widgets which depend on the attributes of this layer.
Definition at line 84 of file qgsdualview.cpp.
References QgsVectorLayer::displayExpression(), QgsVectorLayer::displayField(), QgsVectorLayer::editorWidgetV2(), QgsVectorLayer::fieldNameIndex(), QgsApplication::getThemeIcon(), icon(), QgsVectorLayerCache::layer(), mLayerCache, mPreviewActionMapper, mPreviewColumnsMenu, QgsField::name(), QgsVectorLayer::pendingFields(), QgsVectorLayer::pendingPkAttributesList(), and QgsFields::toList().
Referenced by init().
|
signal |
Is emitted, whenever the display expression is successfully changed.
expression | The expression that was applied |
Referenced by initModels(), and QgsDualView().
int QgsDualView::featureCount | ( | ) |
Returns the number of features on the layer.
Definition at line 310 of file qgsdualview.cpp.
References mMasterModel, and QgsAttributeTableModel::rowCount().
|
privateslot |
Will be called whenever the currently shown feature form changes.
Will forward this signal to the feature list to visually represent that there has been an edit event.
Definition at line 368 of file qgsdualview.cpp.
Referenced by init().
|
signal |
Is emitted, whenever the filter changes.
Referenced by setFilterMode().
int QgsDualView::filteredFeatureCount | ( | ) |
Returns the number of features which are currently visible, according to the filter restrictions.
Definition at line 315 of file qgsdualview.cpp.
References mFilterModel.
|
inline |
Definition at line 131 of file qgsdualview.h.
|
inline |
Definition at line 98 of file qgsdualview.h.
|
privatevirtualslot |
Will be called, once all the features are loaded.
Use e.g. to close a dialog created from progress(int i,bool& cancel )
Definition at line 412 of file qgsdualview.cpp.
References mProgressDlg.
Referenced by initLayerCache(), and initModels().
void QgsDualView::init | ( | QgsVectorLayer * | layer, |
QgsMapCanvas * | mapCanvas, | ||
const QgsFeatureRequest & | request = QgsFeatureRequest() , |
||
QgsAttributeEditorContext | context = QgsAttributeEditorContext() |
||
) |
Has to be called to initialize the dual view.
layer | The layer which should be used to fetch features |
mapCanvas | The mapCanvas (used for the FilterMode QgsAttributeTableFilterModel::ShowVisible |
request | Use a modified request to limit the shown features |
context | The context in which this view is shown |
Definition at line 61 of file qgsdualview.cpp.
References columnBoxInit(), featureFormAttributeChanged(), QgsAttributeForm::hideButtonBox(), initLayerCache(), initModels(), mAttributeForm, mEditorContext, mFeatureListModel, mFilterModel, and viewWillShowContextMenu().
Referenced by QgsRelationEditorWidget::createRelationEditor().
|
private |
Definition at line 207 of file qgsdualview.cpp.
References finished(), mLayerCache, progress(), and QgsVectorDataProvider::SelectAtId.
Referenced by init().
|
private |
Definition at line 223 of file qgsdualview.cpp.
References displayExpressionChanged(), finished(), QgsAttributeTableModel::loadLayer(), mFeatureListModel, mFilterModel, mLayerCache, mMasterModel, progress(), and QgsAttributeTableModel::setRequest().
Referenced by init().
|
inline |
Returns the model which has the information about all features (not only filtered)
Definition at line 138 of file qgsdualview.h.
Referenced by QgsAttributeTableAction::execute(), QgsAttributeTableMapLayerAction::execute(), QgsAttributeTableAction::featureForm(), QgsRelationEditorWidget::on_mAddFeatureButton_clicked(), and QgsRelationEditorWidget::onCollapsedStateChanged().
|
privateslot |
Definition at line 240 of file qgsdualview.cpp.
References QgsVectorLayer::isEditable(), QgsVectorLayerCache::layer(), mAttributeForm, mLayerCache, and QgsAttributeForm::save().
|
privateslot |
Changes the currently visible feature within the attribute editor.
feat | The newly visible feature |
Definition at line 246 of file qgsdualview.cpp.
References QgsFeature::id(), QgsVectorLayer::isEditable(), QgsVectorLayerCache::layer(), mAttributeForm, mLayerCache, QgsAttributeForm::save(), setCurrentEditSelection(), and QgsAttributeForm::setFeature().
|
privateslot |
|
privateslot |
Definition at line 270 of file qgsdualview.cpp.
References QgsVectorLayer::displayExpression(), QgsVectorLayerCache::layer(), mLayerCache, QgsExpressionBuilderDialog::setExpressionText(), and tr.
Referenced by QgsDualView().
|
privateslot |
Definition at line 363 of file qgsdualview.cpp.
References QgsVectorLayerCache::layer(), mLayerCache, and QgsVectorLayer::setDisplayExpression().
Referenced by QgsDualView().
|
privatevirtualslot |
Will be called periodically, when loading layers from slow data providers.
i | The number of features already loaded |
cancel | Set to true to cancel |
Definition at line 394 of file qgsdualview.cpp.
References mProgressDlg, and tr.
Referenced by initLayerCache(), and initModels().
|
slot |
saveEditChanges
Definition at line 265 of file qgsdualview.cpp.
References mAttributeForm, and QgsAttributeForm::save().
|
slot |
Set the current edit selection in the AttributeEditor mode.
fids | A list of edited features (Currently only one at a time is supported) |
Definition at line 259 of file qgsdualview.cpp.
Referenced by QgsAttributeTableAction::featureForm(), and on_mFeatureList_currentEditSelectionChanged().
void QgsDualView::setFeatureSelectionManager | ( | QgsIFeatureSelectionManager * | featureSelectionManager | ) |
Definition at line 383 of file qgsdualview.cpp.
References mFeatureSelectionManager.
Referenced by QgsRelationEditorWidget::createRelationEditor().
void QgsDualView::setFilteredFeatures | ( | QgsFeatureIds | filteredFeatures | ) |
Set a list of currently visible features.
filteredFeatures | A list of feature ids |
Definition at line 373 of file qgsdualview.cpp.
References mFilterModel, and QgsAttributeTableFilterModel::setFilteredFeatures().
void QgsDualView::setFilterMode | ( | QgsAttributeTableFilterModel::FilterMode | filterMode | ) |
Set the filter mode.
filterMode |
Definition at line 196 of file qgsdualview.cpp.
References filterChanged(), mFilterModel, and QgsAttributeTableFilterModel::setFilterMode().
void QgsDualView::setRequest | ( | const QgsFeatureRequest & | request | ) |
Definition at line 378 of file qgsdualview.cpp.
References mMasterModel, and QgsAttributeTableModel::setRequest().
void QgsDualView::setSelectedOnTop | ( | bool | selectedOnTop | ) |
Toggle the selectedOnTop flag.
If enabled, selected features will be moved to top.
selectedOnTop | True: Show selected features on top. False: Use defined sorting column. |
Definition at line 202 of file qgsdualview.cpp.
References mFilterModel, and QgsAttributeTableFilterModel::setSelectedOnTop().
void QgsDualView::setView | ( | QgsDualView::ViewMode | view | ) |
Change the current view mode.
view | The view mode to set |
Definition at line 191 of file qgsdualview.cpp.
Referenced by QgsAttributeTableAction::featureForm().
|
privateslot |
Definition at line 320 of file qgsdualview.cpp.
References QgsVectorLayer::actions(), QgsAttributeAction::at(), QgsMapLayerActionRegistry::instance(), QgsVectorLayerCache::layer(), QgsMapLayerActionRegistry::mapLayerActions(), mFilterModel, mLayerCache, QgsAction::name(), QgsAction::runable(), QgsAttributeAction::size(), and tr.
Referenced by init().
|
friend |
Definition at line 235 of file qgsdualview.h.
|
private |
Definition at line 226 of file qgsdualview.h.
Referenced by init(), on_mFeatureList_aboutToChangeEditSelection(), on_mFeatureList_currentEditSelectionChanged(), and saveEditChanges().
|
private |
Definition at line 233 of file qgsdualview.h.
|
private |
Definition at line 222 of file qgsdualview.h.
Referenced by init().
|
private |
Definition at line 227 of file qgsdualview.h.
|
private |
Definition at line 225 of file qgsdualview.h.
Referenced by init(), and initModels().
|
private |
Definition at line 232 of file qgsdualview.h.
Referenced by setFeatureSelectionManager().
|
private |
Definition at line 224 of file qgsdualview.h.
Referenced by filteredFeatureCount(), init(), initModels(), setFilteredFeatures(), setFilterMode(), setSelectedOnTop(), and viewWillShowContextMenu().
|
private |
Definition at line 230 of file qgsdualview.h.
Referenced by columnBoxInit(), initLayerCache(), initModels(), on_mFeatureList_aboutToChangeEditSelection(), on_mFeatureList_currentEditSelectionChanged(), previewExpressionBuilder(), previewExpressionChanged(), and viewWillShowContextMenu().
|
private |
Definition at line 223 of file qgsdualview.h.
Referenced by featureCount(), initModels(), and setRequest().
|
private |
Definition at line 228 of file qgsdualview.h.
Referenced by columnBoxInit(), and QgsDualView().
|
private |
Definition at line 229 of file qgsdualview.h.
Referenced by columnBoxInit(), and QgsDualView().
|
private |
Definition at line 231 of file qgsdualview.h.
Referenced by finished(), and progress().