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

TextArea's wrapMode default is not as documented

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P4: Low
    • 5.15.1
    • 5.14.1
    • Documentation
    • None
    • Linux/X11
    • c7e7fe1f56852863217e052224e80464c9c0fdb8 (qt/qtquickcontrols/dev) 55e2298f3ff0130fddb09ccd1bcfddce61a8abdb (qt/qtquickcontrols/5.15)

    Description

      At https://doc.qt.io/qt-5/qml-qtquick-controls-textarea.html#wrapMode-prop

      TextArea's wrapMode is documented to default to WordWrap but it actually defaults to NoWrap.   This can be seen by running the example at the top of the above-linked reference page; a single line appears with most of the text truncated, unlike in the image shown.

      import QtQuick.Controls 2.14
      import QtQuick 2.14
      
      TextArea {
          width: 400; height: 200
          text:
              "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
              "sed do eiusmod tempor incididunt ut labore et dolore magna " +
              "aliqua. Ut enim ad minim veniam, quis nostrud exercitation " +
              "ullamco laboris nisi ut aliquip ex ea commodo cosnsequat. ";
          Component.onCompleted: {
              if (wrapMode == TextEdit.NoWrap) { console.log("wrapMode=NoWrap") }
              else if (wrapMode == TextEdit.WordWrap) { console.log("wrapMode=WordWrap") }
              else if (wrapMode == TextEdit.WrapAnywhere) { console.log("wrapMode=WrapAnywhere") }
              else if (wrapMode == TextEdit.Wrap) { console.log("wrapMode=Wrap") }
              else { console.log("Unknown wrapMode", wrapMode) }
          }
      }
      // result is NoWrap
      

      Attachments

        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
            jimav Jim Avera
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes