QML学习
main.qml
import QtQuick 2.15
import QtQuick.Window 2.15Window {width: 640height: 480visible: truetitle: qsTr("Hello World")Rectangle {anchors.centerIn: parentwidth: textEdit.widthheight: textEdit.heightcolor: "yellow"TextEdit {id: textEditanchors.centerIn: parenttext: "TextEdit"color: "red"font{pointSize: 30bold: true}selectByMouse: trueselectionColor: "blue"cursorDelegate: Canvas {width: 4onPaint: {var ctx = getContext('2d')ctx.setLineDash([2, 2, 2])ctx.lineWidth = 4ctx.strokeStyle = "#444fff"ctx.lineCap = "round"ctx.beginPath()ctx.moveTo(0, 0)ctx.lineTo(0, height)ctx.stroke();}}}}
}
演示