As MrD. suggested, you have to do this:
disconnect(ui->spinBox, SIGNAL(valueChanged (int)), 0, 0);

You may read the QObject Class Reference for more info about this.