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:
Code:
painter.drawEllipse(0, this->height()*this->value()/(this->maximum() - this->minimum()) + 30,
this->width(), this->width());
for a vertical scrollbar. Unfortunately, seems not to scroll correctly according to the content of my area. Any other way?
Thanks!
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.
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!