Skip to content
Permalink
Browse files

[style dock] Add better API for panels

  • Loading branch information
NathanW2 committed Jun 13, 2016
1 parent 16eb1e1 commit e926e2d0aafed33dea466b3832579b6f50ce8c8f
Showing with 1,018 additions and 822 deletions.
  1. +2 −21 python/gui/effects/qgseffectstackpropertieswidget.sip
  2. +1 −1 python/gui/gui.sip
  3. +2 −2 python/gui/qgisinterface.sip
  4. +1 −1 python/gui/qgsmaplayerstylemanagerwidget.sip
  5. +6 −6 python/gui/qgsmapstylepanel.sip
  6. +1 −1 python/gui/raster/qgsrendererrasterpropertieswidget.sip
  7. +1 −1 python/gui/symbology-ng/qgslayerpropertieswidget.sip
  8. +2 −12 python/gui/symbology-ng/qgsrendererv2propertiesdialog.sip
  9. +8 −13 python/gui/symbology-ng/qgsrendererv2widget.sip
  10. +0 −55 python/gui/symbology-ng/qgsrendererwidgetcontainer.sip
  11. +2 −0 python/gui/symbology-ng/qgssinglesymbolrendererv2widget.sip
  12. +98 −0 python/gui/symbology-ng/qgssymbolv2selectordialog.sip
  13. +2 −2 src/app/qgisapp.cpp
  14. +4 −4 src/app/qgisapp.h
  15. +2 −2 src/app/qgisappinterface.cpp
  16. +2 −2 src/app/qgisappinterface.h
  17. +11 −9 src/app/qgsmapstylingwidget.cpp
  18. +7 −7 src/app/qgsmapstylingwidget.h
  19. +1 −0 src/app/qgsvectorlayerproperties.cpp
  20. +2 −2 src/gui/CMakeLists.txt
  21. +12 −12 src/gui/effects/qgseffectstackpropertieswidget.cpp
  22. +6 −17 src/gui/effects/qgseffectstackpropertieswidget.h
  23. +3 −3 src/gui/qgisinterface.h
  24. +1 −1 src/gui/qgsmaplayerstylemanagerwidget.cpp
  25. +1 −1 src/gui/qgsmaplayerstylemanagerwidget.h
  26. +5 −4 src/gui/qgsmapstylepanel.cpp
  27. +7 −15 src/gui/qgsmapstylepanel.h
  28. +1 −1 src/gui/raster/qgsrendererrasterpropertieswidget.cpp
  29. +1 −1 src/gui/raster/qgsrendererrasterpropertieswidget.h
  30. +15 −18 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
  31. +2 −2 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h
  32. +14 −17 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  33. +2 −2 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h
  34. +15 −1 src/gui/symbology-ng/qgslayerpropertieswidget.cpp
  35. +10 −1 src/gui/symbology-ng/qgslayerpropertieswidget.h
  36. +13 −18 src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp
  37. +10 −13 src/gui/symbology-ng/qgsrendererv2propertiesdialog.h
  38. +7 −1 src/gui/symbology-ng/qgsrendererv2widget.cpp
  39. +10 −15 src/gui/symbology-ng/qgsrendererv2widget.h
  40. +0 −54 src/gui/symbology-ng/qgsrendererwidgetcontainer.cpp
  41. +0 −84 src/gui/symbology-ng/qgsrendererwidgetcontainer.h
  42. +10 −1 src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp
  43. +9 −2 src/gui/symbology-ng/qgssinglesymbolrendererv2widget.h
  44. +205 −49 src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
  45. +185 −5 src/gui/symbology-ng/qgssymbolv2selectordialog.h
  46. +7 −2 src/ui/qgsrendererv2propsdialogbase.ui
  47. +249 −297 src/ui/qgssymbolv2selectordialogbase.ui
  48. +63 −44 src/ui/styledock/qgsrenderercontainerbase.ui
@@ -9,7 +9,7 @@
* \see QgsEffectStackCompactWidget
*/

class QgsEffectStackPropertiesWidget : QWidget
class QgsEffectStackPropertiesWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgseffectstackpropertieswidget.h>
@@ -66,18 +66,6 @@ class QgsEffectStackPropertiesWidget : QWidget
*/
void changeEffect( QgsPaintEffect* newEffect );

signals:
/**
* Emitted when something in the widget changes.
*/
void widgetChanged();

/** Emitted when a panel is shown in the widget.
* @param widget widget panel which was shown
* @note added in QGIS 2.16
*/
void showPanel( QgsRendererWidgetContainer* widget );

protected:

/** Refreshes the widget to reflect the current state of the stack.
@@ -159,7 +147,7 @@ class QgsEffectStackPropertiesDialog : QgsDialog
* \see QgsEffectStackPropertiesDialog
*/

class QgsEffectStackCompactWidget : QWidget
class QgsEffectStackCompactWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgseffectstackpropertieswidget.h>
@@ -206,11 +194,4 @@ class QgsEffectStackCompactWidget : QWidget
/** Emitted when the paint effect properties change
*/
void changed();

/** Emitted when a panel is shown in the widget.
* @param widget widget panel which was shown
* @note added in QGIS 2.16
*/
void showPanel( QgsRendererWidgetContainer* widget );

};
@@ -135,6 +135,7 @@
%Include qgsoptionsdialogbase.sip
%Include qgsorderbydialog.sip
%Include qgsowssourceselect.sip
%Include qgspanelwidget.sip
%Include qgspixmaplabel.sip
%Include qgspluginmanagerinterface.sip
%Include qgsprevieweffect.sip
@@ -252,7 +253,6 @@
%Include symbology-ng/qgsvectorfieldsymbollayerwidget.sip
%Include symbology-ng/qgsvectorgradientcolorrampv2dialog.sip
%Include symbology-ng/qgsvectorrandomcolorrampv2dialog.sip
%Include symbology-ng/qgsrendererwidgetcontainer.sip

%Include effects/qgseffectdrawmodecombobox.sip
%Include effects/qgseffectstackpropertieswidget.sip
@@ -293,10 +293,10 @@ class QgisInterface : QObject
virtual void unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory ) = 0;

/** Register a new tab in the layer properties dialog */
virtual void registerMapStylePanelFactory( QgsMapStylePanelFactory* factory ) = 0;
virtual void registerMapStylePanelFactory( QgsMapStylingPanelFactory* factory ) = 0;

/** Unregister a previously registered tab in the layer properties dialog */
virtual void unregisterMapStylePanelFactory( QgsMapStylePanelFactory* factory ) = 0;
virtual void unregisterMapStylePanelFactory( QgsMapStylingPanelFactory* factory ) = 0;

