https://issues.qgis.org/https://issues.qgis.org/favicon.ico2011-12-05T07:09:03ZQGIS Issue TrackingQGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=267132011-12-05T07:09:03ZPaolo Cavallinicavallini@faunalia.it
<ul></ul><p>See also <a class="issue tracker-1 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/4613" title="New labellini: non numeric fields can be selected for label size (Closed)">#4613</a></p> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=270092011-12-16T09:55:07ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> changed from <i>Version 1.7.3</i> to <i>Version 1.7.4</i></li></ul> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=311642012-04-16T04:32:23ZPaolo Cavallinicavallini@faunalia.it
<ul><li><strong>Crashes QGIS or corrupts data</strong> set to <i>No</i></li><li><strong>Target version</strong> changed from <i>Version 1.7.4</i> to <i>Version 1.8.0</i></li><li><strong>Affected QGIS version</strong> set to <i>master</i></li></ul> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=344402012-09-04T09:56:08ZPaolo Cavallinicavallini@faunalia.it
<ul><li><strong>Target version</strong> changed from <i>Version 1.8.0</i> to <i>Version 2.0.0</i></li></ul> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=376322012-12-11T04:52:26ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Assignee</strong> set to <i>Larry Shaffer</i></li></ul><p>seems still an issue in master, text fields are shown for parameters that need to be just numbers.</p> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=410482013-05-17T14:31:53ZLarry Shaffer
<ul></ul><p>Hi Giovanni,</p>
<p>I have implemented this in the new QgsDataDefinedButton. However, and considering basic types, restricting options that require an Int or Double input value to only data source fields that support those types in a bit limiting.</p>
<p>This is because the resultant value, either from a direct feature field-mapped attribute query, or from an expression, can often be successfully converted to the appropriate type. For example, almost all results are QVariants, which means the result needs be be converted from QVariant to the expected type before it can be used.</p>
<p>Specifically:</p>
<blockquote>
<p><strong>double QVariant::toDouble ( bool * ok = 0 ) const</strong></p>
<p>Returns the variant as a double if the variant has type() Double, QMetaType::Float, Bool, ByteArray, Int, LongLong, <strong>String</strong>, UInt, or ULongLong; otherwise returns 0.0.</p>
</blockquote>
<blockquote>
<p><strong>int QVariant::toInt ( bool * ok = 0 ) const</strong></p>
<p>Returns the variant as an int if the variant has type() Int, Bool, ByteArray, Char, Double, LongLong, <strong>String</strong>, UInt, or ULongLong; otherwise returns 0.</p>
</blockquote>
<blockquote>
<p><strong>QString QVariant::toString () const</strong></p>
<p>Returns the variant as a QString if the variant has type() <strong>String</strong>, Bool, ByteArray, Char, Date, DateTime, <strong>Double</strong>, <strong>Int</strong>, LongLong, StringList, Time, UInt, or ULongLong; otherwise returns an empty string.</p>
</blockquote>
<p>So you can see that conversion to Int or Double can accept a String, and vic-versa. So there is really no need to limit the data source field type, unless you know it can not be successfully converted to what's needed. For example, if a data defined value might be the text 'Half' then limiting to only String type fields makes sense because Int and Double fields could not possibly produce such a result.</p> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=410742013-05-19T02:23:07ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>Hi Larry,</p>
<p>thanks for the detailed explanation.</p>
<p>So if you think that the original issue make no sense especially after your labelling overhaul, please close this ticket.</p>
<p>cheers!</p>
<p>Larry Shaffer wrote:</p>
<blockquote>
<p>Hi Giovanni,</p>
<p>I have implemented this in the new QgsDataDefinedButton. However, and considering basic types, restricting options that require an Int or Double input value to only data source fields that support those types in a bit limiting.</p>
<p>This is because the resultant value, either from a direct feature field-mapped attribute query, or from an expression, can often be successfully converted to the appropriate type. For example, almost all results are QVariants, which means the result needs be be converted from QVariant to the expected type before it can be used.</p>
<p>Specifically:</p>
<blockquote>
<p><strong>double QVariant::toDouble ( bool * ok = 0 ) const</strong></p>
<p>Returns the variant as a double if the variant has type() Double, QMetaType::Float, Bool, ByteArray, Int, LongLong, <strong>String</strong>, UInt, or ULongLong; otherwise returns 0.0.</p>
</blockquote>
<blockquote>
<p><strong>int QVariant::toInt ( bool * ok = 0 ) const</strong></p>
<p>Returns the variant as an int if the variant has type() Int, Bool, ByteArray, Char, Double, LongLong, <strong>String</strong>, UInt, or ULongLong; otherwise returns 0.</p>
</blockquote>
<blockquote>
<p><strong>QString QVariant::toString () const</strong></p>
<p>Returns the variant as a QString if the variant has type() <strong>String</strong>, Bool, ByteArray, Char, Date, DateTime, <strong>Double</strong>, <strong>Int</strong>, LongLong, StringList, Time, UInt, or ULongLong; otherwise returns an empty string.</p>
</blockquote>
<p>So you can see that conversion to Int or Double can accept a String, and vic-versa. So there is really no need to limit the data source field type, unless you know it can not be successfully converted to what's needed. For example, if a data defined value might be the text 'Half' then limiting to only String type fields makes sense because Int and Double fields could not possibly produce such a result.</p>
</blockquote> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=414032013-05-29T11:42:17ZLarry Shaffer
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Resolved</i></li><li><strong>Resolution</strong> set to <i>fixed</i></li></ul><p>Should be fixed with commit <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/45f374f428364604722f756a60dd9b40e9db2b85" title="Update labeling gui and add expression support as data defined value - Add QgsDataDefined class ...">45f374f4</a></p>
<p>Reopen if necessary</p> QGIS Application - Bug report #4607: Do not show not pertinent fields in the "data defined settings" of the labelling toolhttps://issues.qgis.org/issues/4607?journal_id=485782014-02-13T11:31:32ZJürgen Fischerjef@norbit.de
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul>