<?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[QPushButton::clicked(bool) use]]></title><description><![CDATA[<p dir="auto">Hello!!</p>
<p dir="auto">I know this is a silly question but, I can't use correctly the QPushButton::clicked(bool) slot. I have a QMenu associated to this button. This is my code:</p>
<pre><code>void MainWindow::on_upDownButton_clicked(bool checked)
{
    if (checked) {
        menuUpDown-&gt;hide();
    } else {
        menuUpDown-&gt;show(); // &lt;-- trick to force layout of the menu before height() is called
        menuUpDown-&gt;popup(mapToGlobal(ui-&gt;upDownButton-&gt;pos() - QPoint(0, menuUpDown-&gt;height())));
    }
}
</code></pre>
<p dir="auto">But here, <code>checked</code> is always false, so, I can't hide the QMenu.</p>
<p dir="auto">What's wrong here?</p>
<p dir="auto">Thank you very much!</p>
]]></description><link>https://forum.qt.io/topic/86098/qpushbutton-clicked-bool-use</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 14:43:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/86098.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Dec 2017 08:22:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QPushButton::clicked(bool) use on Tue, 19 Dec 2017 08:46:46 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much, I forgot this detail!!</p>
]]></description><link>https://forum.qt.io/post/432449</link><guid isPermaLink="true">https://forum.qt.io/post/432449</guid><dc:creator><![CDATA[ivanicy]]></dc:creator><pubDate>Tue, 19 Dec 2017 08:46:46 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton::clicked(bool) use on Tue, 19 Dec 2017 08:41:55 GMT]]></title><description><![CDATA[<p dir="auto">Slightly unrelated: you don't need to do it manually: <a href="http://doc.qt.io/qt-5/qpushbutton.html#setMenu" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qpushbutton.html#setMenu</a></p>
]]></description><link>https://forum.qt.io/post/432448</link><guid isPermaLink="true">https://forum.qt.io/post/432448</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Tue, 19 Dec 2017 08:41:55 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton::clicked(bool) use on Tue, 19 Dec 2017 08:34:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ivanicy">@<bdi>ivanicy</bdi></a><br />
<a href="http://doc.qt.io/qt-5/qabstractbutton.html#clicked:" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qabstractbutton.html#clicked:</a></p>
<blockquote>
<p dir="auto">If the button is checkable, checked is true if the button is checked, or false if the button is unchecked.</p>
</blockquote>
<p dir="auto">Is your <code>QPushButton</code> even a checkable one?!</p>
]]></description><link>https://forum.qt.io/post/432445</link><guid isPermaLink="true">https://forum.qt.io/post/432445</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 19 Dec 2017 08:34:34 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton::clicked(bool) use on Tue, 19 Dec 2017 08:32:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ivanicy">@<bdi>ivanicy</bdi></a></p>
<p dir="auto">It's normal when you click on your QPushbutton to have always :</p>
<p dir="auto">clicked = true on your button.</p>
<p dir="auto">Refer to this <a href="http://doc.qt.io/qt-5/qabstractbutton.html#clicked" target="_blank" rel="noopener noreferrer nofollow ugc">doc</a></p>
<p dir="auto"><code>If the button is checkable, checked is true if the button is checked, or false if the button is unchecked.</code></p>
<p dir="auto">If you want have checkable button you need to add this line:</p>
<p dir="auto"><code>yourButton-&gt;setCheckable(true);</code></p>
]]></description><link>https://forum.qt.io/post/432444</link><guid isPermaLink="true">https://forum.qt.io/post/432444</guid><dc:creator><![CDATA[mostefa]]></dc:creator><pubDate>Tue, 19 Dec 2017 08:32:24 GMT</pubDate></item></channel></rss>