Why is qobject_cast required in this SLOT for sender()?
<p>From calculator example of Qt:</p>

<pre><code>void Calculator::digitClicked()
{
    Button *clickedButton = qobject_cast&lt;Button *&gt;(sender());
    int digitValue = clickedButton-&gt;text().toInt();
    if (display-&gt;text() == "0" &amp;&amp; digitValue == 0.0)
        return;

    if (waitingForOperand) {
        display-&gt;clear();
        waitingForOperand = false;
    }
    display-&gt;setText(display-&gt;text() + QString::number(digitValue));
}
</code></pre>

<p>This SLOT is connected to all digit buttons:</p>

<pre><code>digitButtons[i] = createButton (QString::number(i), SLOT(digitClicked()));
</code></pre>

<p>With <code>createButton</code>:</p>

<pre><code>Button *Calculator::createButton(const QString &amp;text, const char *member)
{
    Button *button = new Button(text);
    connect(button, SIGNAL(clicked()), this, member);
    return button;
}
</code></pre>

<p><strong>So, in the SLOT why is type cast required?</strong>  </p>

<pre><code>Button *clickedButton = qobject_cast&lt;Button *&gt;(sender());
</code></pre>