| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // 通用信息卡片组件
- import QtQuick
- import Felgo 4.0
- Rectangle {
- id: root
- property string titleText: ""
- property string contentText: ""
- property string subContentText: ""
- property string iconSource: ""
- property int iconSize: 50
- property bool showSettingsIcon: false
- property var extraContent: []
- color: app.cardColor
- radius: 5
- Column {
- anchors.centerIn: parent
- spacing: 5
- // 图标
- AppImage {
- id: icon
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.topMargin: 30
- width: root.iconSize
- height: root.iconSize
- source: root.iconSource
- fillMode: Image.PreserveAspectFit
- cache: true
- }
- // 标题
- AppText {
- id: title
- anchors.horizontalCenter: parent.horizontalCenter
- text: root.titleText
- color: app.fontColor
- font.bold: true
- fontSize: 16
- }
- // 主内容
- AppText {
- id: content
- anchors.horizontalCenter: parent.horizontalCenter
- text: root.contentText
- color: "gray"
- fontSize: 10
- }
- // 副内容
- AppText {
- anchors.horizontalCenter: parent.horizontalCenter
- text: root.subContentText
- color: "gray"
- fontSize: 10
- visible: root.subContentText !== ""
- }
- // 额外内容列表
- Repeater {
- model: root.extraContent.length
- AppText {
- anchors.horizontalCenter: parent.horizontalCenter
- text: root.extraContent[index].text
- color: root.extraContent[index].color
- fontSize: 10
- }
- }
- // 设置图标
- AppImage {
- id: settingsIcon
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.topMargin: 5
- width: 30
- height: 30
- source: "../../assets/set.svg"
- fillMode: Image.PreserveAspectFit
- visible: root.showSettingsIcon
- }
- }
- }
|