<?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[Underline(shortcut) is not getting displayed on changing the text on a button]]></title><description><![CDATA[<p dir="auto">A button is set text with "&amp;Open" where shortcut is "Alt+O" but when I change the text to "Close"/"Cl&amp;ose", the shortcut is getting removed.<br />
How to retain the shortcut?</p>
<pre><code>import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

Pane {

    function on_update_open_button_text() {
        button.text = "Cl&amp;ose"
    }

    Shortcut {
        id: sc
        sequence: "Alt+O"
        onActivated: {
            on_update_open_button_text()
        }
    }

    ColumnLayout {

        Button {
            id: button
            Layout.preferredWidth: 150
            objectName: "openButtonObj"
            text: "&amp;Open"

            onClicked: {
                on_update_open_button_text()
            }
        }
    }
}


</code></pre>
]]></description><link>https://forum.qt.io/topic/132946/underline-shortcut-is-not-getting-displayed-on-changing-the-text-on-a-button</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 05:37:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132946.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Dec 2021 09:53:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Underline(shortcut) is not getting displayed on changing the text on a button on Tue, 21 Dec 2021 11:41:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maruthimarsh">@<bdi>MaruthiMarsh</bdi></a> I have no idea what <code>&amp;O</code>is supposed to do and when I test it, id does nothing but print the &amp; char. <code>&lt;u&gt;&lt;/u&gt;</code> are rich text tags and the QMLl Text elements supports that, so I suggested to that :D</p>
]]></description><link>https://forum.qt.io/post/695608</link><guid isPermaLink="true">https://forum.qt.io/post/695608</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 21 Dec 2021 11:41:28 GMT</pubDate></item><item><title><![CDATA[Reply to Underline(shortcut) is not getting displayed on changing the text on a button on Tue, 21 Dec 2021 11:30:37 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk Yes, it does work. Thanks.<br />
But why it doesn't work when '&amp;' is used?</p>
]]></description><link>https://forum.qt.io/post/695604</link><guid isPermaLink="true">https://forum.qt.io/post/695604</guid><dc:creator><![CDATA[MaruthiMarsh]]></dc:creator><pubDate>Tue, 21 Dec 2021 11:30:37 GMT</pubDate></item><item><title><![CDATA[Reply to Underline(shortcut) is not getting displayed on changing the text on a button on Tue, 21 Dec 2021 09:51:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maruthimarsh">@<bdi>MaruthiMarsh</bdi></a> would <code>button.text = "Cl&lt;u&gt;o&lt;/u&gt;se"</code> work for your case ?</p>
]]></description><link>https://forum.qt.io/post/695596</link><guid isPermaLink="true">https://forum.qt.io/post/695596</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 21 Dec 2021 09:51:46 GMT</pubDate></item><item><title><![CDATA[Reply to Underline(shortcut) is not getting displayed on changing the text on a button on Tue, 21 Dec 2021 05:13:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a> I think I need to reframe the title. Basically what is happening is the <strong>underline</strong> under the character 'O' is <strong>not getting displayed when we change the button text</strong> to "Cl&amp;ose" though it displays initially (when the text is "&amp;Open").</p>
]]></description><link>https://forum.qt.io/post/695554</link><guid isPermaLink="true">https://forum.qt.io/post/695554</guid><dc:creator><![CDATA[MaruthiMarsh]]></dc:creator><pubDate>Tue, 21 Dec 2021 05:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Underline(shortcut) is not getting displayed on changing the text on a button on Mon, 20 Dec 2021 20:54:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maruthimarsh">@<bdi>MaruthiMarsh</bdi></a> said in <a href="/post/695457">Shortcut gets removed on changing the text on a button</a>:</p>
<blockquote>
<p dir="auto">the shortcut is getting removed</p>
</blockquote>
<p dir="auto">What does this mean exactly?  What indicates that it is removed?</p>
]]></description><link>https://forum.qt.io/post/695532</link><guid isPermaLink="true">https://forum.qt.io/post/695532</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Mon, 20 Dec 2021 20:54:10 GMT</pubDate></item></channel></rss>