QtQuick.Controls 2.0:Frame Pane GroupBox

Frame Pane GroupBox建议被一层布局包裹,可以不设置width和height,他们的大小会自动适应子元素,contentHeight/contentWidth:当前内容的宽高度->不包含标题(GroupBox带标题)和边距。
总结:Frame和Pane类似,但是Frame多了边框。装上同样子元素.他们的高度和宽度相同具体看图。


QtQuick.Controls 2.0:Frame Pane GroupBox_第1张图片

 SwipeView   {
        id: swipeView
        anchors.fill: parent
        currentIndex: tabBar.currentIndex

        Page{

            Column{

                Button{
                    text:"Button"
                }

                Frame{
                    Grid{
                        Repeater{
                            model: 20
                            delegate:
                                Button{
                                    text:"Frame:"+parent.parent.parent.contentHeight+
                                         ","+parent.parent.parent.height
                                }
                        }
                    }


                    background: Rectangle {
                              color: "transparent"
                              border.color: "#21be2b"
                              radius: 2
                          }
                }

                Pane{

                    Grid{
                        Repeater{
                            model: 20
                            delegate:
                            Button{
                                text:"Pane:"+parent.parent.parent.contentHeight+
                                     ","+parent.parent.parent.height
                            }
                        }
                    }
                }
                GroupBox{
                    title: "hello"
                    Grid{
                        Repeater{
                            model: 20
                            delegate:
                            Button{
                                text:"GroupBox:"+parent.parent.parent.contentHeight+
                                     ","+parent.parent.parent.height
                            }
                        }
                    }
                    background: Rectangle {
                              color: "transparent"
                              border.color: "#21be2b"
                              radius: 2
                          }
                }



            }


        }

    }

你可能感兴趣的:(Qt,Quick)