Important: Please read the Qt Code of Conduct -

QScrollArea isn't auto-scrolling on QRadioButtons

  • I have some widgets inside a QScrollArea:

    scrollArea     = new QScrollArea(&widget);
    groupBoxLayout = new QVBoxLayout();
    groupBox       = new QGroupBox();
    title          = new QLabel();
    for(int i=0; i<WIDGETS_NUMBER; i++)
        buttons[i] = new QPushButton();

    Now as long as the buttons[] are QPushButtons, the QScrollArea 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 those buttons[] to be QRadioButtons 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:


    but I want it to be automatic.

Log in to reply