How to get status of QScrollBar ?
Solved
General and Desktop
-
I am writing a image viewer.
When need scrollbar Key_Left and Key_Right move horizontal scrollbar.
When do not need scrollbar Key_Left and Key_Right run lastImage and nextImage.connect(new QShortcut(QKeySequence(Qt::Key_Left),this), SIGNAL(activated()),this, SLOT(lastImage())); void MainWindow::lastImage() { if ( !ui->scrollArea->horizontalScrollBar()->isNeeded && ui->scrollArea->verticalScrollBar()->isNeeded() ) { // How to write here ? int id = index - 1; if (id > -1) { path = fileInfoList.at(id).absoluteFilePath(); loadImage(path); index = id; } }else{ ui->scrollArea->horizontalScrollBar()->setValue(ui->scrollArea->horizontalScrollBar()->value() - 20); } }
-
Hi,
What should be the logic behind isNeeded ?