https://issues.qgis.org/https://issues.qgis.org/favicon.ico2012-06-06T06:28:28ZQGIS Issue TrackingQGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326022012-06-06T06:28:28ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul><li><strong>Assignee</strong> set to <i>Marco Hugentobler</i></li></ul> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326062012-06-06T12:33:19ZWerner Machowerner.macho@gmail.com
<ul></ul><p>not confirmed here - latest master self compiled - testfiles are displayed transparently with every value from 0 - 100</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326072012-06-06T12:40:08ZLarry Shaffer
<ul><li><strong>File</strong> <a href="/attachments/download/4551/5749_8b.png">5749_8b.png</a> added</li></ul><p>Not confirmed with Mac OS X 10.6.8 (1.8_c695198). Transparency works as expected with test data.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326082012-06-06T12:49:58ZTim Suttontim@linfiniti.com
<ul></ul><p>Works for me on desktop. He has set the category to mapserver so I wonder if it fails only when publishing the layer via wms.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326142012-06-06T21:07:43ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><p>The problem is that the double alpha value in the project file has a comma instead of a dot:</p>
<pre>
<symbols>
<symbol outputUnit="MM" alpha="0,6784313725490196" type="fill" name="0">
</pre>
<p>And it should be:</p>
<pre>
<symbols>
<symbol outputUnit="MM" alpha="0.6784313725490196" type="fill" name="0">
</pre>
<p>With that modification, it works here.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326162012-06-06T22:03:22ZBernhard Ströblbernhard.stroebl@jena.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote>
<p>The problem is that the double alpha value in the project file has a comma instead of a dot:</p>
<p><symbols><br /><symbol outputUnit="MM" alpha="0,6784313725490196" type="fill" name="0"></p>
<p>And it should be:</p>
<p><symbols><br /><symbol outputUnit="MM" alpha="0.6784313725490196" type="fill" name="0"></p>
<p>With that modification, it works here.</p>
</blockquote>
<p>ok, I checked here: QGIS 1.7.4 writes a dot (alpha="0.6784313725490196") whereas 1.8 writes a comma (alpha="0,6784313725490196") this maybe because it is a German system and we use a comma instead of dot for decimalsand yes, only QGIS Server is affected</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326182012-06-06T22:22:45ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>this <a class="issue tracker-1 status-5 priority-3 priority- closed" href="https://issues.qgis.org/issues/2104" title="snapping tolerance and vertex search radius not configurable anymore with changed decimal symbol (Closed)">#2104</a> seems also related.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326202012-06-06T22:27:32ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><blockquote>
<p>and yes, only QGIS Server is affected</p>
</blockquote>
<p>I have the same behaviour (alpha with comma does not work) in the desktop application. Probably it depends on your settings or locale (though mine is de_CH.UTF-8).</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326232012-06-06T22:43:31ZJürgen Fischerjef@norbit.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote><blockquote>
<p>and yes, only QGIS Server is affected</p>
</blockquote>
<p>I have the same behaviour (alpha with comma does not work) in the desktop application. Probably it depends on your settings or locale (though mine is de_CH.UTF-8).</p>
</blockquote>
<p>are desktop and server running in different environments?</p>
<p>Why are we using <code>QDomElement::setAttribute ( const QString & name, const QString & value )</code> with <code>QString::number</code> all over the place, when we just could use the version for <code>double</code> and/or <code>int</code>.</p>
<p>Like in <a class="external" href="https://gist.github.com/2887218">https://gist.github.com/2887218</a> (compiles, but not tested).</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326252012-06-06T23:27:46ZBernhard Ströblbernhard.stroebl@jena.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote><blockquote>
<p>and yes, only QGIS Server is affected</p>
</blockquote>
<p>I have the same behaviour (alpha with comma does not work) in the desktop application. Probably it depends on your settings or locale (though mine is de_CH.UTF-8).</p>
</blockquote>
<p>mine is de_DE (also UTF-8)</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326652012-06-07T21:51:23ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><blockquote>
<p>Why are we using QDomElement::setAttribute ( const QString & name, const QString & value ) with QString::number all over the place, when we just could use the version for >double and/or int.</p>
</blockquote>
<p>Because the developer was not aware there is a formating difference between these two.<br />But looking at the Qt documentation, I think it is better if we format numbers in the project file not according to the locale. Imagine in an international company, a person with locale de_xx prepares a project for his boss (with locale en_xx). Or someone publishes a project from the desktop to the server. So QString::number() without locale aware formating seems better to me.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326762012-06-07T23:31:34ZJürgen Fischerjef@norbit.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote>
<p>Because the developer was not aware there is a formating difference between these two.</p>
</blockquote>
<p>There isn't any, is it? The documentation clearly says that those are localized too.<br />So which dumb developer suggested to use <code>QDomElement::setAttribute()</code> for doubles? ;)</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326772012-06-07T23:41:44ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><blockquote>
<p>There isn't any, is it? The documentation clearly says that those are localized too.</p>
</blockquote>
<p>I'm a bit confused. I interpreted it the way they are not localized (but I did not really test it):</p>
<p>"Unlike QLocale::toString(), this function does not honor the user's locale settings" (<a class="external" href="http://qt-project.org/doc/qt-4.8/qstring.html#number-2">http://qt-project.org/doc/qt-4.8/qstring.html#number-2</a>)</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326802012-06-08T02:16:43ZJürgen Fischerjef@norbit.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote><blockquote>
<p>There isn't any, is it? The documentation clearly says that those are localized too.</p>
</blockquote>
<p>I'm a bit confused. I interpreted it the way they are not localized (but I did not really test it):</p>
</blockquote>
<p>Sorry.</p>
<p>My assumption was, that localization of XML attributes doesn't make any sense and therefore I (dumb me) suggested the double version of <code>QDomElement::setAttribute</code>. Obviously that's wrong, because its documentation (which I didn't read before) clearly says that the output <em>is</em> localized.</p>
<blockquote>
<p>"Unlike QLocale::toString(), this function does not honor the user's locale settings" (<a class="external" href="http://qt-project.org/doc/qt-4.8/qstring.html#number-2">http://qt-project.org/doc/qt-4.8/qstring.html#number-2</a>)</p>
</blockquote>
<p>Yes - of course. Ignore everything I said.</p>
<p>Looks like that's the actual fix:</p>
<pre>
diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.cpp b/src/core/symbology-ng/qgssymbollayerv2utils.cpp
index 89074e4..38d1ad3 100644
--- a/src/core/symbology-ng/qgssymbollayerv2utils.cpp
+++ b/src/core/symbology-ng/qgssymbollayerv2utils.cpp
@@ -713,7 +713,7 @@ QDomElement QgsSymbolLayerV2Utils::saveSymbol( QString name, QgsSymbolV2* symbol
symEl.setAttribute( "type", _nameForSymbolType( symbol->type() ) );
symEl.setAttribute( "name", name );
symEl.setAttribute( "outputUnit", encodeOutputUnit( symbol->outputUnit() ) );
- symEl.setAttribute( "alpha", symbol->alpha() );
+ symEl.setAttribute( "alpha", QString::number( symbol->alpha() ) );
QgsDebugMsg( "num layers " + QString::number( symbol->symbolLayerCount() ) );
for ( int i = 0; i < symbol->symbolLayerCount(); i++ )
{
</pre> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326832012-06-08T03:52:32ZJürgen Fischerjef@norbit.de
<ul></ul><p>Jürgen Fischer wrote:</p>
<blockquote>
<p>Looks like that's the actual fix:</p>
<p>[...]</p>
</blockquote>
<p>Um, but that's just one place. I declared the two Qt methods deprecated in <code>qdom.h</code>:</p>
<pre>
Q_DECL_DEPRECATED void setAttribute(const QString& name, float value);
Q_DECL_DEPRECATED void setAttribute(const QString& name, double value);
</pre>
<p>And <a class="external" href="https://gist.github.com/2895431">https://gist.github.com/2895431</a> is the rather large patch that is needed to fix all the deprecation warnings:</p>
<pre>
src/core/composer/qgscomposerarrow.cpp | 12 +++++-----
src/core/composer/qgscomposeritem.cpp | 12 +++++-----
src/core/composer/qgscomposerlegend.cpp | 4 +-
src/core/composer/qgscomposermap.cpp | 22 +++++++++---------
src/core/composer/qgscomposerpicture.cpp | 4 +-
src/core/composer/qgscomposerscalebar.cpp | 14 +++++-----
src/core/composer/qgscomposershape.cpp | 6 ++--
src/core/composer/qgscomposertable.cpp | 4 +-
src/core/composer/qgscomposition.cpp | 10 ++++----
src/core/qgsdiagramrendererv2.cpp | 24 ++++++++++----------
src/core/qgslabel.cpp | 10 ++++----
src/core/qgsmaplayer.cpp | 8 +++---
src/core/qgsvectorlayer.cpp | 4 +-
.../symbology-ng/qgsgraduatedsymbolrendererv2.cpp | 4 +-
.../symbology-ng/qgspointdisplacementrenderer.cpp | 6 ++--
src/core/symbology-ng/qgssymbollayerv2utils.cpp | 2 +-
src/gui/qgsannotationitem.cpp | 18 +++++++-------
src/mapserver/qgswmsserver.cpp | 16 ++++++------
.../qgsrasterterrainanalysisdialog.cpp | 4 +-
19 files changed, 92 insertions(+), 92 deletions(-)
</pre>
<p>Still untested. I wonder why nobody noticed so far - I suppose anyone using a localization with a comma instead of a dot should have suffered from truncation of decimal places, which using <code>QDomElement::setAttribute(...,somedouble)</code> to write and <code>QDomElement::attribute(...).toDouble()</code> to read should produce.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326852012-06-08T05:45:13ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><p>Thanks Jürgen, please apply the patch.</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326872012-06-08T07:36:57ZJürgen Fischerjef@norbit.de
<ul></ul><p>Marco Hugentobler wrote:</p>
<blockquote>
<p>Thanks Jürgen, please apply the patch.</p>
</blockquote>
<p>The large one or the small one? ;)</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326882012-06-08T07:48:48ZMarco Hugentoblermarco.hugentobler@sourcepole.ch
<ul></ul><p>The large one</p> QGIS Application - Bug report #5749: transparent polygons not renderedhttps://issues.qgis.org/issues/5749?journal_id=326892012-06-08T07:51:50ZJürgen Fischerjef@norbit.de
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/ee2f1bdbaf20c37bb8ba5026b5de73f58a0b6ad0" title="Use QString::number with QDomElement::setAttribute with double/float (fixes #5749)">ee2f1bdbaf20c37bb8ba5026b5de73f58a0b6ad0</a>.</p>