Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScrollArea isn't auto-scrolling on QRadioButtons

QScrollArea isn't auto-scrolling on QRadioButtons

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 390 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlaaM
    wrote on last edited by AlaaM
    #1

    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[] 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:

    scrollArea->verticalScrollBar()->setValue(scrollArea->verticalScrollBar()->value()+SCROLL_VALUE);
    

    but I want it to be automatic.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved