QSignalMapper does not trigger SLOT
<p>I'm trying to use <code>QSignalMapper</code> with my buttons, but I can't seem to get it to work to trigger my slot.</p>

<p>Here is my code for the SignalMapper:</p>

<p>In my header:</p>

<pre><code>...
private:

    QSignalMapper *mapper;
</code></pre>

<p>In my cpp:</p>

<pre><code>//Constructor:
mapper = new QSignalMapper(this);

//Init function, called by the constructor
connect(mapper, SIGNAL(mapped(int)), this, SLOT(HandleSignalEvents(int)));
</code></pre>

<p>Here is the code for connecting my button to it:</p>

<pre><code>connect(m_ui-&gt;addEntryButton, SIGNAL(clicked()), mapper, SLOT(map()));
mapper-&gt;setMapping(m_ui-&gt;addEntryButton, 1);
</code></pre>

<p>Both connects are returning <code>true</code> as value, so the connects should be setup correctly. However, this slot is not being triggered at all:</p>

<pre><code>public slots:

    void HandleSignalEvents(int);

----------------------------------------

void UIController::HandleSignalEvents(int param)
{
    //Do something    
}
</code></pre>

<p>I get no error whatsoever, so I can't really figure out what the problem ist. Both connects seem to work as usual, but the action does not trigger.</p>

<p>What could possibly go wrong here?</p>

<p>EDIT:</p>

<p>Note that <code>m_signalMapper</code> is a private member value of the class.</p>

<p>EDIT2:</p>

<p>Due to demand, here is my whole constructor chain:</p>

<pre><code>UIController::UIController(Ui::TodoListerClass &amp;ui)
{
    //Unrelated initializations
    mapper = new QSignalMapper(this);
    Init();
}

void UIController::Init()
{
    connect(mapper, SIGNAL(mapped(int)), this, SLOT(HandleSignalEvents(int)));

    InitUI();
    InitBinds();
}

void UIController::InitBinds()
{
    connect(m_ui-&gt;addEntryButton, SIGNAL(clicked()), mapper, SLOT(map()));
    mapper-&gt;setMapping(m_ui-&gt;addEntryButton, 1);
}
</code></pre>

<p>Edit 2:</p>

<p>More code:</p>

<p>Main:</p>

<pre><code>#include "todolister.h"
#include &lt;QtWidgets/QApplication&gt;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    TodoLister w;
    w.show();
    return a.exec();
}
</code></pre>

<p>TodoLister(.h):</p>

<pre><code>class TodoLister : public QMainWindow
{
    Q_OBJECT

public:
    TodoLister(QWidget *parent = 0);
    ~TodoLister();

private: 
    Ui::TodoListerClass ui;
};
</code></pre>

<p>TodoLister(.cpp):</p>

<pre><code>TodoLister::TodoLister(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);
    UIController uiController(ui);
}
</code></pre>