0

What I have is a Qt Text Browser which has an HTML table with one row, two columns. I have the almost same text at both columns which has slight differences. Those texts inside of columns are shaped with indentations, you can think them as python codes or json context.

Context goes as;

Part 1
...
...
Part 2
...
...

etc.

Now, I produce this context for both columns myself, then put them together with:

f'<table style="width:100%"><tr><th>Left</th><th>Right</th></tr><tr><td>{left}</td><td>{right}</td></tr></table>'

I can have all the indexes of "Part" headers for Left string or I can count newlines such as <br> or </p> but it may not be accurate since there are some lines that are so long that automatically continues in a new line.

What I would like to do is having a button that whenever I click adjust vertical scroll bar to next Part header.

What I couldn't do is calculate locations of headers in a way that I can just give them to vertical scroll bar with setValue().

Is there any way to do this?

I am using Python 3.6.3 and PyQt5.

Edit : Apperantly this question has been marked as possible duplication with How to get scroll bar real width in Qt? . It is not. I have already read that one and that one asks how to calculate "width" for a custom widget in Qt 3.2.3 what I am asking is how to calculate "height" or "value" for verticalScrollBar in QTextBrowser in Qt5.

mtilhan
  • 258
  • 4
  • 12

0 Answers0