QScrollArea isn't auto-scrolling on QRadioButtons
Unsolved
General and Desktop
-
I have some widgets inside a
QScrollArea
:scrollArea = new QScrollArea(&widget); groupBoxLayout = new QVBoxLayout(); groupBox = new QGroupBox(); title = new QLabel(); groupBoxLayout->addWidget(title); for(int i=0; i<WIDGETS_NUMBER; i++) { buttons[i] = new QPushButton(); buttons[i]->setFocusPolicy(Qt::FocusPolicy::StrongFocus); buttons[i]->installEventFilter(this); groupBoxLayout->addWidget(buttons[i]); } buttons[0]->setFocus();
Now as long as the
buttons[]
areQPushButtons
, theQScrollArea
scrolls automatically on focus change. That is, when I move through the buttons using the Down arrow key, just when I reach the bottom edge of the window, it scrolls down automatically. But just when I change thosebuttons[]
to beQRadioButtons
instead, it stops scrolling automatically. Why is that happening? How can I get it to auto-scroll when the focus reaches the edge?Of course I can detect a FocusIn event, and manually scroll whenever I need:
scrollArea->verticalScrollBar()->setValue(scrollArea->verticalScrollBar()->value()+SCROLL_VALUE);
but I want it to be automatic.