查看完整版本: [-- zhengtianzuo系列-Qml弹出菜单 --]

QTCN开发网 -> Qt代码秀 -> zhengtianzuo系列-Qml弹出菜单 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

zhengtianzuo 2017-10-17 14:48

zhengtianzuo系列-Qml弹出菜单

主要是对菜单项的一个自定义:

```
            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

big_mouse 2020-04-22 09:16


查看完整版本: [-- zhengtianzuo系列-Qml弹出菜单 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled