zoukankan      html  css  js  c++  java
  • QML学习笔记(四)-TabView-竖直方向

    源码:https://github.com/sueRimn/QML-ExampleDemos

    作者: 狐狸家的鱼

    Github: 八至

    版权声明:如需转载请获取授权和联系作者

    想实现垂直竖直方向的TabView,查看文档,并没有对此的属性说明,跳出局限,自己做一个实例,录制软件没有录入鼠标

    效果如下:

    核心代码如下:

    
    
        Column{
            id:coloumn;
            spacing: 0;
             100;
            height: 500;
            Rectangle{
                 100;
                height: 20;
                color: "#ffc2fc"
                Text{
                    id:cake
                    text: "蛋糕"
                    font.pointSize: 12;
                    anchors.centerIn: parent
                }
                MouseArea{
                    anchors.fill: parent;
                    onClicked: {
                        tabView.currentIndex = 0
                    }
                }
            }
            Rectangle{
                 100;
                height: 20;
                color: "#ff557f"
                Text{
                    id:hotPot
                    text: "火锅"
                    font.pointSize: 12;
                    anchors.centerIn: parent
                }
                MouseArea{
                    anchors.fill: parent;
                    onClicked: {
                        tabView.currentIndex = 1
                    }
                }
            }
            Rectangle{
                 100;
                height: 20;
                color: "#fff66f"
                Text{
                    id:puff
                    text: "泡芙"
                    font.pointSize: 12;
                    anchors.centerIn: parent
                }
                MouseArea{
                    anchors.fill: parent;
                    onClicked: {
                        tabView.currentIndex = 2;
                    }
                }
            }
        }
        TabView{
            id:tabView;
            anchors.left: coloumn.right;
            anchors.top:coloumn.top
            height: coloumn.height
            tabsVisible: false
            tabPosition: Qt.leftEdge
            Tab{
                Rectangle{
                    anchors.fill: parent;
                    color: "#ffc2fc"
                    Text{
                        text: "今天吃蛋糕"
                        color:"#333"
                        font.pointSize: 14
                        anchors.centerIn: parent
                    }
                }
            }
            Tab{
                Rectangle{
                    anchors.fill: parent;
                    color: "#ff557f"
                    Text{
                        text: "今天吃火锅"
                        color:"#333"
                        font.pointSize: 14
                        anchors.centerIn: parent
                    }
                }
    
    
            }
            Tab{
                Rectangle{
                    anchors.fill: parent;
                    color: "#fff66f"
                    Text{
                        text: "今天吃泡芙"
                        color:"#333"
                        font.pointSize: 14
                        anchors.centerIn: parent
                    }
                }
            }
    
    
    
    
  • 相关阅读:
    笔试题总结
    ubuntu 14.04 vim install youcompleteme
    c语言位域
    strcmp函数的使用
    Spring多数据源的配置和使用
    根据出生日期计算年龄的sql各种数据库写法
    BZOJ3165 : [Heoi2013]Segment
    BZOJ2725 : [Violet 6]故乡的梦
    BZOJ2851 : 极限满月
    BZOJ2837 : 小强的形状
  • 原文地址:https://www.cnblogs.com/suRimn/p/9831269.html
Copyright © 2011-2022 走看看