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

QStaticText return incorrect size

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.2
    • GUI: Text handling
    • None
    • Windows 7 x64

    Description

      I cant get correct size of QStaticText. I have text that is layout into several lines and have known width of text item on the screen, that is smaller than width of the whole text.

      Investigating this issue i found that call of QTextDocument::adjustSize() at qstatictext.cpp:664 in QStaticTextPrivate::paintText function, changes size of corresponding QTextDocument used to layout text for QStaticText. So i always get adjusted size, that is not react on QStaticText::setTextWidth changes.

      I have tested same code without call of QTextDocument::adjustSize(), and its work fine.

      In attached files for text is used QStaticText and red line display height of QStaticText.

      Attachments

        1. 1.png
          1.png
          51 kB
        2. 2.png
          2.png
          33 kB
        3. 3.png
          3.png
          25 kB
        4. main.cpp
          0.8 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            kalemas Konstantin Maslyuk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes