0

When I used connect() to connect a &QRadioButton::toggled signal with a void-return type function, all went well:

QRadioButton *radioCrack = new QRadioButton;
QObject::connect(radioCrack, &QRadioButton::toggled, updateCeasarCrack);

My function (which is placed above):

void updateCeasarCrack()
{
    cerr << "done";
}

But when I tried to do the same for &QSpinBox::valueChanged:

QSpinBox *keyBox = new QSpinBox;
QObject::connect(keyBox, &QSpinBox::valueChanged, updateCeasarCrack);

I got an error:

error: no matching function for call to 'connect'

Full error image :

error

Did I misunderstood something with the way connect() work? I've tried googling and came up with this, but it doesn't seem to fix the issue.

Sources : https://wiki.qt.io/New_Signal_Slot_Syntax

  • 3
    Please see the documentation for [`QSpinBox::valueChanged`](https://doc.qt.io/qt-5/qspinbox.html#valueChanged). Specifically the use of `QOverload` (or [`qOverload`](https://doc.qt.io/qt-5/qtglobal.html#qOverload)). – G.M. May 24 '21 at 17:50
  • Oh, I missed that completely. Thanks @G.M. –  May 24 '21 at 23:18

0 Answers0