1

What would be the easiest way to create a marker bar in PySide/ PyQt, similar to

this
(source: sideofsoftware.com)
?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
n.jmurov
  • 123
  • 2
  • 12

1 Answers1

1

There is a QScrollBar class. You can subclass it and override the paintEvent method to do custom painting. Any class that inherits from QAbstractScrollArea (e.g. QScrollArea, QTextEdit, etc.) has two methods to set the scrollbar for the vertical or horizontal scrollbar (e.g. setVerticalScrollbar()). So create your own scrollbar class and then use those methods to apply it to the widgets that can use it.

Brendan Abel
  • 35,343
  • 14
  • 88
  • 118
  • Thanks for this. I found a solution for a marker bar in C# which involves creating a list box with 1-pixel high lines, would something like that work in Qt? – n.jmurov May 13 '16 at 01:16
  • 1
    Well, you can make anything work, but that seems kind of hacky. Using the scroll bar seems to make the most sense since the types of things that would need a marker bar already have a scroll bar. – Brendan Abel May 13 '16 at 01:24