Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[Style Dock] Add interface for plugins to add panels to dock
- Loading branch information
Showing
with
376 additions
and 117 deletions.
- +1 −0 python/gui/gui.sip
- +6 −0 python/gui/qgisinterface.sip
- +84 −0 python/gui/qgsmapstylepanel.sip
- +15 −1 src/app/qgisapp.cpp
- +8 −0 src/app/qgisapp.h
- +10 −0 src/app/qgisappinterface.cpp
- +6 −0 src/app/qgisappinterface.h
- +122 −113 src/app/qgsmapstylingwidget.cpp
- +6 −1 src/app/qgsmapstylingwidget.h
- +2 −2 src/gui/CMakeLists.txt
- +7 −0 src/gui/qgisinterface.h
- +17 −0 src/gui/qgsmapstylepanel.cpp
- +92 −0 src/gui/qgsmapstylepanel.h
@@ -0,0 +1,84 @@ | ||
/** \ingroup gui | ||
* \class A panel widget that can be shown in the map style dock | ||
* \note added in QGIS 2.16 | ||
*/ | ||
class QgsMapStylePanel : public QWidget | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsmapstylepanel.h> | ||
%End | ||
public: | ||
/** | ||
* @brief A panel widget that can be shown in the map style dock | ||
* @param layer The layer active in the dock. | ||
* @param canvas The canvas object. | ||
* @param parent The parent of the widget. | ||
* @note The widget is created each time the panel is selected in the dock. | ||
* Keep the loading light as possible for speed in the UI. | ||
*/ | ||
QgsMapStylePanel(QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent = 0); | ||
|
||
signals: | ||
/** | ||
* @brief Nofity the map style dock that something has changed and | ||
* we need to update the map. | ||
* You should emit this when any of the widgets are changed if live | ||
* update is enabled apply() will get called to apply the changes to the layer. | ||
*/ | ||
void widgetChanged(); | ||
|
||
public slots: | ||
|
||
/** | ||
* @brief Called when changes to the layer need to be made. | ||
* Will be called when live update is enabled. | ||
*/ | ||
virtual void apply() = 0; | ||
}; | ||
|
||
|
||
/** \ingroup gui | ||
* \class QgsMapStylePanelFactory | ||
* \note added in QGIS 2.16 | ||
*/ | ||
class QgsMapStylePanelFactory | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsmapstylepanel.h> | ||
%End | ||
public: | ||
/** Constructor */ | ||
QgsMapStylePanelFactory(); | ||
|
||
/** Destructor */ | ||
virtual ~QgsMapStylePanelFactory(); | ||
|
||
/** | ||
* @brief The icon that will be shown in the UI for the panel. | ||
* @return A QIcon for the panel icon. | ||
*/ | ||
virtual QIcon icon() = 0; | ||
|
||
/** | ||
* @brief The title of the panel.. | ||
* @note This may or may not be shown to the user. | ||
* @return Title of the panel | ||
*/ | ||
virtual QString title() = 0; | ||
|
||
/** | ||
* @brief Supported layer type for the widget. | ||
* @return The layer type this widget is supported for. | ||
*/ | ||
virtual QgsMapLayer::LayerType layerType() = 0; | ||
|
||
/** | ||
* @brief Factory fucntion to create the widget on demand as needed by the dock. | ||
* @note This function is called each time the panel is selected. Keep it light for better UX. | ||
* @param layer The active layer in the dock. | ||
* @param canvas The map canvas. | ||
* @param parent The parent of the widget. | ||
* @return A new QgsMapStylePanel which is shown in the map style dock. | ||
*/ | ||
virtual QgsMapStylePanel* createPanel( QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget* parent /TransferThis/ ) = 0 /Factory/; | ||
}; |
Oops, something went wrong.