Important: Please read the Qt Code of Conduct -

Change value in table view in spin box

  • Hello
    I am trying to change a value in a table view with spin box.When i change the value in a spin box the value present in table view should change accordingly.
    I have a database displayed in the table view. I just want to connect a spinbox to a related value in the table view and update when spinbox value is changed.
    Thank you.

  • What model are you using? is the index of the affected value constant?

  • @VRonin
    Im using QSqlQueryModel and yes the index is constant.

  • // QSpinBox* mySpinBox;
    //QSqlQueryModel *model;
    // int rowIndex,colIndex;
    QObject::connect(mySpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),[model,rowIndex,colIndex](int val)->void{