4

I'm 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 complains about no matching parameters. I know that the QSignalMapper::map() signal has no arguments, but I don't know how it is working with old syntax.

Szőke Szabolcs
  • 511
  • 7
  • 19

1 Answers1

5

Try this,it worked for me

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