Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. TextEdit and MouseArea
Qt 6.11 is out! See what's new in the release blog

TextEdit and MouseArea

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 198 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DmitryTS
    wrote on last edited by
    #1

    Hello, tell me please, how can I add a MouseArea to the TextEdit so that I can enter text, but if the course goes beyond the TextEdit element, I can process the onExited signal
    Flickable {

      id: flick
      width: 300; height: 200;
      contentWidth: edit.paintedWidth
      contentHeight: edit.paintedHeight
      clip: true
    
      function ensureVisible(r)
      {
          if (contentX >= r.x)
              contentX = r.x;
          else if (contentX+width <= r.x+r.width)
              contentX = r.x+r.width-width;
          if (contentY >= r.y)
              contentY = r.y;
          else if (contentY+height <= r.y+r.height)
              contentY = r.y+r.height-height;
      }
    
      TextEdit {
          id: edit
          width: flick.width
          focus: true
          wrapMode: TextEdit.Wrap
          onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
    
           MouseArea {
                id: mouseArea
                anchors.fill: parent
                hoverEnabled: true
                propagateComposedEvents: true
                onExited: {console.log("out mouse area")}
               }
      }
    

    }

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved