gpt4 book ai didi

text - 自定义TextEdit,当它变宽时如何隐藏TextInput

转载 作者:行者123 更新时间:2023-12-02 08:27:06 24 4
gpt4 key购买 nike

我正在尝试使用 TextInput 元素创建自定义文本字段(我需要它来使用验证器和自定义样式)。但我不能隐藏 TextInput 内容扩展的一部分(见图)。我对其他元素有类似的问题,虽然它具有包含其他项目的根项目(容器),但如果将它们放置在容器坐标之外,则可以看到子项。如果 child 的部件不在根容器中,我该如何隐藏它们?

有代码,但实际上只是模板,我尝试使用 z 属性,但没有成功。

BreezeQuickLineInput.qml

import QtQuick 2.4

Item {
id: root
property int fontSize: 18
property BreezeQuickPalette palette: BreezeQuickPalette
property string text: "Type here..."
implicitHeight: input.font.pixelSize*2
implicitWidth: 196
Rectangle{
id: body
color: "transparent"
anchors.fill: parent
border {
color: palette.plasmaBlue
width: 1
}
TextInput{
id: input
anchors {
fill: parent
}
font.pointSize: fontSize
color: palette.normalText
selectByMouse: true
}
}
}

感谢任何帮助。我检查了 TextInput 文档,但如果你知道我应该学习什么主题,请告诉我。

enter image description here

最佳答案

只需添加剪辑:真在您的文本输入中。这将解决您的问题。

关于text - 自定义TextEdit,当它变宽时如何隐藏TextInput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31225162/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com