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

QLineEdit::minimumSizeHint insufficient

    XMLWordPrintable

Details

    • All
    • 5f87fb881383f6170ca2cf82958709b04372aae6 (qt/qtbase/5.15)
    • Q1/2020 Finale

    Description

      The documentation of QLineEdit::minimumSizeHint claims:

      The width returned is enough for at least one character.

      This is not actually the case, as can be seen in the attached screenshot for the character ‱.

      The reason is that qlineedit_p.cpp has an additional 2 pixel magic margin (QLineEditPrivate::horizontalMargin) it adds, but the minimumSizeHint function forgets about using that.

      We noticed this when trying to make a line edit have at least the width of its text, by querying its minimumSizeHint and subtracting the font metric's maximumCharWidth, then adding the width of the contained text. This should always work according to the documentation, but leaves the text cropped by 4 pixels ([left + right] * 2 pixels) in practice.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            scummo Sven Brauch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes