Tortoisehg on high dpi displays

Issue #3690 resolved
Anonymous created an issue

Tortoisehg has some issues on high dpi displays. Some icons get cut off, some icons are simply too small. Most text is slightly too big for their containers.


Comments (37)

  1. Yuya Nishihara

    Thanks. It seems there are two different issues:

    • height of graph row, rowheight and dotradius, is hard-coded to 20px
    • several tool buttons have setIconSize(QSize(16,16))
  2. Andreas Magnusson

    Actually there's a third issue as well, but those are the most serious (especially the first). The third one is that the resize-bars seems to remember their position in pixels so when switching between different DPIs (due to different monitor setups) the different views will either be extremely narrow or extremely wide.

  3. Yuya Nishihara

    I think the first and the second issues can be fixed in TortoiseHg 3.1.

    The third one, remember their position in pixels, is probably the issue of Qt and won't be fixed.

  4. Yuya Nishihara

    repomodel: delegate calculation of graph width to view (refs #3690)

    The next commit will move the graph renderer to GraphDelegate, so the model will no longer be possible to calculate the size of graph cells.

    GraphDelegate.sizeHint will be reimplemented later to not create QPixmap.

    → <<cset 2178ebe011ce>>

  5. Yuya Nishihara

    graphdelegate: move graph renderer from repomodel (refs #3690)

    This change is necessary to scale graph image according to the actual height of the view. The model doesn't have enough information to scale graph image appropriately.

    GraphRole is superseded by GraphNodeRole.

    → <<cset 8eea86a343a2>>

  6. Yuya Nishihara

    repoview: switch to QTreeView which is suitable for row-based data (refs #3690)

    It seems that QTableView is designed for cell-based data, but our repository model is row-based, so QTreeView would be better choice. Also, the doc of QListView says "This view does not display horizontal or vertical headers; to display a list of items with a horizontal header, use QTreeView instead."

    This can eliminate the hard-coded row height, which means the view can enlarge the height if the font is larger than 20px.

    setSelectionBehavior() is removed because it is the default of QTreeView.

    → <<cset 7b73fe6d0c17>>

  7. mikeeci

    I just installed 3.0.2 (and rebooted) and this still isn't working for me on Windows. Is there some sort of configuration setting that needs to be made?

  8. Yuya Nishihara

    infobar: use the same close-button icon as dock widget (refs #3690)

    SP_TitleBarCloseButton should be as large as the close button of QDockWidget. Contrary to the name, SP_DockWidgetCloseButton is unused in Qt library and slightly smaller than dock's.

    → <<cset cf7f50e881ff>>

  9. Yuya Nishihara

    mq, branch and head labels in boxes on the left of the description column are the incorrect height.

    Could you elaborate on "the incorrect" height?

    It is designed to use 1pt-smaller font than the default one.

    re-size mouse cursors between panes are very small.

    Probably it is the issue of Qt. We don't control the mouse cursor.

    close icon in the green 'push completed' notification is very small

    Addressed by cf7f50e881ff.

  10. Yuya Nishihara

    It looks like the bounding rect is calculated in 96dpi. But I couldn't reproduce the issue on my Windows XP VM with 200% scaling (192dpi.)

    • Which Windows version?
    • Is the dpi set globally?
      (I guess Windows has several compatibility options, but I know little about Windows.)
    • What is the font?
  11. Tom Whittock


    It's windows 8.1, dpi set to 200%, multi-monitor dpi, the other monitor is 150%, the font is the default Windows 8.1 font (you don't seem to be allowed to change it anymore!) which I believe is Segoe WP.

  12. Yuya Nishihara

    Thanks for the info. I guess certain components of Qt4 does not support multi-monitor dpi or new dpi scaling introduced in Windows 8.

    I got similar result on XP until I restart the PC after changing dpi value. Maybe it implies there are different ways to manage dpi scaling.


  13. Tom Whittock

    i see - i believe qt5 does have much better support for high dpi.

    You mentioned previously that "It looks like the bounding rect is calculated in 96dpi" - if there is a build available with a fix for this change, I could test to see if it improves in Win 8.1.

  14. Yuya Nishihara

    Maybe, but moving to Qt5 (and Python3) is challenging.

    Could you test the following extensions? It's tough to find workaround without reproducible environment.

    • ... current tip (slightly modified from rc build)
    • ... obtain application font by QApplication.font() that might have correct dpi
    • ... dirty hack to calculate rect using painter's fontMetrics() (but the size of pixmap is wrong)
  15. Yuya Nishihara

    repomodel: make sure to use screen-compatible metrics for labels (refs #3690)

    It appears that QFontMetrics(font) does not always reflect the monitor dpi on Windows 8.

    I guess painter.fontMetrics() is the best way to obtain device-dependent metrics, but it cannot be used since we need to calculate the size of QPixmap prior to painting. The doc says "if the paintdevice is 0, the metrics will be screen-compatible," so QFontMetrics(font, None) should be the same as QFontMetrics(font, pixmap).

    Special thanks to Tom Whittock for his debugging support.

    → <<cset ec24f9d9de1c>>

  16. Log in to comment