I have this code in the method

QTimer::singleShot(ui->spinBox->value(), &loop, SLOT(quit())); 

The program starts successfully, works. But when I call a method with this string, I get an exception.

enter image description here

Actually a question. How to transfer value from a spinbox as a parameter for a method?

  • The problem is not in this, or not only in this line, because The syntax is written correctly. Check with the debugger for the presence of ui-> spinBox and loop objects at the time the string is called. - alexis031182
  • @ alexis031182, i.imgur.com/Uq2HQRN.png the main form starts and the spinbox values ​​change. - Matthew Haig
  • You need to give a minimal compiled example that reproduces the error in the text of the question. - alexis031182

1 answer 1

I found the solution myself. Changed just the access modifier to ui from private to public.