<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Combo boxes have different values after selecting a value and when displaying choices]]></title><description><![CDATA[<p dir="auto">Hi all, I'm using the QMl combo box.<br />
Different values after value selection and when displaying choices.</p>
<p dir="auto">Why are they different?<br />
How can we get the same value?</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/492173b3-4abc-4a75-b727-b14c28a3fddd.PNG" alt="combobox.PNG" class=" img-fluid img-markdown" /></p>
<pre><code>    ListModel {
        id: listModel
        ListElement {
            name: "A &amp; B"
        }
        ListElement {
            name: "&amp;&amp;&amp;"
        }
    }

    ComboBox {
        id: comboBox
        textRole: "name"
        model: listModel
    }
</code></pre>
]]></description><link>https://forum.qt.io/topic/150520/combo-boxes-have-different-values-after-selecting-a-value-and-when-displaying-choices</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 08:49:08 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/150520.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Oct 2023 08:56:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Combo boxes have different values after selecting a value and when displaying choices on Thu, 05 Oct 2023 09:22:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a><br />
Thanks to you, I understood that &amp; is a shortcut character.</p>
<p dir="auto">Hey guys, I want to display the same value in both cases.<br />
Please help me.</p>
]]></description><link>https://forum.qt.io/post/775014</link><guid isPermaLink="true">https://forum.qt.io/post/775014</guid><dc:creator><![CDATA[Ren.K]]></dc:creator><pubDate>Thu, 05 Oct 2023 09:22:22 GMT</pubDate></item><item><title><![CDATA[Reply to Combo boxes have different values after selecting a value and when displaying choices on Thu, 05 Oct 2023 09:02:48 GMT]]></title><description><![CDATA[<p dir="auto">@Ren-K<br />
They are different because <code>&amp;</code> is used before a character to indicate it is a <em>shortcut</em>.  That is why you get the underline character in <code>A &amp; B</code> -&gt; <code>A _B</code>.</p>
<p dir="auto">I don't know QML, but in the first case you are in something which does not do shortcuts so it shows <code>A &amp; B</code> <em>literally</em>.  In the second case it does accept shortcut key input and so displays with that information.</p>
<p dir="auto">Simplest would be if you can avoid <code>&amp;</code> characters in the texts altogether.  Otherwise you will apparently have to do something to translate <code>&amp;</code> to <code>&amp;&amp;</code> for the second case, which will be displayed as literal single <code>&amp;</code>.  How you do this from QML (do you need to go via script?) I do not know.</p>
]]></description><link>https://forum.qt.io/post/775010</link><guid isPermaLink="true">https://forum.qt.io/post/775010</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 05 Oct 2023 09:02:48 GMT</pubDate></item></channel></rss>