当前位置: 首页> 健康> 母婴 > 农村自建房设计师哪里找_网络科技公司属于什么行业_简述seo对各类网站的作用_sem推广竞价托管公司

农村自建房设计师哪里找_网络科技公司属于什么行业_简述seo对各类网站的作用_sem推广竞价托管公司

时间:2025/7/11 9:40:47来源:https://blog.csdn.net/m0_58233509/article/details/143816019 浏览次数:0次
农村自建房设计师哪里找_网络科技公司属于什么行业_简述seo对各类网站的作用_sem推广竞价托管公司

布局使用

Column控件的使用

main.qml

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Column{ //列布局id:colspacing: 10 //控件间距Repeater{ //使控件重复id:rep
//            model: 3  //控制数量或者数据model:ListModel{}Button{width: 100height: 50
//                text: "btn"+indextext: name //name是从按钮点击的时候拿到的name}}move: Transition {// 移动时候弹跳NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }}add: Transition { //添加时候弹跳NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }}populate: Transition { //从控件创建的时候 200坐标移动到当前左边的动画NumberAnimation { properties: "x,y"; from: 200; duration: 1000; easing.type: Easing.OutBounce }}}Button{anchors.bottom:parent.bottomanchors.bottomMargin: 20onClicked: {rep.model.insert(0,{"name":rep.model.count})}}
}

Row控件的使用

main.qml

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Rectangle{width: 400height: 300border.color: "black"Row{ //行布局,默认是从左往右进行绘制的。id:colspacing: 10 //控件间距leftPadding: 40 //距离左边40像素topPadding: 40 //距离上面40像素layoutDirection: Qt.RightToLeft //设置从右往左绘制Repeater{ //使控件重复id:repmodel: 3  //控制数量或者数据//            model:ListModel{//            }Button{width: 100height: 50text: "btn"+index}}Component.onCompleted: {console.log(effectiveLayoutDirection) //显示是否有镜像}}}}

Flow控件的使用

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Rectangle{width: 300height: 200border.color: "black"Flow { //根据父控件的大小去调整自己的布局,流式布局flow:Flow.TopToBottom //默认从左往右  ,设置之后是从上到下绘制。anchors.fill: parentanchors.margins: 4spacing: 10Text { text: "Text"; font.pixelSize: 40 }Text { text: "items"; font.pixelSize: 40 }Text { text: "flowing"; font.pixelSize: 40 }Text { text: "inside"; font.pixelSize: 40 }Text { text: "a"; font.pixelSize: 40 }Text { text: "Flow"; font.pixelSize: 40 }Text { text: "item"; font.pixelSize: 40 }}}}

Gird控件使用

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Rectangle{width: 300height: 200border.color: "black"Grid {topPadding: 20
//            columns: 3 //指定有3列rows: 2 //指定有2行spacing: 2Rectangle { color: "red"; width: 50; height: 50 }Rectangle { color: "green"; width: 20; height: 50 }Rectangle { color: "blue"; width: 50; height: 20 }Rectangle { color: "cyan"; width: 50; height: 50 }Rectangle { color: "magenta"; width: 10; height: 10 }}}
}

自定义Grid控件

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Grid {visible: falseid:gridcolumns: 3width: 15height: 300x:200y:100Repeater{model:grid.width/5 * 200/5
//                model:grid.width/5 * grid.height /5Rectangle{width: 5;height: 5color: index%2?"black":"white"}}}Rectangle{id:retwidth: grid.widthheight: grid.heightradius: 10border.color: "black"}Rectangle{id:bor_retwidth: grid.width+4height: grid.height+4
//        anchors.horizontalCenter: parent.horizontalCenter
//        anchors.bottom: parent.bottomborder.color: "black"radius: 10border.width: 3
//        OpacityMask:{ //制作阴影效果,12版本没有,哭了,这qml真难学
//            source :grid
//            maskSource:ret
//            anchors.fill:parent
//            anchors.margins:2
//        }}Button{id:btnx:100width: 50height: 50onClicked: {
//            bor_ret.height-= 10grid.height -= 10 //点击-10,会导致不断绘制,可以改变grid的高度}}}

访问复杂组件的子项

import QtQuick 2.12 //2.15
import QtQuick.Window 2.12 //2.15
import QtQuick.Controls 2.12 //可以引入别的控件
import Qt.labs.folderlistmodel 2.12
import Qt.labs.platform 1.0 as Platform
//import QtQuick.Layouts 1.15Window{id:windowwidth:800height:600title: ""visible :trueColumn{id:colRepeater{id:repmodel:3Button{id:btny:index*60text: "btn"+index}}Text {id: txttext: qsTr("text")}Rectangle{id:rectwidth: 100height: 20color: "black"}}Button{id:btn2x:200width: 100height: 50text: "click"onClicked: {console.log("length = ",col.children.length) //虽然是5个控件,但是界面上Repeater也是一个控件。for(var i=0;i<col.children.length ;i++){if(col.children[i] instanceof Button){console.log(col.children[i].text)}
//                console.log(col.children[i] instanceof Button )  //判断是否是这个对象的实例。}}}}
import QtQuick 2.12 //2.15
import QtQuick.Window 2.12 //2.15
import QtQuick.Controls 2.12 //可以引入别的控件
import Qt.labs.folderlistmodel 2.12
import Qt.labs.platform 1.0 as Platform
//import QtQuick.Layouts 1.15Window{id:windowwidth:800height:600title: ""visible :trueListView{id:listwidth: 100height: 300model: ['张三','李四',"王五"]delegate: Text{   //绘制 控制单个 项id:txttext: modelData}}Button{id:btnx:200width: 100height: 50onClicked: {var len = list.contentItem.children.length //访问内部控件console.log(len)for(var i=0;i<len;i++ ){console.log(list.contentItem.children[i])}}}
}
import QtQuick 2.12 //2.15
import QtQuick.Window 2.12 //2.15
import QtQuick.Controls 2.12 //可以引入别的控件
import Qt.labs.folderlistmodel 2.12
import Qt.labs.platform 1.0 as Platform
//import QtQuick.Layouts 1.15Window{id:windowwidth:800height:600title: ""visible :trueListView{id:listwidth: 100height: 300model: ['张三','李四',"王五"]delegate: Column{Text{id:txttext: modelData}Button{id:btn1text: "btn"+index}}}Button{id:btnx:200width: 100height: 50onClicked: {var len = list.contentItem.children.length //访问内部控件console.log(len)for(var i=0;i<len;i++ ){var col =  list.contentItem.children[i];console.log(col.children.length)for(var j=0;j< col.children.length;j++){console.log(col.children[j])}}}}
}

关键字:农村自建房设计师哪里找_网络科技公司属于什么行业_简述seo对各类网站的作用_sem推广竞价托管公司

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: