• 2931阅读
  • 1回复

zhengtianzuo系列-Qml弹出菜单 [复制链接]

上一主题 下一主题
离线zhengtianzuo
 

只看楼主 倒序阅读 楼主  发表于: 2017-10-17
主要是对菜单项的一个自定义:

```
            MenuItem {
                id: menuItem1
                anchors.left: parent.left
                anchors.leftMargin: 6
                text: qsTr("在线")
                height: 24
                indicator:
                Image {
                    id: image1
                    height: 16
                    width: 16
                    anchors.verticalCenter: parent.verticalCenter
                    source: "qrc:/images/online.png"
                }
                contentItem: Text {
                    id: text1
                    text: menuItem1.text
                    font: menuItem1.font
                    opacity: enabled ? 1.0 : 0.3
                    color: menuItem1.down ? "#AA0000" : "#148014"
                    horizontalAlignment: Text.AlignLeft
                    verticalAlignment: Text.AlignVCenter
                    leftPadding: menuItem1.indicator.width
                }
                onTriggered: {image.source = image1.source;window.visible = false;console.debug("状态切换 在线")}
            }
```



需要完整代码请访问 QtQuickExamples
博客地址: https://blog.csdn.net/zhengtianzuo06
Github: https://github.com/zhengtianzuo
个人产品: https://github.com/zhengtianzuo/Silk
产品网站: http://www.camelstudio.cn
离线big_mouse

只看该作者 1楼 发表于: 2020-04-22
快速回复
限100 字节
 
上一个 下一个