您可以使用'wrapMode'属性将'TextEdit'的文本换行方式更改为'TextEdit.NoWrap',然后使用'clip'属性将其超出宽度的文本裁剪掉。

例如:

TextEdit {
    wrapMode: TextEdit.NoWrap
    clip: true
    width: 200 // 设置TextEdit的宽度
    text: 'This is a long text that will be clipped if it exceeds the width of the TextEdit.'
}

这将导致'TextEdit'的文本超过宽度时被裁剪掉而不是自动换行。

QML TextEdit 超宽文本裁剪而不是换行

原文地址: https://www.cveoy.top/t/topic/nRmB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录