QML中TextEdit怎么实现单行裁剪
可以通过设置TextEdit的属性"wrapMode"为TextEdit.NoWrap来实现单行裁剪,示例代码如下:
import QtQuick 2.0
import QtQuick.Controls 2.0
ApplicationWindow {
width: 400
height: 300
visible: true
TextEdit {
id: myTextEdit
x: 50
y: 50
width: 200
height: 30
wrapMode: TextEdit.NoWrap // 设置为单行裁剪
text: "This is a long text that should be clipped to a single line."
}
}
原文地址: https://www.cveoy.top/t/topic/epvU 著作权归作者所有。请勿转载和采集!