Home > other >  Today began to learn Qt: no to signal QSpinBox: : valueChange (int)
Today began to learn Qt: no to signal QSpinBox: : valueChange (int)

Time:05-22

Resolved: wrong in function should be valueChanged () -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- beginners qt, run after an error: no to signal QSpinBox: : valueChange (int) window can display, just can't complete the data communication between two objects, the following is the source code, thank you first! # include "stdafx. H # include" & lt; Qapplication> # include & lt; QHboxLayout> # include & lt; QSlider> # include & lt; QSpinBox> Int main (int arg c, char * argv []) {QApplication app (arg c, argv); QWidget * window=new QWidget; The window - & gt; SetWindowTitle (" Enter Your Age "); QSpinBox * spinBox=new QSpinBox; The slider QSlider *=new QSlider (Qt: : Horizontal); SpinBox - & gt; SetRange (0, 130); The slider - & gt; SetRange (0, 130); QObject: : connect (spinBox, SIGNAL (valueChange (int)), the slider, SLOT (setValue (int))); QObject: : connect (the slider, SIGNAL (valueChange (int)), spinBox, SLOT (setValue (int))); SpinBox - & gt; SetValue (35); QHBoxLayout * layout=new QHBoxLayout; Layout - & gt; AddWidget (the slider); Layout - & gt; AddWidget (spinBox); The window - & gt; SetLayout (layout); The window - & gt; Show (); Return the app. The exec (); }

CodePudding user response:

Error message is clear, QSpinBox really don't have the signal,

CodePudding user response:

The forehead, copy books copied wrong!!!!!!

CodePudding user response:

People as the name implies, ha ha, joke!

CodePudding user response:

ValueChanged reason is function has two forms: QSpinBox: : valueChanged (int) and QSpinBox: : valueChanged (QString), the compiler doesn't know which function to use solution can also be a https://blog.csdn.net/dee53994040/article/details/102178933 and https://blog.csdn.net/weixin_42607149/article/details/88682387
  • Related