PDA

View Full Version : How to add new arrow to QScrollBar



Pwchkin80
25th April 2021, 20:06
Hello,
I'd like to add new arrows in order to have more flexible control for my tableview. For example, it may be scrollng to top and bottom of table.
I have no idea, how i an do it.

d_stranz
25th April 2021, 22:35
Probably the most straightforward way would be to subclass QScrollBar and make a composite widget with "scroll to top" tool button, a normal QScrollBar, and a "scroll to bottom" tool button stacked in a vertical layout. Use QAbstractScrollArea::setVerticalScrollBar() to replace the default scroll bar with your custom one. Your custom scroll bar will have to emit new signals for the two tool button clicks, and of course your view will have to respond to them, so you may need to subclass QTableView as well.