Results 1 to 2 of 2

Thread: QScrollBar: custom slider's size ?

  1. #1
    Join Date
    Mar 2006
    Posts
    8
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default QScrollBar: custom slider's size ?

    hi:
    How to resize slider in QScrollBar manually ?

    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollBar: custom slider's size ?

    Hi,

    You have to subclass a QStyle object, and change some Pixel Metric settings for your slider.
    Here, you have a list of parameters that can be tuneds :
    http://doc.trolltech.com/4.1/qstyle....xelMetric-enum

    In your custom style class, you have to reimplement those values in this method :
    Qt Code:
    1. int myStyle::pixelMetric(PixelMetric metric,
    2. const QStyleOption *option,
    3. const QWidget *widget) const
    4. {
    5. switch (metric)
    6. {
    7. case PM_SliderLength :
    8. return 20; // Here, just put the length you want
    9. ....
    10. ....
    11. }
    To copy to clipboard, switch view to plain text mode 

    You can check the styles example in the docs

    Guilugi.

Similar Threads

  1. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12
  2. size issues for custom QWidget in QScrollArea
    By anotheruser in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2006, 14:52
  3. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.