The setting of the minimum and maximum is where the problem is.
// QMessageBox::information(0,"Min/Max",QString("Min: %1, Max: %2").arg(min).arg(max));
qApp->processEvents();
ui_scrollArea->verticalScrollBar()->setMinimum(min);
ui_scrollArea->verticalScrollBar()->setMaximum(max);
// ui_scrollArea->verticalScrollBar()->setSliderPosition(min);
ui_scrollArea->verticalScrollBar()->setValue(min);
qApp->processEvents();
// QMessageBox::information(0,"Min/Max",QString("Min: %1, Max: %2").arg(min).arg(max));
qApp->processEvents();
ui_scrollArea->verticalScrollBar()->setMinimum(min);
ui_scrollArea->verticalScrollBar()->setMaximum(max);
// ui_scrollArea->verticalScrollBar()->setSliderPosition(min);
ui_scrollArea->verticalScrollBar()->setValue(min);
qApp->processEvents();
To copy to clipboard, switch view to plain text mode
Either the code is being ignored or there is something overwriting these values after I assign the calculated values. I created a non-elegant fix by saving off the min and max values to member variables and setting their values again in SlotUserPositionChanged. There should be a better way - any suggestions are welcome.
Should I be using setValue or setSliderPosition? The documentation says there is a difference with tracking, but I don't know what is meant by tracking.
Bookmarks