2015-10-29 32 views
1

我想在ColumnLayout中使用topMargin。但我正面臨一些問題。 有人能幫我解決這個問題嗎?如何在QML的ColumnLayout中使用topMargin

這裏是我的代碼

import QtQuick 2.3 
import QtQuick.Controls 1.2 
import QtQuick.Controls.Styles 1.2 
import QtQuick.Layouts 1.1 

ApplicationWindow { 
    visible: true 
    width: 640 
    height: 480 
    title: qsTr("Hello World") 

    Rectangle{ 
     anchors.fill: parent 
     ColumnLayout{ 
      id: columlayout 
      Rectangle{ 
       width: 100 
       height: 100 
       color: "red" 
      } 
      Rectangle{ 
       Layout.topMargin: 50 
       width: 100 
       height: 100 
       color: "green" 
      } 
      Rectangle{ 
       width: 100 
       height: 100 
       color: "blue" 
      } 
     } 
    } 
} 

問題:

無法指定

回答

1

margin propertiesQtQuick.Layouts 1.2進行了介紹,所以你必須導入不存在的財產 「TOPMARGIN」該版本,而不是1.1