Qt 6.11 is out! See what's new in the release
blog
Value from the "ScrollBar" for "switch"
-
Hi!
How to get value from the scroll bar for switch?oid MainWindow::on_pushButton_clicked() { ui->horizontalScrollBar->setRange(0, 8); switch(ui->horizontalScrollBar->value()){ case ui->horizontalScrollBar->value(1): { } case ui->horizontalScrollBar->value(2): { } } -
Hi.
caselabels take constant expressions, so simply:switch(ui->horizontalScrollBar->value()) { case 1: { } case 2: { } }Don't forget to put
break;between those cases so you don't accidentaly fall through.