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. How to lock combobox scrolling while scrolling in scrollarea?
Forum Updated to NodeBB v4.3 + New Features

How to lock combobox scrolling while scrolling in scrollarea?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.3k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    heiopei
    wrote on last edited by
    #1

    Hello,

    I have a Gui with a scrollarea and scrollbar...this scrollarea has a child as groupbox in this groupbox are several groupboxes with comboboxes. Here is a little example: http://i.imgur.com/pC48cY2.png

    Now my problem is, when I am scrolling down in scrollarea and my mouse hits a combobox, while scrolling, the focus get on it and suddenly I am scrolling in the combobox. But I don't want it. How can I lock the combobox, so i can't scroll in it? Hope somebody can help me.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Interesting question.

      I guess you would not want to disable responding to wheel events completely for QComboBoxes. Perhaps you make an event filter for this. The filter would be activated by wheeel events send to the scroll view. You can keep the filter active for a certain time span, and not accept any scroll wheel events for any child widgets of the scroll view. Instead, you'd re-post the wheel event with the scroll view as the target.

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        i also suggest not to remove this feature, since it will impact the expected user experience.

        But if you really have to:
        The issue is caused because comboboxes have Qt::WheelFocus set (for QWidget's focusPolicy property). You can change it to Qt::StrongFocus to get rid of this behavior.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • H Offline
          H Offline
          heiopei
          wrote on last edited by
          #4

          Mhm its not working with:
          @combo->setFocusPolicy( Qt::StrongFocus );@

          The Combobox still gets focus....

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            hardly believable.
            If that's really the case then there must be something else which sets the focus in your code.
            You should set a breakpoint for the focus-in event and check from where it comes. You can post the stack trace here then if you like.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            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