/usr/include/qgis/qgsdualview.h is in libqgis-dev 2.8.6+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | /***************************************************************************
qgsdualview.h
--------------------------------------
Date : 10.2.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSFEATURELIST_H
#define QGSFEATURELIST_H
#include <QStackedWidget>
#include "ui_qgsdualviewbase.h"
#include "qgsattributeeditorcontext.h"
#include "qgsattributetablefiltermodel.h"
#include "qgscachedfeatureiterator.h"
#include "qgsdistancearea.h"
class QgsAttributeForm;
class QgsFeatureRequest;
class QSignalMapper;
class QgsMapLayerAction;
/**
* This widget is used to show the attributes of a set of features of a {@link 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.
*/
class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBase
{
Q_OBJECT
Q_ENUMS( ViewMode )
public:
/**
* The view modes, in which this widget can present information.
* Relates to the QStackedWidget stacks.
*
*/
enum ViewMode
{
/**
* Shows the features and attributes in a table layout
*/
AttributeTable = 0,
/**
* Show a list of the features, where one can be chosen
* and the according attribute dialog will be presented
* in the neighbouring frame.
*/
AttributeEditor = 1
};
/**
* @brief Constructor
* @param parent The parent widget
*/
explicit QgsDualView( QWidget* parent = 0 );
/**
* Has to be called to initialize the dual view.
*
* @param layer The layer which should be used to fetch features
* @param mapCanvas The mapCanvas (used for the FilterMode
* {@link QgsAttributeTableFilterModel::ShowVisible}
* @param request Use a modified request to limit the shown features
* @param context The context in which this view is shown
*/
void init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest& request = QgsFeatureRequest(), const QgsAttributeEditorContext& context = QgsAttributeEditorContext() );
/**
* Change the current view mode.
*
* @param view The view mode to set
*/
void setView( ViewMode view );
/**
* Set the filter mode
*
* @param filterMode
*/
void setFilterMode( QgsAttributeTableFilterModel::FilterMode filterMode );
QgsAttributeTableFilterModel::FilterMode filterMode() { return mFilterModel->filterMode(); }
/**
* Toggle the selectedOnTop flag. If enabled, selected features will be moved to top.
*
* @param selectedOnTop True: Show selected features on top.
* False: Use defined sorting column.
*/
void setSelectedOnTop( bool selectedOnTop );
/**
* Returns the number of features on the layer.
*
* @return Number of features
*/
int featureCount();
/**
* Returns the number of features which are currently visible, according to the
* filter restrictions
*
* @return Number of features
*/
int filteredFeatureCount();
/**
* Set a list of currently visible features
*
* @param filteredFeatures A list of feature ids
*
*/
void setFilteredFeatures( QgsFeatureIds filteredFeatures );
QgsFeatureIds filteredFeatures() { return mFilterModel->filteredFeatures(); }
/**
* Returns the model which has the information about all features (not only filtered)
*
* @return The master model
*/
QgsAttributeTableModel* masterModel() const { return mMasterModel; }
void setRequest( const QgsFeatureRequest& request );
void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSelectionManager );
protected:
/**
* Initializes widgets which depend on the attributes of this layer
*/
void columnBoxInit();
public slots:
/**
* @brief Set the current edit selection in the {@link AttributeEditor} mode.
*
* @param fids A list of edited features (Currently only one at a time is supported)
*/
void setCurrentEditSelection( const QgsFeatureIds& fids );
/**
* @brief saveEditChanges
*
* @return true if the saving was ok. false is possible due to connected
* validation logic.
*/
bool saveEditChanges();
signals:
/**
* Is emitted, whenever the display expression is successfully changed
* @param expression The expression that was applied
*/
void displayExpressionChanged( const QString expression );
/**
* Is emitted, whenever the filter changes
*/
void filterChanged();
private slots:
void on_mFeatureList_aboutToChangeEditSelection( bool& ok );
/**
* Changes the currently visible feature within the attribute editor
*
* @param feat The newly visible feature
*/
void on_mFeatureList_currentEditSelectionChanged( const QgsFeature& feat );
void previewExpressionBuilder();
void previewColumnChanged( QObject* previewAction );
void viewWillShowContextMenu( QMenu* menu, QModelIndex atIndex );
void previewExpressionChanged( const QString expression );
/**
* 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.
*/
void featureFormAttributeChanged();
/**
* Will be called periodically, when loading layers from slow data providers.
*
* @param i The number of features already loaded
* @param cancel Set to true to cancel
*/
virtual void progress( int i, bool &cancel );
/**
* Will be called, once all the features are loaded.
* Use e.g. to close a dialog created from progress( int i, bool &cancel )
*/
virtual void finished();
private:
void initLayerCache( QgsVectorLayer *layer, bool cacheGeometry );
void initModels( QgsMapCanvas* mapCanvas, const QgsFeatureRequest& request );
QgsAttributeEditorContext mEditorContext;
QgsAttributeTableModel* mMasterModel;
QgsAttributeTableFilterModel* mFilterModel;
QgsFeatureListModel* mFeatureListModel;
QgsAttributeForm* mAttributeForm;
QSignalMapper* mPreviewActionMapper;
QMenu* mPreviewColumnsMenu;
QgsVectorLayerCache* mLayerCache;
QProgressDialog* mProgressDlg;
QgsIFeatureSelectionManager* mFeatureSelectionManager;
QgsDistanceArea mDistanceArea;
QString mDisplayExpression;
friend class TestQgsDualView;
};
class GUI_EXPORT QgsAttributeTableAction : public QAction
{
Q_OBJECT
public:
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, int action, const QModelIndex &fieldIdx ) :
QAction( name, dualView ), mDualView( dualView ), mAction( action ), mFieldIdx( fieldIdx )
{}
public slots:
void execute();
void featureForm();
private:
QgsDualView* mDualView;
int mAction;
QModelIndex mFieldIdx;
};
class GUI_EXPORT QgsAttributeTableMapLayerAction : public QAction
{
Q_OBJECT
public:
QgsAttributeTableMapLayerAction( const QString &name, QgsDualView *dualView, QgsMapLayerAction* action, const QModelIndex &fieldIdx ) :
QAction( name, dualView ), mDualView( dualView ), mAction( action ), mFieldIdx( fieldIdx )
{}
public slots:
void execute();
private:
QgsDualView* mDualView;
QgsMapLayerAction* mAction;
QModelIndex mFieldIdx;
};
#endif // QGSFEATURELIST_H
|