初識qml(qml基礎)

                                                                        持續更新中 

 

1、qml常用英語詞(ps:首字母大寫的寫法原則)

關鍵詞:   import:輸入; 

 

Rectangle:矩形;

Image:圖片

 

//////////////------------部分英語的意思-----------------///////////////

leftMargin:左邊距

z:改變疊加後,ui的顯示(誰上誰下)。

opacity:透明度        Gradient:漸變色

transparent:透明的(顏色詞彙) 

2、qml的第一個列子

import QtQuick 2.9 //qt模塊
import QtQuick.Controls 2.2

ApplicationWindow{
    visible:true;
    width:640;
    height:480;
    title:qsTr("Tabs");


SwipeView{
   id:swipeview; 
   anchors.fill:parent;
   currentIndex:tabBar.currentIndex

   Page1Form{
   }
   Page2Form{
   } 
  }

 footer: TabBar {
        id: tabBar
        currentIndex: swipeView.currentIndex

        TabButton {
            text: qsTr("Page 1")
        }
        TabButton {
            text: qsTr("Page 2")
        }
    }

}

 

ApplicationWindow:窗體,應用最上層
SwipeView:滑動視圖
anchors.fill:瞄佈局,填充;

 以下內容來自官方英譯

   此附加屬性保存窗口頁腳項。屬性可以附加到任何項。如果該項不在ApplicationWindow中,或者該窗口沒有頁腳項,則該值爲空。

 

3、qml文件是文本文件,qml的槽函數是 on+<信號>的形式

4、打印信息:console,log(...);

5、一般常用把 Item 作爲根對象,它一般是不可見的(item )

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章