|
| 1 | +/** \ingroup gui |
| 2 | + * \class A panel widget that can be shown in the map style dock |
| 3 | + * \note added in QGIS 2.16 |
| 4 | + */ |
| 5 | +class QgsMapStylePanel : public QWidget |
| 6 | +{ |
| 7 | +%TypeHeaderCode |
| 8 | +#include <qgsmapstylepanel.h> |
| 9 | +%End |
| 10 | +public: |
| 11 | + /** |
| 12 | + * @brief A panel widget that can be shown in the map style dock |
| 13 | + * @param layer The layer active in the dock. |
| 14 | + * @param canvas The canvas object. |
| 15 | + * @param parent The parent of the widget. |
| 16 | + * @note The widget is created each time the panel is selected in the dock. |
| 17 | + * Keep the loading light as possible for speed in the UI. |
| 18 | + */ |
| 19 | + QgsMapStylePanel(QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent = 0); |
| 20 | + |
| 21 | +signals: |
| 22 | + /** |
| 23 | + * @brief Nofity the map style dock that something has changed and |
| 24 | + * we need to update the map. |
| 25 | + * You should emit this when any of the widgets are changed if live |
| 26 | + * update is enabled apply() will get called to apply the changes to the layer. |
| 27 | + */ |
| 28 | + void widgetChanged(); |
| 29 | + |
| 30 | +public slots: |
| 31 | + |
| 32 | + /** |
| 33 | + * @brief Called when changes to the layer need to be made. |
| 34 | + * Will be called when live update is enabled. |
| 35 | + */ |
| 36 | + virtual void apply() = 0; |
| 37 | +}; |
| 38 | + |
| 39 | + |
| 40 | +/** \ingroup gui |
| 41 | + * \class QgsMapStylePanelFactory |
| 42 | + * \note added in QGIS 2.16 |
| 43 | + */ |
| 44 | +class QgsMapStylePanelFactory |
| 45 | +{ |
| 46 | +%TypeHeaderCode |
| 47 | +#include <qgsmapstylepanel.h> |
| 48 | +%End |
| 49 | + public: |
| 50 | + /** Constructor */ |
| 51 | + QgsMapStylePanelFactory(); |
| 52 | + |
| 53 | + /** Destructor */ |
| 54 | + virtual ~QgsMapStylePanelFactory(); |
| 55 | + |
| 56 | + /** |
| 57 | + * @brief The icon that will be shown in the UI for the panel. |
| 58 | + * @return A QIcon for the panel icon. |
| 59 | + */ |
| 60 | + virtual QIcon icon() = 0; |
| 61 | + |
| 62 | + /** |
| 63 | + * @brief The title of the panel.. |
| 64 | + * @note This may or may not be shown to the user. |
| 65 | + * @return Title of the panel |
| 66 | + */ |
| 67 | + virtual QString title() = 0; |
| 68 | + |
| 69 | + /** |
| 70 | + * @brief Supported layer type for the widget. |
| 71 | + * @return The layer type this widget is supported for. |
| 72 | + */ |
| 73 | + virtual QgsMapLayer::LayerType layerType() = 0; |
| 74 | + |
| 75 | + /** |
| 76 | + * @brief Factory fucntion to create the widget on demand as needed by the dock. |
| 77 | + * @note This function is called each time the panel is selected. Keep it light for better UX. |
| 78 | + * @param layer The active layer in the dock. |
| 79 | + * @param canvas The map canvas. |
| 80 | + * @param parent The parent of the widget. |
| 81 | + * @return A new QgsMapStylePanel which is shown in the map style dock. |
| 82 | + */ |
| 83 | + virtual QgsMapStylePanel* createPanel( QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget* parent /TransferThis/ ) = 0 /Factory/; |
| 84 | +}; |
0 commit comments