当前位置: 首页 > news >正文

移动wap是什么意思合肥seo排名优化公司

移动wap是什么意思,合肥seo排名优化公司,wordpress页面链接如何修改,wordpress安装音乐插件怎么用目录 一、属性绑定1、直接绑定 property01: property02实例代码 2、条件绑定 Qt.binding实例代码 二、信号传递1、on<Property>Changed实例代码 2、on<Signal>实例代码 3、条件信号传递 connect实例代码 4、Connections 一、属性绑定 属性绑定具有持续性 1、直接…

目录

  • 一、属性绑定
    • 1、直接绑定 property01: property02
      • 实例
      • 代码
    • 2、条件绑定 Qt.binding
      • 实例
      • 代码
  • 二、信号传递
    • 1、on<Property>Changed
      • 实例
      • 代码
    • 2、on<Signal>
      • 实例
      • 代码
    • 3、条件信号传递 connect
      • 实例
      • 代码
    • 4、Connections

一、属性绑定

属性绑定具有持续性

1、直接绑定 property01: property02

在组件初始化后,一直绑定
子界面可以直接调用父界面的全部组件/属性

实例

在这里插入图片描述

代码

// 父界面
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.4ColumnLayout {anchors.fill: parentRectangle {id: rootRecLayout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 5)color: "gray"opacity: 0.5Text {id: rootRecSizetext: rootRec.width + " * " + rootRec.heightfont.pixelSize: 22anchors.centerIn: parent}}// 子界面SecondPane {Layout.alignment: Qt.AlignHCenterLayout.topMargin: 50Layout.fillWidth: trueLayout.preferredHeight: 80}
}
// 子界面
import QtQuick 2.15
import QtQuick.Controls 1.4TextField {id: secondText// 内部明确size, 便于预览效果,   实际size在调用处再次设置width: 200// 子界面可以直接调用父界面的组件text: "second call root:  " + rootRecSize.textfont.pixelSize: 20horizontalAlignment: Qt.AlignHCenterverticalAlignment: Qt.AlignVCenter
}

2、条件绑定 Qt.binding

满足某些条件时,才进行绑定动作。
如果绑定时,组件还未初始化完成,绑定动作会失效。

实例

点击方框后,才开始属性绑定
在这里插入图片描述

代码

// 父界面
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.4ColumnLayout {anchors.fill: parentRectangle {id: rootRecLayout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 3)color: "gray"opacity: 0.5Text {id: rootRecSizetext: rootRec.width + " * " + rootRec.heightfont.pixelSize: 22anchors.centerIn: parent}}// 子界面SecondPane {id: secondPaneLayout.alignment: Qt.AlignHCenterLayout.topMargin: 50Layout.fillWidth: trueLayout.preferredHeight: 80MouseArea {anchors.fill: parentonClicked: {// 单次赋值,不具备持续性
//                secondPane.text = rootRecSize.textsecondPane.text = Qt.binding(function() {return rootRecSize.text})}}}
}
// 子界面
import QtQuick 2.15
import QtQuick.Controls 1.4TextField {id: secondText// 内部明确size, 便于预览效果,   实际size在调用处再次设置width: 200font.pixelSize: 20horizontalAlignment: Qt.AlignHCenterverticalAlignment: Qt.AlignVCenter
}

二、信号传递

1、on<Property>Changed

属性传递分为组件默认属性 和 自定义属性

实例

在这里插入图片描述

代码

//  父界面
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.4ColumnLayout {anchors.fill: parentSecondPane {Layout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 4)onHeightChanged: { text = "onHeightChanged: " + height }}SecondPane {Layout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 4)onAreaChanged: { text = "onAreaChanged: " + area }}
}
// 子界面
import QtQuick 2.15
import QtQuick.Controls 1.4TextField {id: secondTextproperty int area: width * height   // 自定义属性// 内部明确size, 便于预览效果,   实际size在调用处再次设置width: 200height: 80font.pixelSize: 20horizontalAlignment: Qt.AlignHCenterverticalAlignment: Qt.AlignVCenter
}

2、on<Signal>

分为组件默认属性 和 自定义属性

实例

在这里插入图片描述

代码

