【问题标题】:GroupBox' offset in SplitViewSplitView 中 GroupBox 的偏移量
【发布时间】:2017-06-09 15:57:16
【问题描述】:

使用以下QML 代码:

    SplitView {
        orientation: Qt.Vertical

        anchors.fill: parent

        GroupBox {
//            id: inputBox
            title: "First"
            Layout.fillWidth: true

            anchors.top: parent.top

            anchors.topMargin: UI.boxMargin
            anchors.bottomMargin: UI.boxMargin
        }

        GroupBox {
            title: "Second"
            Layout.fillWidth: true

//            x: 15

//            anchors.topMargin: 15//UI.boxMargin
//            anchors.bottomMargin: UI.boxMargin
        }
    }

我实现了如下设计:

分隔线由两条线组成:一条较暗的线和一条较亮的线。我想在拆分器和第二个GroupBox之间添加一些偏移量,以避免(丑陋的)叠加,但我直到现在才成功(注释代码没用)。

【问题讨论】:

    标签: qt user-interface qml qtquick2


    【解决方案1】:

    Layout.topMargin 添加到第二个GroupBox。例如,

    SplitView {
        orientation: Qt.Vertical
        anchors.fill: parent
    
        GroupBox {
            title: "First"
            Layout.fillWidth: true
            height: 80
        }
        GroupBox {
            title: "Second"
            Layout.fillWidth: true
            Layout.topMargin: 15
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-05-30
      • 1970-01-01
      • 1970-01-01
      • 2018-05-20
      • 1970-01-01
      • 2013-08-24
      • 2010-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多