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

TextArea vs. TextEdit mouse selection behavior

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.2, 5.12.0 RC2, 6.1.2, 6.3.0 Beta2, 6.5.2, 6.6.0 Beta2
    • Quick: Controls 2
    • macOS

    Description

      Please compare the mouse text selection behaviour of a QtQuick TextEdit vs. a QtQuick Controls2 TextArea.

      While TextEdit is ok, TextArea shows these problems:

      • The Cursor position is changed on release not on press - this feels unnatural. TextEdit works as expected.
      • Just press and move the mouse downwards. A text selection should be startet. But it isn't. A horizontal movement must be made before selection is started. Again TextEdit just works as expected.
      • Sometimes selection doesn't start at all
      import QtQuick 2.11
      import QtQuick.Controls 2.4
      import QtQuick.Window 2.11
      
      ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
      
        Rectangle {
          anchors.fill: ta1
          color: "red"
          opacity: 0.2
        }
      
        // Bad
        TextArea {
          id: ta1
          height: 50
          anchors { left: parent.left; right: parent.right }
          clip: true
      
          text: "Line 1: Hello Hello Hello\nLine 2: Hello Hello Hello\nLine 3: Hello Hello Hello"
          selectByMouse: true
      
          leftPadding: 0
          rightPadding: 0
          bottomPadding: 0
          topPadding: 0
          padding: 0
        }
      
        Rectangle {
          anchors.fill: ta2
          color: "green"
          opacity: 0.2
        }
      
        // Good
        TextEdit {
          id: ta2
          y: 50
          height: 50
          anchors { left: parent.left; right: parent.right }
          clip: true
      
          text: "Line 1: Hello Hello Hello\nLine 2: Hello Hello Hello\nLine 3: Hello Hello Hello"
          selectByMouse: true
      
          leftPadding: 0
          rightPadding: 0
          bottomPadding: 0
          topPadding: 0
          padding: 0
        }
      }
      

      Attachments

        Issue Links

          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
              njeisecke Nils Jeisecke
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes