002_qml矩阵的使用方式

学习内容:

  1. 学习Rectangle(矩形)的用法
    基础属性:x,y,width,height,color
    显示优先级:
    z: 默认为0,数字越大优先级越高
  2. 鼠标点击事件:
	MouseArea{
   
		//设置鼠标填充该Rectangle
		anchors.fill : parent 
		onClicked: {
   
			console.log("onClicked")
		}
	}
  1. 键盘事件
	//按下回车, 当前事件获取到焦点才可以操作
	Keys.onReturnPressed: {
   
		console.log("onReturnPressed")
	}
  1. 控件锚点(通过锚点的方式来设置控件的相对位置)
例如:
	// 设置一个控件
	Rectangle {
   
		id: rect1
		width: 200
		height: 100
		color: "blue"
	}
	// 控件2的位置
	方式1:直接在1的基础上进行操作
		x: rect1.width + 20
	方式2:
	在1的基础上设置间距
		anchors.left: rect1.right
		anchors.leftMargin: 20
		anchors.top: rect1.bottom
        anchors.topMargin: 20
		//居中于整个界面
        anchors.centerIn: parent
  1. 旋转和缩放
	// 旋转 顺时针 旋转30度
	rotation: 30
	//缩放倍数
	scale: 2
  1. 圆弧和渐变色
	//圆角弧度
	radius: 50
	//渐变颜色
	gradient: Gradient{
   
		GradientStop {
    position: 0.0 ; color: "lightsteelblue"}
		GradientStop {
    position: 0.5 ; color: "green"}
		GradientStop {
    position: 1.0 ; color: "blue"}
	}

相关推荐

  1. 002_qml矩阵使用方式

    2023-12-06 22:12:07       28 阅读
  2. qml中QtObject类型使用

    2023-12-06 22:12:07       33 阅读
  3. 【Qt】Qt QML获取当前时间各种方式

    2023-12-06 22:12:07       31 阅读
  4. QML使用QCustomPlot笔记

    2023-12-06 22:12:07       34 阅读
  5. 使用cuBLAS做行优先矩阵矩阵

    2023-12-06 22:12:07       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-06 22:12:07       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-06 22:12:07       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-06 22:12:07       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-06 22:12:07       20 阅读

热门阅读

  1. ARM安全架构——为复杂软件提供保护

    2023-12-06 22:12:07       46 阅读
  2. Spring Boot 在启动之前还做了哪些准备工作?

    2023-12-06 22:12:07       39 阅读
  3. MySQL二 | 函数

    2023-12-06 22:12:07       38 阅读
  4. Python发送微信模板消息

    2023-12-06 22:12:07       39 阅读
  5. 阿里云Mysql5.7 数据库恢复 qp.xb文件恢复数据

    2023-12-06 22:12:07       41 阅读