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 can I create slider and show buttons inside it
Forum Updated to NodeBB v4.3 + New Features

How can I create slider and show buttons inside it

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 4 Posters 1.7k Views 3 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.
  • Thank YouT Thank You

    ede26838-1d57-46bf-b995-926c009d4019-image.png
    Just the slider part
    This is the thing that I want to implement

    I would be happy to get the answer using QWidgets only
    NOT QML

    Pl45m4P Offline
    Pl45m4P Offline
    Pl45m4
    wrote on last edited by
    #2

    @Thank-You

    I dont know if the QSlider base class is the correct approach in your case. The QSlider has ticks to set a value in a certain range.
    If you just want to slide something to the right or left (like accepting a call on your smartphone or managing your emails), you should create your own custom widget.


    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

    ~E. W. Dijkstra

    1 Reply Last reply
    2
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #3

      Hi
      The picture is too low-quality for me to see what it is you want to create.
      Also why would there be multiple buttons in it ??

      You mean like a slide out menu ?

      Thank YouT 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        The picture is too low-quality for me to see what it is you want to create.
        Also why would there be multiple buttons in it ??

        You mean like a slide out menu ?

        Thank YouT Offline
        Thank YouT Offline
        Thank You
        wrote on last edited by
        #4

        @mrjj
        74fc0c7f-23ec-47c9-b231-a907f0f19429-image.png
        Maybe this can help

        Let's make QT free or It will go forever

        TRUE AND FALSE <3

        Pl45m4P 1 Reply Last reply
        0
        • Thank YouT Thank You

          @mrjj
          74fc0c7f-23ec-47c9-b231-a907f0f19429-image.png
          Maybe this can help

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #5

          @Thank-You

          The "item" should "hide" your button and when you swipe to the left or right, the button appears, correct? (Kind of "snap" - behavior)
          Definitely possible but might be a little tricky to make it work properly.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          Thank YouT 1 Reply Last reply
          0
          • Pl45m4P Pl45m4

            @Thank-You

            The "item" should "hide" your button and when you swipe to the left or right, the button appears, correct? (Kind of "snap" - behavior)
            Definitely possible but might be a little tricky to make it work properly.

            Thank YouT Offline
            Thank YouT Offline
            Thank You
            wrote on last edited by
            #6

            @Pl45m4 Yes
            You can see it in many android apps gmail , messenger and many more

            Let's make QT free or It will go forever

            TRUE AND FALSE <3

            J.HilkJ 1 Reply Last reply
            0
            • Thank YouT Thank You

              @Pl45m4 Yes
              You can see it in many android apps gmail , messenger and many more

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

              @Thank-You take a look at this example:

              https://doc.qt.io/qt-5/qtwidgets-draganddrop-draggableicons-example.html

              that should get you started in creating a left&right dragable widget.

              Than its only a matter of creating a custom container/layout for those widgets , so that they are listed one above the other and automatically snap back (or not) when you release the drag


              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.

              mrjjM 1 Reply Last reply
              3
              • J.HilkJ J.Hilk

                @Thank-You take a look at this example:

                https://doc.qt.io/qt-5/qtwidgets-draganddrop-draggableicons-example.html

                that should get you started in creating a left&right dragable widget.

                Than its only a matter of creating a custom container/layout for those widgets , so that they are listed one above the other and automatically snap back (or not) when you release the drag

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @J-Hilk
                So what is such a widget called in android terms?
                if a common design elements, it must have a name ?
                (still not sure how it works. sounds like slide to open menu. :)

                J.HilkJ 1 Reply Last reply
                0
                • mrjjM mrjj

                  @J-Hilk
                  So what is such a widget called in android terms?
                  if a common design elements, it must have a name ?
                  (still not sure how it works. sounds like slide to open menu. :)

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

                  @mrjj Swipe Options ? 🤷‍♂️

                  4df2b140-e1a8-4840-befb-2b9a9f5daf7c-image.png


                  edit:
                  Apparently it's called a dismissible

                  https://api.flutter.dev/flutter/widgets/Dismissible-class.html


                  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.

                  mrjjM 1 Reply Last reply
                  2
                  • J.HilkJ J.Hilk

                    @mrjj Swipe Options ? 🤷‍♂️

                    4df2b140-e1a8-4840-befb-2b9a9f5daf7c-image.png


                    edit:
                    Apparently it's called a dismissible

                    https://api.flutter.dev/flutter/widgets/Dismissible-class.html

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @J-Hilk
                    Thank you.
                    So the main Info covers some part of the area.
                    Then you can swipe to say the left to reveal extra options/actions "below it" ?

                    How come that in pic 2, there blue is only one left. the grey is gone.
                    Or is that when it sin initial state ?

                    J.HilkJ Pl45m4P 2 Replies Last reply
                    0
                    • mrjjM mrjj

                      @J-Hilk
                      Thank you.
                      So the main Info covers some part of the area.
                      Then you can swipe to say the left to reveal extra options/actions "below it" ?

                      How come that in pic 2, there blue is only one left. the grey is gone.
                      Or is that when it sin initial state ?

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

                      @mrjj said in How can I create slider and show buttons inside it:

                      How come that in pic 2, there blue is only one left. the grey is gone.

                      it indicates that swiping to the left gives you 3 options and swiping to the right only 1, or in this case toggles E-Mail read state


                      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
                      2
                      • mrjjM mrjj

                        @J-Hilk
                        Thank you.
                        So the main Info covers some part of the area.
                        Then you can swipe to say the left to reveal extra options/actions "below it" ?

                        How come that in pic 2, there blue is only one left. the grey is gone.
                        Or is that when it sin initial state ?

                        Pl45m4P Offline
                        Pl45m4P Offline
                        Pl45m4
                        wrote on last edited by Pl45m4
                        #12

                        @mrjj said in How can I create slider and show buttons inside it:

                        How come that in pic 2, there blue is only one left. the grey is gone.

                        There can be couple of options. Basically the top widget / item could hide stuff on the right and on the left. So if you swipe the "cover" item to the right, you'll see the controls on the left (the blue thing). If you swipe left, you'll see multiple flags, buttons or options from which you can choose (gray, blue, gray).

                        Same for @Thank-You second image on the right.
                        Three icons for three actions which will show up, when you swipe the mail or phone book entry to the left.


                        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                        ~E. W. Dijkstra

                        1 Reply Last reply
                        2
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          Aha and you can even also swipe up and down. it seems.
                          Ok cool little widget.

                          Pl45m4P 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            Aha and you can even also swipe up and down. it seems.
                            Ok cool little widget.

                            Pl45m4P Offline
                            Pl45m4P Offline
                            Pl45m4
                            wrote on last edited by Pl45m4
                            #14

                            @mrjj said in How can I create slider and show buttons inside it:

                            swipe up and down

                            Up / down is just a regular scroll then.
                            I think the main reason for this is to provide direct access to additional actions / features without navigating through dozens of menus. So you have your actions right below each item or list entry.
                            Sometimes you don't even have to lift your finger to select something.


                            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                            ~E. W. Dijkstra

                            mrjjM 1 Reply Last reply
                            0
                            • Pl45m4P Pl45m4

                              @mrjj said in How can I create slider and show buttons inside it:

                              swipe up and down

                              Up / down is just a regular scroll then.
                              I think the main reason for this is to provide direct access to additional actions / features without navigating through dozens of menus. So you have your actions right below each item or list entry.
                              Sometimes you don't even have to lift your finger to select something.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              @Pl45m4
                              well actually in FLUTTER it has a direction property so you can swipe it up and down if you wish. At least the video says that at 0:44 :)

                              I tried to find one on my phone but they only swipe one way.

                              So when it has say multiple buttons "under" then you hold the swipe and then press a button or how does this work ?

                              Pl45m4P 1 Reply Last reply
                              0
                              • mrjjM mrjj

                                @Pl45m4
                                well actually in FLUTTER it has a direction property so you can swipe it up and down if you wish. At least the video says that at 0:44 :)

                                I tried to find one on my phone but they only swipe one way.

                                So when it has say multiple buttons "under" then you hold the swipe and then press a button or how does this work ?

                                Pl45m4P Offline
                                Pl45m4P Offline
                                Pl45m4
                                wrote on last edited by Pl45m4
                                #16

                                @mrjj said in How can I create slider and show buttons inside it:

                                So when it has say multiple buttons "under" then you hold the swipe and then press a button or how does this work ?

                                Depends on the application. One possible way is that the most left/right visible option next to the swiped central "item" gets selected.
                                The more you swipe in one direction the more you expose the options below and the one which becomes visible last, is your selection. Then just release the swipe. Most of the time the selected button or option provides some visual feedback (like highlight, blink or frame changes).
                                The MS Outlook Mail App is a good example (OWA on mobile devices as well, I guess)

                                @J-Hilk said in How can I create slider and show buttons inside it:

                                Apparently it's called a dismissible

                                I think only in this specific case shown there (https://api.flutter.dev/flutter/widgets/Dismissible-class.html), because the items disappear. Some call it "Swipe Settings", some "Swipe Actions" and some "Swipe Options" :)
                                But I'm actually surprised that no one made a similar widget like this before and uploaded it to GitHub


                                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                ~E. W. Dijkstra

                                Thank YouT 1 Reply Last reply
                                1
                                • Pl45m4P Pl45m4

                                  @mrjj said in How can I create slider and show buttons inside it:

                                  So when it has say multiple buttons "under" then you hold the swipe and then press a button or how does this work ?

                                  Depends on the application. One possible way is that the most left/right visible option next to the swiped central "item" gets selected.
                                  The more you swipe in one direction the more you expose the options below and the one which becomes visible last, is your selection. Then just release the swipe. Most of the time the selected button or option provides some visual feedback (like highlight, blink or frame changes).
                                  The MS Outlook Mail App is a good example (OWA on mobile devices as well, I guess)

                                  @J-Hilk said in How can I create slider and show buttons inside it:

                                  Apparently it's called a dismissible

                                  I think only in this specific case shown there (https://api.flutter.dev/flutter/widgets/Dismissible-class.html), because the items disappear. Some call it "Swipe Settings", some "Swipe Actions" and some "Swipe Options" :)
                                  But I'm actually surprised that no one made a similar widget like this before and uploaded it to GitHub

                                  Thank YouT Offline
                                  Thank YouT Offline
                                  Thank You
                                  wrote on last edited by
                                  #17

                                  @Pl45m4
                                  I found demo video on this thing
                                  Wait I will post here

                                  Both of these video will direct exactly to the demo
                                  https://youtu.be/Cam2AvfJilY?t=2364
                                  https://youtu.be/hnuMyuCWwwU?t=5

                                  It is actually demo for android device
                                  But it doesn't matter

                                  ITS called
                                  "recyclerview" in android

                                  Exactly similar to the video but
                                  Those buttons should be below that layer (I guess that would be good)

                                  I hope you understands

                                  Let's make QT free or It will go forever

                                  TRUE AND FALSE <3

                                  J.HilkJ 1 Reply Last reply
                                  1
                                  • Thank YouT Thank You

                                    @Pl45m4
                                    I found demo video on this thing
                                    Wait I will post here

                                    Both of these video will direct exactly to the demo
                                    https://youtu.be/Cam2AvfJilY?t=2364
                                    https://youtu.be/hnuMyuCWwwU?t=5

                                    It is actually demo for android device
                                    But it doesn't matter

                                    ITS called
                                    "recyclerview" in android

                                    Exactly similar to the video but
                                    Those buttons should be below that layer (I guess that would be good)

                                    I hope you understands

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

                                    @Thank-You
                                    I know its QML and not QWidgets, but I promised @mrjj an example he could work/play with :D and its simply much easier to implement in QML

                                    https://github.com/DeiVadder/QmlSwipeOptions

                                    The principles and functionalities are the same in QWidgets, so it may be a good starting point for you as well


                                    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
                                    2

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved