Results 1 to 5 of 5

Thread: Setting Initial QwtSlider Position

  1. #1
    Join Date
    Sep 2010
    Posts
    25
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Setting Initial QwtSlider Position

    This sounds very simple and probably is but how do you manipulate the slider position of a QwtSlider for example to set a range of initial positions. If I call setNum it updates the label but not the slider position. My apologies if I am missing something really easy here.

    Is it possible to disable a QwtSlider without greying out the associated scale. Or is it possible to stop the slider from being moved without disabling it.

    Thanks again in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Setting Initial QwtSlider Position

    This sounds very simple and probably is but how do you manipulate the slider position of a QwtSlider for example to set a range of initial positions.
    Qt Code:
    1. slider->setValue( value );
    To copy to clipboard, switch view to plain text mode 
    Is it possible to disable a QwtSlider without greying out the associated scale.
    The labels are painted with QPalette::Text, the ticks with QPalette::WindowText:

    Qt Code:
    1. QPalette pal = slider->palette();
    2. pal.setBrush( QPalette::Disabled, QPalette::Text,
    3. pal.brush( QPalette::Active, QPalette::Text ) );
    4. pal.setBrush( QPalette::Disabled, QPalette::WindowText,
    5. pal.brush( QPalette::Active, QPalette::WindowText ) );
    6. slider->setPalette( pal );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Mannion (20th April 2011)

  4. #3
    Join Date
    Sep 2010
    Posts
    25
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Setting Initial QwtSlider Position

    Uwe

    Prompt, thorough and concise as always. Your explanation has also made things much clearer.

    Thankyou so much. You make working with Qwt a pleasure.

  5. #4
    Join Date
    Sep 2010
    Posts
    25
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Setting Initial QwtSlider Position

    One further thing Uwe,

    Is it possible to adjust the appearance of a disabled QwtSlider so that it appears disabled apart from the scale which is drawn as if the QwtSlider was enabled?

    Thanks again for all of your help.

  6. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Setting Initial QwtSlider Position

    I recommend to check the code: all colors used for painting are taken from the current palette.

    Uwe

Similar Threads

  1. Replies: 1
    Last Post: 15th April 2010, 13:56
  2. initial position of a QSlider
    By franco.amato in forum Qt Programming
    Replies: 9
    Last Post: 24th September 2008, 18:37
  3. toolbar initial position
    By baray98 in forum Qt Programming
    Replies: 7
    Last Post: 7th September 2007, 07:39
  4. Initial Dialog Position
    By nleverin in forum Newbie
    Replies: 1
    Last Post: 15th July 2007, 10:19
  5. Setting the starting position of Main Window
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 12:17

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.