Results 1 to 17 of 17

Thread: Customize tick labels in a QwtSlider

Hybrid View

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

    Default Re: Customize tick labels in a QwtSlider

    Build and run the application below ( unmodified - please no more modifications from your code ).

    Isn't this what you want ?

    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_slider.h>
    3. #include <qwt_scale_div.h>
    4.  
    5. int main( int argc, char **argv )
    6. {
    7. QApplication a( argc, argv );
    8.  
    9. QwtSlider slider( NULL, Qt::Horizontal, QwtSlider::BottomScale );
    10.  
    11. QList< double > ticks[ QwtScaleDiv::NTickTypes ];
    12. ticks[ QwtScaleDiv::MajorTick ] << 500 << 1500 << 2500 << 3500
    13. << 4500 << 5500 << 6500 << 7500 << 8500 << 9500;
    14.  
    15. slider.setScale( QwtScaleDiv( 500, 9500, ticks ) );
    16. slider.setRange( 500, 9500, 1000 );
    17.  
    18. slider.show();
    19.  
    20. return a.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 

    This is really a "schwere Geburt",

    Uwe

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

    RomanRdgz (10th September 2012)

  3. #2
    Join Date
    Sep 2012
    Posts
    9
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Customize tick labels in a QwtSlider

    Ok, it does work now. The problematic line was:

    Qt Code:
    1. ui.timeSampleSlider->setScaleMaxMinor(0);
    To copy to clipboard, switch view to plain text mode 

    Which is weird, but without that line my code works exactly as yours. Thanks for your time!

Similar Threads

  1. How to hide tick labels
    By ken123 in forum Qwt
    Replies: 1
    Last Post: 24th November 2011, 07:15
  2. Y Axis tick labels cut off on left
    By rbergeron in forum Qwt
    Replies: 2
    Last Post: 4th November 2011, 14:29
  3. Axis Tick Labels Overlap
    By amoswood in forum Qwt
    Replies: 3
    Last Post: 8th June 2010, 15:52
  4. y-axis tick labels trimmed
    By gib in forum Qwt
    Replies: 2
    Last Post: 2nd April 2010, 05:19
  5. Tick Labels for Slider
    By jcraig in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 17:21

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
  •  
Qt is a trademark of The Qt Company.