2013-06-22 19:37:41 +02:00
|
|
|
class QgsDualView : QStackedWidget
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsdualview.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
/**
|
|
|
|
* 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,
|
|
|
|
/**
|
|
|
|
* Show a list of the features, where one can be chosen
|
|
|
|
* and the according attribute dialog will be presented
|
|
|
|
* in the neighbouring frame.
|
|
|
|
*/
|
|
|
|
AttributeEditor
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Constructor
|
|
|
|
* @param parent The parent widget
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
explicit QgsDualView( QWidget *parent /TransferThis/ = 0 );
|
2013-06-22 19:37:41 +02:00
|
|
|
virtual ~QgsDualView();
|
|
|
|
|
2017-02-21 11:17:48 +10:00
|
|
|
void init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest& request = QgsFeatureRequest(), const QgsAttributeEditorContext& context = QgsAttributeEditorContext(),
|
|
|
|
bool loadFeatures = true );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
/**
|
|
|
|
* Change the current view mode.
|
|
|
|
*
|
|
|
|
* @param view The view mode to set
|
2016-03-08 14:11:33 +11:00
|
|
|
* @see view()
|
2013-06-22 19:37:41 +02:00
|
|
|
*/
|
|
|
|
void setView( ViewMode view );
|
|
|
|
|
2016-03-08 14:11:33 +11:00
|
|
|
/**
|
|
|
|
* Returns the current view mode.
|
|
|
|
* @see setView()
|
|
|
|
* @note added in QGIS 2.16
|
|
|
|
*/
|
|
|
|
ViewMode view() const;
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
/**
|
|
|
|
* Set the filter mode
|
|
|
|
*
|
|
|
|
* @param filterMode
|
|
|
|
*/
|
|
|
|
void setFilterMode( QgsAttributeTableFilterModel::FilterMode filterMode );
|
|
|
|
|
2016-04-28 15:47:43 +02:00
|
|
|
/**
|
|
|
|
* Get the filter mode
|
|
|
|
*
|
|
|
|
* @return the filter mode
|
|
|
|
*/
|
2014-05-27 23:22:50 +02:00
|
|
|
QgsAttributeTableFilterModel::FilterMode filterMode();
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setFilteredFeatures( const QgsFeatureIds &filteredFeatures );
|
2013-06-22 19:37:41 +02:00
|
|
|
|
2016-04-28 15:47:43 +02:00
|
|
|
/**
|
|
|
|
* Get a list of currently visible feature ids.
|
|
|
|
*/
|
2014-05-27 23:22:50 +02:00
|
|
|
QgsFeatureIds filteredFeatures();
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
/**
|
|
|
|
* Returns the model which has the information about all features (not only filtered)
|
|
|
|
*
|
|
|
|
* @return The master model
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsAttributeTableModel *masterModel() const;
|
2013-06-22 19:37:41 +02:00
|
|
|
|
2016-04-08 19:18:20 +02:00
|
|
|
/**
|
|
|
|
* Set the request
|
|
|
|
*
|
|
|
|
* @param request The request
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setRequest( const QgsFeatureRequest &request );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2016-04-08 19:18:20 +02:00
|
|
|
/**
|
|
|
|
* Set the feature selection model
|
|
|
|
*
|
|
|
|
* @param featureSelectionManager the feature selection model
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setFeatureSelectionManager( QgsIFeatureSelectionManager *featureSelectionManager );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2016-04-08 19:18:20 +02:00
|
|
|
/**
|
|
|
|
* Returns the table view
|
|
|
|
*
|
|
|
|
* @return The table view
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsAttributeTableView *tableView();
|
2016-07-07 17:25:54 +02:00
|
|
|
|
2016-04-28 15:47:43 +02:00
|
|
|
/**
|
|
|
|
* Set the attribute table config which should be used to control
|
|
|
|
* the appearance of the attribute table.
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setAttributeTableConfig( const QgsAttributeTableConfig &config );
|
2016-02-24 08:54:50 +01:00
|
|
|
|
2016-04-08 19:18:20 +02:00
|
|
|
/**
|
|
|
|
* Set the expression used for sorting the table and feature list.
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setSortExpression( const QString &sortExpression , Qt::SortOrder sortOrder = Qt::AscendingOrder );
|
2016-04-08 19:18:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the expression used for sorting the table and feature list.
|
|
|
|
*/
|
|
|
|
QString sortExpression() const;
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Initializes widgets which depend on the attributes of this layer
|
|
|
|
*/
|
|
|
|
void columnBoxInit();
|
|
|
|
|
|
|
|
virtual void hideEvent( QHideEvent * );
|
|
|
|
virtual void focusOutEvent( QFocusEvent * );
|
|
|
|
|
|
|
|
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)
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void setCurrentEditSelection( const QgsFeatureIds &fids );
|
2013-06-22 19:37:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief saveEditChanges
|
2014-01-27 09:22:24 +01:00
|
|
|
*
|
|
|
|
* @return true if the saving was ok. false is possible due to connected
|
|
|
|
* validation logic.
|
|
|
|
*/
|
|
|
|
bool saveEditChanges();
|
|
|
|
|
2016-01-04 22:51:18 +11:00
|
|
|
void openConditionalStyles();
|
|
|
|
|
2016-03-08 14:11:33 +11:00
|
|
|
/** Sets whether multi edit mode is enabled.
|
|
|
|
* @note added in QGIS 2.16
|
|
|
|
*/
|
|
|
|
void setMultiEditEnabled( bool enabled );
|
|
|
|
|
2016-05-17 14:16:17 +10:00
|
|
|
/** Toggles whether search mode should be enabled in the form.
|
|
|
|
* @param enabled set to true to switch on search mode
|
|
|
|
* @note added in QGIS 2.16
|
|
|
|
*/
|
|
|
|
void toggleSearchMode( bool enabled );
|
|
|
|
|
2016-05-27 18:56:17 +02:00
|
|
|
/**
|
|
|
|
* Copy the content of the selected cell in the clipboard.
|
|
|
|
* @note added in QGIS 1.16
|
|
|
|
*/
|
|
|
|
void copyCellContent() const;
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
signals:
|
|
|
|
/**
|
|
|
|
* Is emitted, whenever the display expression is successfully changed
|
|
|
|
* @param expression The expression that was applied
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void displayExpressionChanged( const QString &expression );
|
2013-06-22 19:37:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is emitted, whenever the filter changes
|
|
|
|
*/
|
|
|
|
void filterChanged();
|
2016-05-17 14:16:17 +10:00
|
|
|
|
|
|
|
/** Is emitted when a filter expression is set using the view.
|
|
|
|
* @param expression filter expression
|
|
|
|
* @param type filter type
|
|
|
|
* @note added in QGIS 2.16
|
|
|
|
*/
|
2017-05-01 18:13:15 +02:00
|
|
|
void filterExpressionSet( const QString &expression, QgsAttributeForm::FilterType type );
|
2016-05-17 14:16:17 +10:00
|
|
|
|
|
|
|
/** Emitted when the form changes mode.
|
|
|
|
* @param mode new mode
|
|
|
|
*/
|
|
|
|
void formModeChanged( QgsAttributeForm::Mode mode );
|
|
|
|
|
2013-06-22 19:37:41 +02:00
|
|
|
};
|
|
|
|
|
2013-06-24 08:43:47 +02:00
|
|
|
class QgsAttributeTableAction : QAction
|
2013-06-22 19:37:41 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsdualview.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsAttributeTableAction( const QString &name, QgsDualView *dualView, const QUuid &action, const QModelIndex &fieldIdx );
|
2013-06-22 19:37:41 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void execute();
|
|
|
|
void featureForm();
|
|
|
|
};
|
2014-01-19 23:04:24 +11:00
|
|
|
|
|
|
|
class QgsAttributeTableMapLayerAction : QAction
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsdualview.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsAttributeTableMapLayerAction( const QString &name, QgsDualView *dualView, QgsMapLayerAction *action, const QModelIndex &fieldIdx );
|
2014-01-19 23:04:24 +11:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void execute();
|
|
|
|
|
|
|
|
};
|