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. Popup and Slider
Forum Updated to NodeBB v4.3 + New Features

Popup and Slider

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 411 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
    tacdin
    wrote on last edited by
    #1

    Hi everyone. I have a button inside a window. A popup opens when the button is pressed. There is a slider inside the popup. When I want to use this slider, I want the popup not visible as long as I hold down the slider. What can I do for it?

    J.HilkJ 1 Reply Last reply
    0
    • T tacdin

      Hi everyone. I have a button inside a window. A popup opens when the button is pressed. There is a slider inside the popup. When I want to use this slider, I want the popup not visible as long as I hold down the slider. What can I do for it?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @tacdin Slider has a pressed property
      https://doc.qt.io/qt-5/qml-qtquick-controls2-slider.html#pressed-prop

      bind that to visible or probably opacity property of the popup.

      you may run into issues where the popup forces these changes onto the slider,(as a child of popup) as well. So going with opacity is probably the better option


      something like this:

      ApplicationWindow {
          id: mainWindow
      
          visible: true
          width: 400
          height: 100
      
          Rectangle{
              anchors.fill: parent
              color: "red"
      
              Label{
                  anchors.centerIn: parent
                  text: slider.value
              }
      
          }
      
          Popup{
              id:popup
              Component.onCompleted: open()
              opacity: slider.pressed ? 0 : 1
      
              Slider{
                  id:slider
                  anchors.fill: parent
      //            onValueChanged: popup.opacity = value / to
              }
          }
      }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • T Offline
        T Offline
        tacdin
        wrote on last edited by
        #3

        thanks. your solution worked but not exactly the way I wanted. I would like to try and get ideas.

        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