Qt 6.11 is out! See what's new in the release
blog
TextEdit and MouseArea
-
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")} } }}