QGIS API Documentation  2.12.0-Lyon
qgssizescalewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssizescalewidget.h - continuous size scale assistant
3 
4  ---------------------
5  begin : March 2015
6  copyright : (C) 2015 by Vincent Mora
7  email : vincent dot mora at oslandia dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSSIZESCALEWIDGET_H
18 #define QGSSIZESCALEWIDGET_H
19 
20 #include "qgslayertreegroup.h"
21 #include "qgslayertreemodel.h"
22 #include "qgsdatadefinedbutton.h"
23 #include "ui_widget_size_scale.h"
24 #include <QStandardItemModel>
25 
26 class QgsVectorLayer;
27 class QgsMarkerSymbolV2;
28 class QgsLayerTreeLayer;
29 class QgsScaleExpression;
30 class QgsDataDefined;
31 class QgsMapCanvas;
32 
33 class GUI_EXPORT QgsSizeScaleWidget : public QgsDataDefinedAssistant, private Ui_SizeScaleBase
34 {
35  Q_OBJECT
36 
37  public:
38  QgsSizeScaleWidget( const QgsVectorLayer * layer, const QgsMarkerSymbolV2 * symbol );
39 
40  QgsDataDefined dataDefined() const override;
41 
45  const QgsVectorLayer* layer() const { return mLayer; }
46 
47  protected:
48 
49  virtual void showEvent( QShowEvent * ) override;
50 
51  private slots:
52  void computeFromLayerTriggered();
53  void updatePreview();
54 
55  private:
56 
57  const QgsMarkerSymbolV2* mSymbol;
58  QgsVectorLayer* mLayer;
59  QgsLayerTreeLayer* mLayerTreeLayer;
60  QgsLayerTreeGroup mRoot;
61  QStandardItemModel mPreviewList;
63 
64  QgsScaleExpression* createExpression() const;
65  void setFromSymbol();
66 
67 };
68 
69 #endif //QGSSIZESCALEWIDGET_H
Layer tree group node serves as a container for layers and further groups.
An assistant (wizard) dialog, accessible from a QgsDataDefinedButton.
A container class for data source field mapping or expression.
virtual QgsDataDefined dataDefined() const =0
Class storing parameters of a scale expression, which is a subclass of QgsExpression for expressions ...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:107
virtual void showEvent(QShowEvent *event)
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
Represents a vector layer which manages a vector based data sets.
Layer tree node points to a map layer.