QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgssymbolv2selectordialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbolv2selectordialog.h
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSSYMBOLV2SELECTORDIALOG_H
17 #define QGSSYMBOLV2SELECTORDIALOG_H
18 
19 #include <QDialog>
20 
21 #include "ui_qgssymbolv2selectordialogbase.h"
22 
23 #include "qgsdatadefined.h"
24 
25 #include <QStandardItemModel>
26 #include <QScopedPointer>
27 
28 class QgsStyleV2;
29 class QgsSymbolV2;
30 class QgsSymbolLayerV2;
31 class QgsVectorLayer;
32 
33 class QMenu;
34 class QWidget;
35 
36 class SymbolLayerItem;
37 class QgsMarkerSymbolV2;
38 class QgsLineSymbolV2;
41 
43 {
44  Q_OBJECT
45  public:
46  DataDefinedRestorer( QgsSymbolV2* symbol, const QgsSymbolLayerV2* symbolLayer );
47 
48  public slots:
49  void restore();
50 
51  private:
52  QgsMarkerSymbolV2* mMarker;
53  const QgsMarkerSymbolLayerV2* mMarkerSymbolLayer;
54  double mSize;
55  double mAngle;
56  QPointF mMarkerOffset;
57  QgsDataDefined mDDSize;
58  QgsDataDefined mDDAngle;
59 
60  QgsLineSymbolV2* mLine;
61  const QgsLineSymbolLayerV2* mLineSymbolLayer;
62  double mWidth;
63  double mLineOffset;
64  QgsDataDefined mDDWidth;
65 
66  void save();
67 };
68 
69 class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymbolV2SelectorDialogBase
70 {
71  Q_OBJECT
72 
73  public:
74  QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = 0, bool embedded = false );
75 
77  QMenu* advancedMenu();
78 
79  protected:
81  void keyPressEvent( QKeyEvent * event ) override;
82 
83  void loadSymbol();
85  void loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent );
86 
87  void updateUi();
88 
89  void updateLockButton();
90 
92  SymbolLayerItem* currentLayerItem();
93  QgsSymbolLayerV2* currentLayer();
94 
95  void moveLayerByOffset( int offset );
96 
97  void setWidget( QWidget* widget );
98 
99  signals:
100  void symbolModified();
101 
102  public slots:
103  void moveLayerDown();
104  void moveLayerUp();
105 
106  void addLayer();
107  void removeLayer();
108 
109  void saveSymbol();
110  void lockLayer();
111 
112  void layerChanged();
113 
114  void updateLayerPreview();
115  void updatePreview();
116 
118  void symbolChanged();
121  void changeLayer( QgsSymbolLayerV2* layer );
122 
123 
124  protected: // data
129 
132 
133  private:
134  QScopedPointer<DataDefinedRestorer> mDataDefineRestorer;
135 };
136 
137 #endif
A container class for data source field mapping or expression.
const QgsVectorLayer * mVectorLayer
DataDefinedRestorer(QgsSymbolV2 *symbol, const QgsSymbolLayerV2 *symbolLayer)
virtual void keyPressEvent(QKeyEvent *e)
Represents a vector layer which manages a vector based data sets.