• 3368阅读
  • 2回复

zhengtianzuo系列-Qml底部导航 [复制链接]

上一主题 下一主题
离线zhengtianzuo
 

只看楼主 倒序阅读 楼主  发表于: 2017-10-19
footer加上TabBar即可实现底部导航

```
footer: TabBar {
        id: bar
        height: 48
        width: parent.width
        currentIndex: 0

        ListModel {
            id: myModel
            ListElement { modelText: "消息"; modelSrc: "qrc:/Chat_MsgRecord.svg"; modelSrcG: "qrc:/Chat_MsgRecordG.svg";}
            ListElement { modelText: "联系人"; modelSrc: "qrc:/Chat_FriendManager.svg"; modelSrcG: "qrc:/Chat_FriendManagerG.svg";}
            ListElement { modelText: "发现"; modelSrc: "qrc:/Mobile_Find.svg"; modelSrcG: "qrc:/Mobile_FindG.svg";}
            ListElement { modelText: "我"; modelSrc: "qrc:/Main_P2PChat.svg"; modelSrcG: "qrc:/Main_P2PChatG.svg";}
        }

        Repeater {
            model: myModel

            TabButton {
                height: bar.height
                contentItem:Text{
                    text: modelText
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignBottom
                    color: (model.index === bar.currentIndex) ? "#148014" : "#000000"
                }
                background:Image{
                    width: 24
                    height: 24
                    anchors.horizontalCenter: parent.horizontalCenter
                    source: (model.index === bar.currentIndex) ? modelSrcG : modelSrc
                }
            }
        }
    }
```



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

只看该作者 1楼 发表于: 2017-10-25
佩服你的精神!一定要好好研究你发的每一个帖子。
离线zhengtianzuo

只看该作者 2楼 发表于: 2017-10-25
回 lsyzsl 的帖子
lsyzsl:[表情] 佩服你的精神!一定要好好研究你发的每一个帖子。 (2017-10-25 08:16) 

谢谢 我还在继续~
博客地址: https://blog.csdn.net/zhengtianzuo06
Github: https://github.com/zhengtianzuo
个人产品: https://github.com/zhengtianzuo/Silk
产品网站: http://www.camelstudio.cn
快速回复
限100 字节
 
上一个 下一个