2

I want to use slot-signals stuff without SLOT() & SIGNAL() macroses, as explained here - exactly, I want to implement this part

QObject::connect(&a, &Counter::valueChanged, &b, &Counter::setValue);

In example above - slot and signal taking no arguments.

My real-life example:

connect(m_subsystemComboBox, &QComboBox::currentIndexChanged, this, &CMainWindow::ComboBoxChange);

Catch here is following - QComboBox::currentIndexChanged is overloaded to accept QString and int. And by using example above - I get following error from visual studio

IntelliSense: cannot determine which instance of overloaded function "QComboBox::currentIndexChanged" is intended
IntelliSense: no instance of overloaded function "CMainWindow::connect" matches the argument list
        argument types are: (QComboBox *, <unknown-type>, CMainWindow *, void (CMainWindow::*)(const QString &str))

I have tried to append (QString) to functions in connect() - another error:

IntelliSense: expression must be an lvalue or a function designator

Could anyone help me to achieve connection of currentIndexChanged signal with QString to my slot?

Starl1ght
  • 4,422
  • 1
  • 21
  • 49

0 Answers0