Results 1 to 9 of 9

Thread: Double slider

  1. #1
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Double slider

    Hello,

    how can i build a Double slider look like this:


    For this exaple have i use two sliders. The problem is i can't move both slider to the left or right side.

    If i subclassing a slider, how can i implement the second slider to do that?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Double slider

    I think libqext has such a slider implemented.
    http://dev.libqxt.org/libqxt/wiki/Home//page/index
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Double slider

    Thank you, i know that, but i don't want to use libqxt.

    If it's to hard to subclassing a slider, can i shrink and grow my (two) sliders. Now is the question how can i shrink and grow the slider by the slider-value? Can you help me please?

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Double slider

    Now is the question how can i shrink and grow the slider by the slider-value?
    Can you explain more what you mean?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Double slider

    For example, now is the end of the left slider by 85% and the begin of the right too. If i move the left slider to 0 % should the left slider shrink and the right slider grow. You know what i mean?

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Double slider

    resizing is not your problem, and it will have an effect you don't want - namely, when you change the size of the slider, it "sensitivity" will change, since the same range will be spread on a different length.
    This is not the way to go about it.
    You will have to create a custom widget that integrates to ranges on one slider.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Double slider

    I know how can i subclassing a slider to build my own widget, but i have no idea how can i integrate to ranges on one slider. Have you a little tip for me?

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Double slider

    Have you a little tip for me?
    Why not look at how Qextlib have done it?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Double slider

    Thank you. Now i have copy the necessary code from the following files to my project:
    qxtspanslider.h
    qxtspanslider_p.h
    qxtspanslider.cpp

    qxtnamespace.h
    qxtglobal.h
    qxtglobal.cpp

    All looks fine and now i want to clean-up my code. I cant do that because i understand the the meaning of that:

    Qt Code:
    1. &qxt_p();
    To copy to clipboard, switch view to plain text mode 

    The relevant code can you find in qxtglobal.h and the class QxtSpanSlider. Can you explain my?

    Another question is, how can i calculate the three ranges( before span, between span, after span)? All together must be 100%, e.g.

Similar Threads

  1. how to set markers below a slider in qt
    By qt_user in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2010, 07:02
  2. help on my slider
    By newb in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2010, 15:36
  3. Replies: 2
    Last Post: 21st March 2010, 09:01
  4. Replies: 2
    Last Post: 24th June 2009, 15:38
  5. get slider value
    By eric in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2007, 19:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.