Skip to content

Commit

Permalink
Merge pull request #4641 from nyalldawson/alpha
Browse files Browse the repository at this point in the history
Unify opacity UI/API, pt 1
  • Loading branch information
nyalldawson committed May 30, 2017
2 parents 9e11082 + e8b11a3 commit efe6109
Show file tree
Hide file tree
Showing 167 changed files with 2,419 additions and 2,493 deletions.
61 changes: 61 additions & 0 deletions doc/api_break.dox
Expand Up @@ -528,6 +528,12 @@ QgsAuthMethod {#qgis_api_break_3_0_QgsAuthMethod}
- DataSourceURI has been renamed to DataSourceUri
- GenericDataSourceURI has been renamed to GenericDataSourceUri

QgsBlurEffect {#qgis_api_break_3_0_QgsBlurEffect}
-------------

- setTransparency and transparency were removed. Use setOpacity and opacity instead.


QgsBrowserModel {#qgis_api_break_3_0_QgsBrowserModel}
---------------

Expand Down Expand Up @@ -573,6 +579,19 @@ QgsColorButton {#qgis_api_break_3_0_QgsColorButton}
--------------

- Behaviour enum and its corresponding setter/getter have been renamed to Behavior <!--#spellok-->
- setAllowAlpha() and allowAlpha() were removed. Use setAllowOpacity() and allowOpacity() instead.


QgsColorDialog {#qgis_api_break_3_0_QgsColorDialog}
--------------

- setAllowAlpha() was removed. Use setAllowOpacity() instead.


QgsColorEffect {#qgis_api_break_3_0_QgsColorEffect}
-------------

- setTransparency and transparency were removed. Use setOpacity and opacity instead.


QgsColorRampShader {#qgis_api_break_3_0_QgsColorRampShader}
Expand Down Expand Up @@ -615,6 +634,12 @@ Use the corresponding methods in QgsComposerUtils instead.
instead.
- lockSymbolSize(), imageSizeConsideringRotation(), cornerPointOnRotatedAndScaledRect(),
sizeChangedByRotation() were removed. No replacement is offered for these methods.
- transparency() and setTransparency() were removed. Use itemOpacity() and setItemOpacity() instead.

QgsComposerItemCommand {#qgis_api_break_3_0_QgsComposerItemCommand}
----------------------

- ItemTransparency was removed. Use ItemOpacity instead.


QgsComposerLabel {#qgis_api_break_3_0_QgsComposerLabel}
Expand Down Expand Up @@ -783,6 +808,12 @@ all these item added events.
- addComposerMap no longer takes a setDefaultPreviewStyle argument.
- the mapsToRestore parameter has been removed from addItemsFromXml

QgsCompoundColorWidget {#qgis_api_break_3_0_QgsCompoundColorWidget}
----------------------

- setAllowAlpha() was removed. Use setAllowOpacity() instead.


QgsConditionalLayerStyle {#qgis_api_break_3_0_QgsConditionalLayerStyle}
------------------------

Expand Down Expand Up @@ -992,6 +1023,8 @@ QgsDiagramSettings {#qgis_api_break_3_0_QgsDiagramSettings}

- The SizeType enum was removed. Use QgsUnitTypes.RenderUnit instead.
- readXml() and writeXml() do not take QgsVectorLayer as an argument anymore.
- transparency was removed. Use opacity instead.


QgsDial {#qgis_api_break_3_0_QgsDial}
-------
Expand All @@ -1015,6 +1048,12 @@ willUseEllipsoid() to determine whether ellipsoidal calculations will be perform
- convertMeasurement was removed. Use QgsUnitTypes for conversion instead.


QgsDrawSourceEffect {#qgis_api_break_3_0_QgsDrawSourceEffect}
-------------------

- setTransparency and transparency were removed. Use setOpacity and opacity instead.


QgsDxfExport {#qgis_api_break_3_0_QgsDxfExport}
------------

Expand Down Expand Up @@ -1206,6 +1245,12 @@ QgsGeometrySimplifier {#qgis_api_break_3_0_QgsGeometrySimplifier}
- simplifyGeometry() has been removed and simplify() must be used instead .


QgsGlowEffect {#qgis_api_break_3_0_QgsGlowEffect}
-------------

- setTransparency and transparency were removed. Use setOpacity and opacity instead.


QgsGradientColorRampDialog {#qgis_api_break_3_0_QgsGradientColorRampDialog}
---------

Expand Down Expand Up @@ -1806,6 +1851,12 @@ QProgressDialog argument will need to be updated using manually created connecti
signals and the updates to the progress dialog.


QgsRasterFillSymbolLayer {#qgis_api_break_3_0_QgsRasterFillSymbolLayer}
-----------------

- alpha() and setAlpha() were removed. Use opacity() and setOpacity() instead.


QgsRasterInterface {#qgis_api_break_3_0_QgsRasterInterface}
------------------

Expand Down Expand Up @@ -1956,6 +2007,13 @@ QgsServer {#qgis_api_break_3_0_QgsServer}
- QgsServer::handleRequest( const QString &urlstr ) has been removed in favour of the new
- QgsServer::handleRequest( QgsServerRequest &request, QgsServerResponse &response ) has been added


QgsShadowEffect {#qgis_api_break_3_0_QgsShadowEffect}
---------------

- setTransparency and transparency were removed. Use setOpacity and opacity instead.


QgsShortcutsManager {#qgis_api_break_3_0_QgsShortcutsManager}
-------------------

Expand Down Expand Up @@ -2070,6 +2128,7 @@ than an integer value
- usedAttributes() now requires a QgsRenderContext argument.
- setDataDefinedAngle(), dataDefinedAngle(), setDataDefinedSize(), dataDefinedSize(), setDataDefinedWidth() and dataDefinedWidth()
now work with QgsProperty objects instead of QgsDataDefined.
- alpha() and setAlpha() were removed. Use opacity() and setOpacity() instead.


QgsSymbolLayer (renamed from QgsSymbolLayerV2) {#qgis_api_break_3_0_QgsSymbolLayer}
Expand Down Expand Up @@ -2108,6 +2167,7 @@ QgsSymbolRenderContext (renamed from QgsSymbolV2RenderContext) {#qgis_api
- The constructor, setRenderHints() and renderHints() now accept and return a QgsSymbol::RenderHints flag rather
than an integer value
- fields() now returns a QgsFields value, not a pointer.
- alpha() and setAlpha() were removed. Use opacity() and setOpacity() instead.


QgsSymbolLayerUtils (renamed from QgsSymbolLayerUtilsV2) {#qgis_api_break_3_0_QgsSymbolLayerUtils}
Expand Down Expand Up @@ -2265,6 +2325,7 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.
- addFeature() no longer accepts an alsoUpdateExtent boolean - this extra argument has been ignored for some time
- addFeatures() no longer accepts a makeSelected boolean, and will not automatically select newly added features. If desired, features must be manually selected by calling selectByIds() after addFeatures()
- annotationForm() and setAnnotationForm() have been removed. Form path is stored in individual QgsFormAnnotation objects.
- setLayerTransparency, layerTransparency, and layerTransparencyChanged were removed. Use opacity, setOpacity and opacityChanged instead.


QgsVectorLayerEditBuffer {#qgis_api_break_3_0_QgsVectorLayerEditBuffer}
Expand Down
13 changes: 2 additions & 11 deletions python/core/composer/qgscomposeritem.sip
Expand Up @@ -404,17 +404,8 @@ class QgsComposerItem : QgsComposerObject, QGraphicsRectItem
*/
void setBlendMode( const QPainter::CompositionMode blendMode );

/** Returns the item's transparency
* @returns transparency as integer between 0 (transparent) and 255 (opaque)
* @see setTransparency
*/
int transparency() const;

/** Sets the item's transparency
* @param transparency integer between 0 (transparent) and 255 (opaque)
* @see transparency
*/
void setTransparency( const int transparency );
double itemOpacity() const;
void setItemOpacity( const double opacity );

/** Returns whether effects (e.g., blend modes) are enabled for the item
* @returns true if effects are enabled
Expand Down
2 changes: 1 addition & 1 deletion python/core/composer/qgscomposeritemcommand.sip
Expand Up @@ -112,7 +112,7 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
ItemBackgroundColor,
ItemMove,
ItemRotation,
ItemTransparency,
ItemOpacity,
ItemZoomContent
};

Expand Down
1 change: 1 addition & 0 deletions python/core/composer/qgscomposerobject.sip
Expand Up @@ -30,6 +30,7 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
ItemHeight, /*!< height of item */
ItemRotation, /*!< rotation of item */
Transparency, /*!< item transparency */
Opacity,
BlendMode, /*!< item blend mode */
ExcludeFromExports, /*!< exclude item from exports */
FrameColor, //!< Item frame color
Expand Down
20 changes: 10 additions & 10 deletions python/core/effects/qgsblureffect.sip
Expand Up @@ -78,20 +78,20 @@ class QgsBlurEffect : QgsPaintEffect
:rtype: BlurMethod
%End

void setTransparency( const double transparency );
void setOpacity( const double opacity );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
Sets the ``opacity`` for the effect.
\param opacity double between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: opacity()
%End

double transparency() const;
double opacity() const;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
Returns the opacity for the effect.
:return: opacity value between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: setOpacity()
:rtype: float
%End

Expand Down
20 changes: 10 additions & 10 deletions python/core/effects/qgscoloreffect.sip
Expand Up @@ -171,20 +171,20 @@ class QgsColorEffect : QgsPaintEffect
:rtype: int
%End

void setTransparency( const double transparency );
void setOpacity( const double opacity );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
Sets the ``opacity`` for the effect.
\param opacity double between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: opacity()
%End

double transparency() const;
double opacity() const;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
Returns the opacity for the effect.
:return: opacity value between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque.
.. seealso:: setOpacity()
:rtype: float
%End

Expand Down
20 changes: 10 additions & 10 deletions python/core/effects/qgsgloweffect.sip
Expand Up @@ -113,20 +113,20 @@ class QgsGlowEffect : QgsPaintEffect
:rtype: int
%End

void setTransparency( const double transparency );
void setOpacity( const double opacity );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
Sets the ``opacity`` for the effect.
\param opacity double between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: opacity()
%End

double transparency() const;
double opacity() const;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
Returns the opacity for the effect.
:return: opacity value between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: setOpacity().
:rtype: float
%End

Expand Down
20 changes: 10 additions & 10 deletions python/core/effects/qgspainteffect.sip
Expand Up @@ -311,20 +311,20 @@ class QgsDrawSourceEffect : QgsPaintEffect
virtual QgsStringMap properties() const;
virtual void readProperties( const QgsStringMap &props );

void setTransparency( const double transparency );
void setOpacity( const double opacity );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
Sets the ``opacity`` for the effect.
\param opacity double between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: opacity()
%End

double transparency() const;
double opacity() const;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
Returns the opacity for the effect
:return: opacity value between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: setOpacity()
:rtype: float
%End

Expand Down
20 changes: 10 additions & 10 deletions python/core/effects/qgsshadoweffect.sip
Expand Up @@ -133,20 +133,20 @@ class QgsShadowEffect : QgsPaintEffect
:rtype: QColor
%End

void setTransparency( const double transparency );
void setOpacity( const double opacity );
%Docstring
Sets the transparency for the effect
\param transparency double between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: transparency
Sets the ``opacity`` for the effect.
\param opacity double between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: opacity()
%End

double transparency() const;
double opacity() const;
%Docstring
Returns the transparency for the effect
:return: transparency value between 0 and 1 inclusive, where 0 is fully opaque
and 1 is fully transparent
.. seealso:: setTransparency
Returns the opacity for the effect.
:return: opacity value between 0 and 1 inclusive, where 0 is fully transparent
and 1 is fully opaque
.. seealso:: setOpacity()
:rtype: float
%End

Expand Down
4 changes: 2 additions & 2 deletions python/core/qgscolorramp.sip
Expand Up @@ -246,11 +246,11 @@ Creates a new QgsColorRamp from a map of properties
.. seealso:: info()
%End

void addStopsToGradient( QGradient *gradient, double alpha = 1 );
void addStopsToGradient( QGradient *gradient, double opacity = 1 );
%Docstring
Copy color ramp stops to a QGradient
\param gradient gradient to copy stops into
\param alpha alpha multiplier. Opacity of colors will be multiplied
\param opacity opacity multiplier. Opacity of colors will be multiplied
by this factor before adding to the gradient.
.. versionadded:: 2.1
%End
Expand Down
7 changes: 6 additions & 1 deletion python/core/qgsdiagramrenderer.sip
Expand Up @@ -358,7 +358,12 @@ class QgsDiagramSettings
LabelPlacementMethod labelPlacementMethod;
DiagramOrientation diagramOrientation;
double barWidth;
int transparency; // 0 - 100

double opacity;
%Docstring
Opacity, from 0 (transparent) to 1.0 (opaque)
%End

bool scaleByArea;
int angleOffset;

Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsmaplayerstylemanager.sip
Expand Up @@ -15,7 +15,7 @@
class QgsMapLayerStyle
{
%Docstring
Stores style information (renderer, transparency, labeling, diagrams etc.) applicable to a map layer.
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.

Stored data are considered as opaque - it is not possible to access them directly or modify them - it is
only possible to read or write layer's current style.
Expand Down Expand Up @@ -83,7 +83,7 @@ class QgsMapLayerStyleManager : QObject
the new style is applied to the associated layer.

The class takes care of updating itself when the layer's current style configuration changes.
When some of layer style's properties change (e.g. transparency / colors), the style manager will
When some of layer style's properties change (e.g. opacity / colors), the style manager will
record them in the currently active style without any extra effort required.

When an instance is created, it creates "default" style (with empty name) recorded from the associated map layer
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsmultirenderchecker.sip
Expand Up @@ -117,7 +117,7 @@ class QgsMultiRenderChecker

static void drawBackground( QImage *image );
%Docstring
Draws a checkboard pattern for image backgrounds, so that transparency is visible
Draws a checkboard pattern for image backgrounds, so that opacity is visible
without requiring a transparent background for the image
%End

Expand Down

0 comments on commit efe6109

Please sign in to comment.