Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Slider Issue
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Slider Issue

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.8k 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.
  • K Offline
    K Offline
    kreimer314
    wrote on last edited by
    #1

    Hi all,

    I'm new to these forums but they seem like a great place to get help. I am having this issue where I'm accidentally changing the values of my sliders when I press on their grooves to slide the app window up or down. Is there any way to restrict them such that their values can only be changed by their handles?
    I have tried a few things involving the activeFocusOnPress and pressed properties as well as child MouseAreas but nothing seems to work. Any help would be greatly appreciated!

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi and Welcome to the Qt Forum,

      You can use the "enabled":http://qt-project.org/doc/qt-5/qml-qtquick-item.html#enabled-prop property to enable/disable the Slider.
      Can you explain what you do you mean by "slide the app window up or down" ? Can you post a sample code which explains it ?

      157

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kreimer314
        wrote on last edited by
        #3

        Sure, and thanks for the welcoming :)

        So my app page is contained within a flickable object like this

        @Flickable{
        visible: !joinOn
        anchors.fill: parent
        contentWidth: appWidth
        contentHeight: childrenRect.height
        flickableDirection: Flickable.VerticalFlick
        boundsBehavior: Flickable.StopAtBounds
        //... the rest of the page
        }
        @

        Within the page I have several slider objects stacked on each other like so:

        @Slider {
        id: monthSlider
        width: appWidth
        height: oneLineHeight
        }
        Slider {
        id: daySlider
        width: appWidth
        height: oneLineHeight
        achors.top: monthSlider.bottom
        anchors.topMargin: spacing
        }
        Slider {
        id: yearSlider
        width: appWidth
        height: oneLineHeight
        achors.top: daySlider.bottom
        anchors.topMargin: spacing
        }@

        My issue is that as I'm trying to navigate the page vertically, by swiping my fingers, I sometimes press on the slider grooves and thereby change change the slider values: which is what I don't want to happen. I want the sliders to only be able to change value when the handle is pressed, which is why I tried setting the enabled property to enabled: pressed. But that doesn't work. I've also tried activeFocusOnPress: pressed but that doesn't work either. And lastly I tried using a customized mouse area above my sliders but I couldn't work that out.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          You can disable the Sliders when the user is "flicking":http://qt-project.org/doc/qt-5/qml-qtquick-flickable.html#flicking-prop.

          157

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kreimer314
            wrote on last edited by
            #5

            Ah. Thank you so much that's perfect!

            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