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. Why scrolling QScrollArea stops when cursor reaches disabled QCheckBox?
Forum Update on Monday, May 27th 2025

Why scrolling QScrollArea stops when cursor reaches disabled QCheckBox?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 888 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.
  • T Offline
    T Offline
    Tapsa
    wrote on last edited by
    #1

    Enabled QCheckBox can be scrolled past without a problem. I implented wheelEvent on my QComboBox class to ignore it = let parent do the scrolling. Neither wheelEvent or mouseMoveEvent on QCheckBox handle any scrolling and reimplementing them makes no difference.

    I tried to filter wheel events this way, but QCheckBox is no longer even drawn.

    bool event(QEvent *e)
    {
        if(QEvent::Wheel == e->type())
        {
            e->ignore();
        }
        else e->accept();
        return false;
    }
    

    How can I make mouse wheel events always be passed to the parent QScrollArea?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Don't always return false. Returning false means "I don't care about this event". This means you're discarding all events that come to the checkbox, which includes paintng, resizes etc. That's not what you want.

      Instead discard only the wheel event and call base implementation otherwise:

      bool event(QEvent* e)
      {
          if (QEvent::Wheel == e->type())
              return false;
      
          return QCheckBox::event(e);
      }
      
      1 Reply Last reply
      1
      • T Offline
        T Offline
        Tapsa
        wrote on last edited by
        #3

        Thanks. Works great.

        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