hvaldecantos / pcer

A desktop application to run code comprehension experiments with eye tracking.
1 stars 0 forks source link

Code viewer features #24

Closed hvaldecantos closed 5 years ago

hvaldecantos commented 5 years ago
hvaldecantos commented 5 years ago

With QFontMetrics(font).lineSpacing()), we can know the height of a line in the QTextEdit document.

hvaldecantos commented 5 years ago

Now we are using:

https://github.com/hvaldecantos/pcer/blob/94532ebbaa8f1d57107bbdef1d0ab0f5134455fc/pcer/code_viewer.py#L90

It seems that the lineSpacing() method does not return the height of an entire line (character + some leading space) on monitors with high DPI. On these monitors, it works by using only the heigt() method.

self.editorHeight = self.height_in_characters * QFontMetrics(font).height()