| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- RowLayout {
- id: reusetextfield
- anchors.fill: parent
- spacing: 10
- property string strTitle: ""
- property string strValue: ""
- Rectangle {
- width: parent.width * 0.225
- height: parent.height
- color: "#00ffffff"
- Text {
- id: reusetextfield_text_title
- anchors.fill: parent
- font.pixelSize: 25
- color: "#ffffff"
- horizontalAlignment: Text.AlignRight
- verticalAlignment: Text.AlignVCenter
- }
- }
- Rectangle {
- id: textFieldContainer
- x: parent.width * 0.225
- width: parent.width * 0.675
- height: parent.height * 0.725
- color: "#ffffff"
- radius: 5
- TextField {
- id: reusetextfield_text_value
- anchors.fill: parent
- anchors.margins: 2
- color: "#a3000000" // 70%透明度的黑色
- placeholderTextColor: "#60ffffff" // 40%透明度的白色
- // 字体设置
- font {
- pixelSize: 20
- styleName: "Regular"
- }
- // 背景设置
- background: Rectangle {
- color: "transparent"
- radius: parent.parent.radius - 1 // 使内圆角略小于外框
- }
- // 对齐和边距
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- padding: 5 // 统一设置四个方向的padding
- // 其他属性
- selectionColor: "#a300aaff" // 选中文本的背景色
- wrapMode: Text.NoWrap
- renderType: Text.QtRendering
- onTextChanged:
- {
- strValue = text;
- }
- }
- }
- Connections {
- target: reusetextfield
- onStrTitleChanged: {
- reusetextfield_text_title.text = strTitle;
- }
- onStrValueChanged: {
- reusetextfield_text_value.text = strValue;
- }
- }
- Component.onCompleted: {
- reusetextfield_text_title.text = strTitle;
- reusetextfield_text_value.text = strValue;
- }
- }
|