// 父界面
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.4ColumnLayout {anchors.fill: parentRectangle {id: rootRecLayout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 4)color: "gray"opacity: 0.5Text {id: rootRecSizetext: rootRec.width + " * " + rootRec.heightfont.pixelSize: 22anchors.centerIn: parent}MouseArea {anchors.fill: parentonWheel: {rootRecSize.text = "default signal"}}}SecondPane {id: pane01Layout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 4)onClick: {pane01.text = "自定义信号, 不含参数"}}SecondPane {id: pane02Layout.fillWidth: trueLayout.preferredHeight: Math.round(parent.height / 4)onSigValue: {pane02.text = "自定义信号, 含参数: " + loX + "*" + loY}}
}
// 子界面
import QtQuick 2.15
import QtQuick.Controls 1.4TextField {id: secondText// 自定义信号signal click()signal sigValue(int loX, int loY)width: 200height: 80font.pixelSize: 20horizontalAlignment: Qt.AlignHCenterverticalAlignment: Qt.AlignVCenterMouseArea {anchors.fill: parentonClicked:  {secondText.click()secondText.sigValue(mouseX, mouseY)}}
}

3、条件信号传递 connect

上述 on<Property>Changed 和 on<Signal> 都是属于无条件的信号传递。响应信号的代码都放在元素内部,通过JS代码块就地实现。
如果需要在某些条件下才建立信号机制,则使用connect。

实例

点击”start“按钮之前,任何信号都不会出发
点击之后, 开始建立信号机制
在这里插入图片描述

代码

import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.4ColumnLayout {anchors.fill: parentRectangle {id: rootRecLayout.fillWidth: trueLayout.preferredHeight: 50color: "green"opacity: 0.5Text {id: rootRecSizetext: "start"font.pixelSize: 22anchors.centerIn: parent}MouseArea {id: mouseAreaanchors.fill: parentonClicked: {rootRec.opacity = 0.2// 开始建立信号连接机制pane01.click.connect(slotNone)              // 无参数信号pane02.sigValue.connect(slotPara)           // 有参数信号pane03.heightChanged.connect(slotProperty)  // 属性信号}}}SecondPane {id: pane01Layout.alignment: Qt.AlignHCenter}SecondPane {id: pane02Layout.alignment: Qt.AlignHCenter}SecondPane {id: pane03Layout.alignment: Qt.AlignHCenterLayout.preferredHeight: parent.height / 4}function slotNone(){pane01.text = "slotNone"}function slotPara(a){pane02.text = "slotPara: " + a}function slotProperty(){pane03.text = "slotProperty" + pane03.height}
}
import QtQuick 2.15
import QtQuick.Controls 1.4TextField {id: secondTextproperty int area: width * heightsignal click()signal sigValue(int loX)// 内部明确size, 便于预览效果,   实际size在调用处再次设置width: 200height: 60font.pixelSize: 20horizontalAlignment: Qt.AlignHCenterverticalAlignment: Qt.AlignVCenterMouseArea {anchors.fill: parentonClicked:  {secondText.click()secondText.sigValue(mouseX)}}
}

4、Connections

Connections的优点主要有以下3个:

  • List item
  • 将多个对象连接到同一个QML信号上
  • 在发出信号的对象的作用域之外来建立连接 (条件信号传递)
    发射信号的对象是C++

前两条,connect具有同样的效果。

MouseArea {id: area
}Connections {target: areafunction onClicked(mouse) { foo(mouse) }
}
http://www.tj-hxxt.cn/news/31467.html

相关文章:

  • 万网做网站怎么样高端网站建设制作
  • 企业网站域名备案流程简阳seo排名优化培训
  • 摄影素材库网站哪里可以建网站
  • 上海阔达网站建设公司深圳网站设计知名乐云seo
  • 历史上的今天 网站如何做2345网址大全
  • 英文 科技网站seo外包 靠谱
  • wordpress锚点插件肇庆seo按天收费
  • 上海网站建设哪家企业北京seo供应商
  • 云南网站建设方案网络整合营销理论
  • 网站建设功能模块图谷歌海外推广
  • 个人商城网站备案站长工具seo综合查询源码
  • 小网站备案域名查询网站入口
  • cms网站开发涉及的知识seo整站怎么优化
  • 湖北搜索引擎优化网站seo优化软件
  • 镇江个人网站建设360推广开户
  • 工业互联网平台应用seo的作用有哪些
  • 网站建设运营期末考试快速网站推广公司
  • 路由器做php网站电商培训有用吗
  • 网站301做排名厦门网络关键词排名
  • 自己做网站 需要会什么6制作app平台需要多少钱
  • 北京seo网站太原seo排名收费
  • 网站底部备案号免费推广网站有哪些
  • 网站建设与推广是什么朝阳seo
  • 什么是模板网站全国疫情又严重了
  • 手机怎么制作图片搜索引擎优化的英语简称
  • wordpress 页面生成器网站seo李守洪排名大师
  • 壁纸公司网站源码seo概念
  • 哪个网站的课件做的好处seo网站优化培训厂家报价
  • 南通公司快速建站帮人推广的平台
  • 微信如何绑定网站阿里云万网域名注册