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. Disable QSlider's valueChanged on keyboard arrow keys
Forum Updated to NodeBB v4.3 + New Features

Disable QSlider's valueChanged on keyboard arrow keys

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.5k 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.
  • S Offline
    S Offline
    sayan275
    wrote on last edited by
    #1

    How can I disable QSlider's emitting SIGNAL valueChanged on keyboard arrows and mouseWheel scroll. By setting

    ui->horizontalSlider->setFocusPolicy(Qt::NoFocus);
    

    the keyboards arrows keys are not emitting signals.

    How can I do the same for mouse wheel scroll? I don't want to reimplement my custom Slider class from QSlider. Am asking for any work around or api, so that I can disable the keyboard and mouse wheel scroll responding to qslider.

    The main intention is to avoid sending signals on every valueChange. So I have implemented the following and it's working fine

    on_horizontalSlider_sliderReleased()
    on_horizontalSlider_sliderPressed()
    

    based on bool flag updated in these 2 slots,

    on_horizontalSlider_valueChanged(int)
    

    is doing the required operation...like after slider released, value is being added in the required application.

    Request to provide approaches, examples for the work around.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Wouldn't disabling the tracking property do what you want ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sayan275
        wrote on last edited by
        #3

        Tried..but it didn't help

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          EventFilter is the option.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          S 1 Reply Last reply
          0
          • dheerendraD dheerendra

            EventFilter is the option.

            S Offline
            S Offline
            sayan275
            wrote on last edited by
            #5

            @dheerendra Yes..I'll try with EventFilter

            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