// @todo is this deprecated in favour of QgsContextHelp?
/** Open a url in the users browser. By default the QGIS doc directory is used
@@ -2,7 +2,7 @@
* @brief The QgsMapLayerStyleManagerWidget class which is used to visually manage
* the layer styles.
*/
class QgsMapLayerStyleManagerWidget : QgsMapStylePanel
class QgsMapLayerStyleManagerWidget : QgsMapStylingPanel
{
%TypeHeaderCode
#include "qgsmaplayerstylemanagerwidget.h"
@@ -2,7 +2,7 @@
* \class A panel widget that can be shown in the map style dock
* \note added in QGIS 2.16
*/
class QgsMapStylePanel : public QWidget
class QgsMapStylingPanel : public QgsPanelWidget
{
%TypeHeaderCode
#include <qgsmapstylepanel.h>
@@ -16,7 +16,7 @@ public:
* @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);
QgsMapStylingPanel(QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent = 0);

signals:
/**
@@ -41,7 +41,7 @@ public slots:
* \class QgsMapStylePanelFactory
* \note added in QGIS 2.16
*/
class QgsMapStylePanelFactory
class QgsMapStylingPanelFactory
{
%TypeHeaderCode
#include <qgsmapstylepanel.h>
@@ -50,10 +50,10 @@ class QgsMapStylePanelFactory
typedef QFlags<QgsMapLayer::LayerType> LayerTypesFlags;

/** Constructor */
QgsMapStylePanelFactory();
QgsMapStylingPanelFactory();

/** Destructor */
virtual ~QgsMapStylePanelFactory();
virtual ~QgsMapStylingPanelFactory();

/**
* @brief The icon that will be shown in the UI for the panel.
@@ -82,5 +82,5 @@ class QgsMapStylePanelFactory
* @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/;
virtual QgsMapStylingPanel* createPanel( QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget* parent /TransferThis/ ) = 0 /Factory/;
};
@@ -1,4 +1,4 @@
class QgsRendererRasterPropertiesWidget : QgsMapStylePanel
class QgsRendererRasterPropertiesWidget : QgsMapStylingPanel
{
%TypeHeaderCode
#include <qgsrendererrasterpropertieswidget.h>
@@ -1,4 +1,4 @@
class QgsLayerPropertiesWidget : QWidget
class QgsLayerPropertiesWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgslayerpropertieswidget.h>
@@ -24,6 +24,8 @@ class QgsRendererV2PropertiesDialog : QDialog
*/
void setMapCanvas( QgsMapCanvas* canvas );

void setDockMode( bool dockMode );

signals:
/**
* Emitted when expression context variables on the associated
@@ -48,18 +50,6 @@ class QgsRendererV2PropertiesDialog : QDialog
//! Apply and accept the changes for the dialog.
void onOK();

/** Shows a panel widget inside the renderer widget.
* @param container widget panel to show
* @note added in QGIS 2.16
*/
void showPanel( QgsRendererWidgetContainer *container );

/**
* Closes the given panel in the stack of panels.
* @param container The container widget to close.
*/
void closePanel( QgsRendererWidgetContainer *container );

protected:
/**
* Connect the given slot to the value changed event for the set of widgets
@@ -1,4 +1,4 @@
class QgsRendererV2Widget : QWidget
class QgsRendererV2Widget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgsrendererv2widget.h>
@@ -39,6 +39,13 @@ class QgsRendererV2Widget : QWidget
*/
void applyChanges();

/**
* Set the widget in dock mode which tells the widget to emit panel
* widgets and not open dialogs
* @param dockMode True to enable dock mode.
*/
virtual void setDockMode( bool dockMode);

signals:
/**
* Emitted when expression context variables on the associated
@@ -47,18 +54,6 @@ class QgsRendererV2Widget : QWidget
*/
void layerVariablesChanged();

/**
* Emitted when something on the widget has changed.
* All widgets will fire this event to notify of an internal change.
*/
void widgetChanged();

/** Shows a panel widget inside the renderer widget.
* @param widget widget panel to show
* @note added in QGIS 2.16
*/
void showPanel( QgsRendererWidgetContainer* widget );

protected:
/** Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods
and by connecting the slot contextMenuViewCategories(const QPoint&)*/

This file was deleted.

@@ -13,6 +13,8 @@ class QgsSingleSymbolRendererV2Widget : QgsRendererV2Widget

virtual void setMapCanvas( QgsMapCanvas* canvas );

virtual void setDockMode( bool dockMode );

public slots:
void changeSingleSymbol();

@@ -1,3 +1,101 @@
class QgsSymbolV2SelectorWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgssymbolv2selectordialog.h>
%End

public:
QgsSymbolV2SelectorWidget( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent /TransferThis/ = 0);

//! return menu for "advanced" button - create it if doesn't exist and show the advanced button
QMenu* advancedMenu();

/** Sets the optional expression context used for the widget. This expression context is used for
* evaluating data defined symbol properties and for populating based expression widgets in
* the layer widget.
* @param context expression context pointer. Ownership is transferred to the dialog.
* @note added in QGIS 2.12
* @see expressionContext()
*/
void setExpressionContext( QgsExpressionContext* context /Transfer/ );

/** Returns the expression context used for the dialog, if set. This expression context is used for
* evaluating data defined symbol properties and for populating based expression widgets in
* the dialog.
* @note added in QGIS 2.12
* @see setExpressionContext()
*/
QgsExpressionContext* expressionContext() const;

/** Sets the map canvas associated with the dialog. This allows the widget to retrieve the current
* map scale and other properties from the canvas.
* @param canvas map canvas
* @note added in QGIS 2.12
*/
void setMapCanvas( QgsMapCanvas* canvas );

/**
* @brief Return the symbol that is currently active in the widget. Can be null.
* @return The active symbol.
*/
QgsSymbolV2* symbol();

/**
* Set the widget in dock mode which will emit showPanel when a sub widget requests
* to show a widget.
* @param dockMode True to enable dock mode.
*/
void setDockMode( bool dockMode );
protected:
//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );

void loadSymbol();
//! @note not available in python bindings
// void loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent );

void updateUi();

void updateLockButton();

//! @note not available in python bindings
// SymbolLayerItem* currentLayerItem();
QgsSymbolLayerV2* currentLayer();

void moveLayerByOffset( int offset );

void setWidget( QWidget* widget );

signals:
void symbolModified();

public slots:
void moveLayerDown();
void moveLayerUp();

void addLayer();
void removeLayer();

void lockLayer();

void saveSymbol() /Deprecated/;

//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
//! @note added in QGIS 2.14
void duplicateLayer();

void layerChanged();

void updateLayerPreview();
void updatePreview();

//! Slot to update tree when a new symbol from style
void symbolChanged();
//! alters tree and sets proper widget when Layer Type is changed
//! @note: The layer is received from the LayerPropertiesWidget
void changeLayer( QgsSymbolLayerV2* layer );
};

class QgsSymbolV2SelectorDialog : QDialog
{
%TypeHeaderCode
@@ -9063,12 +9063,12 @@ void QgisApp::unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory*
mMapLayerPropertiesFactories.removeAll( factory );
}

void QgisApp::registerMapStylePanelFactory( QgsMapStylePanelFactory *factory )
void QgisApp::registerMapStylePanelFactory( QgsMapStylingPanelFactory *factory )
{
mMapStylePanelFactories << factory;
}

void QgisApp::unregisterMapStylePanelFactory( QgsMapStylePanelFactory *factory )
void QgisApp::unregisterMapStylePanelFactory( QgsMapStylingPanelFactory *factory )
{
mMapStylePanelFactories.removeAll( factory );
}

0 comments on commit e926e2d

Please sign in to comment.
You can’t perform that action at this time.