Results 1 to 3 of 3

Thread: Creating custom scrollbars

  1. #1
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Creating custom scrollbars

    Hi! I'm trying to create a custom scrollbar. I subclassed QScrollBar and I overwrote the paint method. Seems to work quite ok, but I'm not able to make the cursor move correctly. I placed an ellipse this way:

    Qt Code:
    1. painter.drawEllipse(0, this->height()*this->value()/(this->maximum() - this->minimum()) + 30,
    2. this->width(), this->width());
    To copy to clipboard, switch view to plain text mode 

    for a vertical scrollbar. Unfortunately, seems not to scroll correctly according to the content of my area. Any other way?
    Thanks!

  2. #2
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating custom scrollbars

    By creating your own style (subclassing QStyle ) you will be able to define a custom drawing and behaviour for your scrollbar.

  3. #3
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Creating custom scrollbars

    Thanks for the advice. Anyway, seems very difficult to do it that way, isn't it possible to just use the same way I used, only adjusting the values?
    Thanks!

Similar Threads

  1. creating custom signal
    By aj2903 in forum Qt Programming
    Replies: 10
    Last Post: 18th November 2021, 09:33
  2. QFileSystemModel: creating custom rows of data
    By masterlaws in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2013, 11:58
  3. Creating Custom Ellipse Button
    By VireX in forum Qt Programming
    Replies: 18
    Last Post: 30th May 2012, 11:23
  4. Problem in Creating/installing Custom Widget
    By angeshwar in forum Qt Programming
    Replies: 0
    Last Post: 14th September 2009, 16:33
  5. Creating custom slots
    By harb37 in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2008, 18:10

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.