QtShadcn
组件

ShadcnInput

单行文本输入:36px 高 + 6px 圆角 + 聚焦环。

基于 QQC.TextField(Basic style),替换背景与聚焦视觉。

用法

ShadcnInput {
    width: 320
    placeholderText: qsTr("请输入")
    echoMode: TextInput.Password   // 可选:密码模式
    onAccepted: console.log("enter")
}

视觉

  • h-9(36px) + 6px 圆角 + bg-input/50(半透明 input 色)
  • 聚焦:border 切 ring 色 + 3px 外环(ring 30% 透明)
  • placeholder:mutedForeground
  • disabled:opacity 50%

相关

需要前缀/后缀(图标、单位符号)时用 ShadcnInputGroup。

Copyright © 2026