rendered paste body#include <QMessageBox>#include <QTimer>#include <QAbstractSlider>#include "mainform.h"MainForm::MainForm(QWidget *parent) : QWidget(parent){ setupUi(this); QObject::connect(Start,SIGNAL(clicked()),this,SLOT(OnStartClicked())); QObject::connect(Stop,SIGNAL(clicked()),this,SLOT(OnStopClicked())); QObject::connect(timer, SIGNAL(timeout()), this, SLOT(Tick())); QObject::connect(Speed, SIGNAL(valueChanged(int)), this, SLOT(SetTickTime(int))); QObject::connect(tabla, SIGNAL(OutOfGolds(bool)), Stop, SLOT(setEnabled(bool))); QObject::connect(tabla, SIGNAL(OutOfGolds(bool)), Start, SLOT(setEnabled(bool)));}void MainForm::OnStartClicked(){ timer->start(1000-Speed->value()*70);}void MainForm::OnStopClicked(){ timer->stop();}void MainForm::Tick(){ tabla->Step();}void MainForm::SetTickTime(int value){ if(timer->timerId()) { timer->stop(); timer->start(1000-value*70); }}