1

I am trying to connect a three combobox with a slot, but it is showing error at the "&QComboBox::currentIndexChanged", wihtout & also an error.

connect(ptrcomboBox1, &QComboBox::currentIndexChanged, this, &DynRefWizardPage::on_comboBox_currentIndexChanged);

connect(ptrcomboBox2, &QComboBox::currentIndexChanged, this, &DynRefWizardPage::on_comboBox_currentIndexChanged);

connect(ptrcomboBox3, &QComboBox::currentIndexChanged, this, &DynRefWizardPage::on_comboBox_currentIndexChanged);

Please i could not understand the sytax provided in the documentation, could anyone provide me with the syntax with my case?

  • 1
    Please edit your question to include all relevant error messages. – G.M. Apr 12 '17 at 11:46
  • Please list the Qt version that you are using. Between Qt4 and Qt5 there have been changes. – Tom de Geus Apr 12 '17 at 12:08
  • 3
    I think your problem is caused by the signal `currentIndexChanged` being an overloaded one, e.g. there are two `currentIndexChanged` methods with different arguments. You should specify explicitly which one you are going to connect with by static cast: e.g. if you want `int` one then use `static_cast(&QComboBox::currentIndexChanged)` - just like in [example in official Qt docs](http://doc.qt.io/qt-5/qcombobox.html#currentIndexChanged). – Mikhail Churbanov Apr 12 '17 at 12:20
  • Thnak you. It is working now. –  Apr 12 '17 at 15:54

0 Answers0