Connect QComboBox :: currentIndexChanged (int) to QSignalMapper :: map ()

I am trying to figure out how to achieve this in Qt5:

connect(qcombobox, SIGNAL(currentIndexChanged(int),
        qsignalmappe, SLOT(map()));

I tried this:

connect(comboBox, static_cast<void(QComboBox::*)(int) (&QComboBox::currentIndexChanged),
        this->signalMapper, &QSignalMapper::map);

But the compiler does not complain about the lack of appropriate parameters. I know that there are no arguments in the QSignalMapper :: map () signal, but I don’t know how it works with the old syntax.

+4
source share
1 answer

Try it worked for me

 connect(comboBox,static_cast<void (QComboBox::*)(int index)>(&QComboBox::currentIndexChanged),signalMapper,static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
+3
source

All Articles