人机验证简化版案例
//设置垂直滑动条的范围是0-100ui->verticalScrollBar->setRange(0,100);ui->horizontalScrollBar->setRange(0,100);//设置初始数值ui->verticalScrollBar->setValue(50);//void valueChanged(int value);connect(ui->verticalScrollBar,&QScrollBar::valueChanged,[=](int value){ui->pushButton->move(ui->pushButton->x(),value);});connect(ui->horizontalScrollBar,&QScrollBar::valueChanged,[=](int value){ui->pushButton->move(value,ui->pushButton->y());QPoint labelPos = ui->widget->pos();int x = labelPos.x();int y = labelPos.y();if(value==x){ui->label->setText("验证通过!");}});