<?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[Many PushButton]]></title><description><![CDATA[<p dir="auto">Hello, how can i to make this easier and shorter?<br />
I have many PushButton (more then 100) and doing similar thing.</p>
<p dir="auto">public slots:<br />
@<br />
void MyForm::on_pb_1_clicked() { Methode(pb_1, Array[0]);}<br />
void MyForm::on_pb_2_clicked() { Methode(pb_2, Array[1]);}<br />
.<br />
.<br />
.<br />
void MyForm::on_pb_n_clicked() { Methode(pb_n, Array[n-1]);}<br />
@</p>
<p dir="auto">pb_1, .... pb_n is many pushbutton.</p>
<p dir="auto"><em>Edit: please use code tags, Andre</em></p>
]]></description><link>https://forum.qt.io/topic/4012/many-pushbutton</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 17:58:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/4012.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 Feb 2011 20:53:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Many PushButton on Wed, 18 Jun 2014 20:54:53 GMT]]></title><description><![CDATA[<p dir="auto">It's a perfect solution except figuring out how to use it.<br />
Ron</p>
]]></description><link>https://forum.qt.io/post/101715</link><guid isPermaLink="true">https://forum.qt.io/post/101715</guid><dc:creator><![CDATA[BasicPoke]]></dc:creator><pubDate>Wed, 18 Jun 2014 20:54:53 GMT</pubDate></item><item><title><![CDATA[Reply to Many PushButton on Mon, 28 Feb 2011 16:57:13 GMT]]></title><description><![CDATA[<p dir="auto">QSignalMapper is a perfect solution. TY!</p>
]]></description><link>https://forum.qt.io/post/78086</link><guid isPermaLink="true">https://forum.qt.io/post/78086</guid><dc:creator><![CDATA[krisztiantobias]]></dc:creator><pubDate>Mon, 28 Feb 2011 16:57:13 GMT</pubDate></item><item><title><![CDATA[Reply to Many PushButton on Mon, 28 Feb 2011 13:35:47 GMT]]></title><description><![CDATA[<p dir="auto">I <em>highly</em> recommend using QSignalMapper instead of using sender().</p>
]]></description><link>https://forum.qt.io/post/78065</link><guid isPermaLink="true">https://forum.qt.io/post/78065</guid><dc:creator><![CDATA[andre]]></dc:creator><pubDate>Mon, 28 Feb 2011 13:35:47 GMT</pubDate></item><item><title><![CDATA[Reply to Many PushButton on Mon, 28 Feb 2011 13:31:23 GMT]]></title><description><![CDATA[<p dir="auto">You can use sender() inside slots to find out who sent the signal.<br />
@<br />
void MyForm::on_pb_any_clicked()<br />
{<br />
if(sender() == pb_1)<br />
Methode(pb_1, Array[0]);<br />
if(sender() == pb_2)<br />
Methode(pb_2, Array[0]);<br />
.....<br />
......<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/78060</link><guid isPermaLink="true">https://forum.qt.io/post/78060</guid><dc:creator><![CDATA[dialingo]]></dc:creator><pubDate>Mon, 28 Feb 2011 13:31:23 GMT</pubDate></item><item><title><![CDATA[Reply to Many PushButton on Mon, 28 Feb 2011 08:13:21 GMT]]></title><description><![CDATA[<p dir="auto">Example:<br />
@<br />
QSignalMapper *btnGroup;<br />
btnGroup = new QSignalMapper(this);<br />
connect(btnGroup, SIGNAL(mapped(int)), this, SIGNAL(btnOutClickSlot(int)));</p>
<p dir="auto">void myclass::btnOutClickSlot(int btn)<br />
{<br />
//code here<br />
}</p>
<p dir="auto">QPushButton *tmp[2] = {pushButton,pushButton_2};<br />
for (quint16 i = 0; i &lt; 2; i++)<br />
{<br />
btnGroup-&gt;setMapping(pushB[i], i);<br />
connect(tmp[i], SIGNAL(clicked()), btnGroup, SLOT(map()));<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/78023</link><guid isPermaLink="true">https://forum.qt.io/post/78023</guid><dc:creator><![CDATA[stukdev]]></dc:creator><pubDate>Mon, 28 Feb 2011 08:13:21 GMT</pubDate></item><item><title><![CDATA[Reply to Many PushButton on Sun, 27 Feb 2011 21:13:50 GMT]]></title><description><![CDATA[<p dir="auto">QSignalMapper!</p>
]]></description><link>https://forum.qt.io/post/77995</link><guid isPermaLink="true">https://forum.qt.io/post/77995</guid><dc:creator><![CDATA[dangelog]]></dc:creator><pubDate>Sun, 27 Feb 2011 21:13:50 GMT</pubDate></item></channel></rss>