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

Manipulating Text's width or height in onLineLaidOut causes crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Incomplete
    • Affects Version/s: 5.2.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Qt 5.2.1 on Linux Mint

      Description

      I have a Text element which arranges text in columns. When the last line has been laid out, it sets the Text item's width according to how many columns there are. Changing width or height of the Text element inside onLineLaidOut causes a crash in QTextLine as a response to geometry change.

      Moving the command into a timer works just fine, however for my usecase (ListView) the width must be determined right away.

      import QtQuick 2.0
      
      Rectangle {
          width: 800
          height: 600
      
          Text {
              anchors.fill: parent
              text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
              wrapMode: Text.WrapAtWordBoundaryOrAnywhere
      
              onLineLaidOut: {
                  width = 500
              }
          }
      }
      

      This example crashes on startup. Depending on the amount of text it may work but as soon as you resize the window smaller it will crash (also on Android, ie. rotating screen).

        Attachments

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

          Activity

            People

            Assignee:
            broulik Kai Uwe Broulik
            Reporter:
            broulik Kai Uwe Broulik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes