Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123850

Inconsistent tab distance for QLabel depending on the text interaction flags

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15, 6.6
    • None
    • All

    Description

      When using tab characters in QLabel, the tab spacing is inconsistent depending on the fact that it is using the internal QWidgetTextControl or not, which is the case of setting the textInteractionFlags property.

      The default plain text mode just falls back to the style drawItemText(), and most styles normally use the QCommonStyle behavior,  based on QPainter::drawText() that uses  the horizontal advance of 8 "x" letters of the current font.

      When the underlying text control is enabled, it uses the default (and absolute) 80 pixel tab stop distance instead.

      I suppose that altering this "established" behavior may be an issue (especially for other widgets that explicitly use drawItemText() with tabs, such as QMenu), but this inconsistency is still quite important when dealing with fonts having an horizontal advance of x that is quite different than 10 pixels, and it should at least be documented.

      Attachments

        1. labeltab.png
          labeltab.png
          3 kB
        2. labeltab.py
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            musicamante Maurizio Berti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes