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

网盘 商业网站建设案例课程 下载网页设计制作作品

网盘 商业网站建设案例课程 下载,网页设计制作作品,精细化工网站建设,网站安全狗服务名最近在学习QT,也初探到qml 做ui 的灵活性与强大,于是手痒痒,做个demo 记录下学习成果 主要内容是如何自己编写一个按钮以及qml多窗口。 参考WX桌面版,做一个登录界面,这里面按钮是写的一个组合控件,有 按…

最近在学习QT,也初探到qml 做ui 的灵活性与强大,于是手痒痒,做个demo 记录下学习成果

主要内容是如何自己编写一个按钮以及qml多窗口。

参考WX桌面版,做一个登录界面,这里面按钮是写的一个组合控件,有 按下,释放,以及正常 三种状态。

import QtQuick 2.0
import QtQuick.Controls 2.4Rectangle
{id:rootwidth:400height:50radius:6property alias text:rect_text.textproperty alias tip_text:btn_tip.textstate: rect_mouse.pressed ? "pressed" : (rect_mouse.containsMouse ? "hovered" : "normal")//使用方可以处理这个信号来相应按钮点击signal btnclickedText{id:rect_textfont.pointSize: 16font.bold: truecolor:"#ffffff"anchors.horizontalCenter:parent.horizontalCenteranchors.verticalCenter: parent.verticalCenteranchors.verticalCenterOffset: 0}ToolTip{id:btn_tipfont.pointSize: 14delay: 500timeout: 2000x:parent.width/2y:parent.height}states: [State {name: "pressed"PropertyChanges { target: root; color: "#01968c" }},State {name: "normal"PropertyChanges { target: root; color: "#00beac" }},State {name: "hovered"PropertyChanges { target: root; color: "#20c9b3" }}]MouseArea{id:rect_mouseanchors.fill: parenthoverEnabled: true //是否处理悬浮事件,默认false,只有按下鼠标键时才处理鼠标事件,为true时即使没有按下鼠标键也会作相应的处理preventStealing:true//默认为false,为true时可以防止当前鼠标事件被其它对象拦截。propagateComposedEvents:true//默认为 false,当设置为 true 时,就可以将事件传递给重叠的其他鼠标区域了enabled: truecursorShape: Qt.PointingHandCursoronPressed:{rect_text.anchors.verticalCenterOffset = 2state = "pressed"}onEntered:{if(btn_tip.text != ""){btn_tip.x = mouseXbtn_tip.y = mouseYbtn_tip.open()console.log(btn_tip.x,btn_tip.y)}state = "hovered"}onReleased:{if(rect_mouse.containsMouse)//鼠标在按钮范围才有效root.btnclicked()rect_text.anchors.verticalCenterOffset = 0state = "hovered"}onExited://鼠标离开时关闭{btn_tip.close()state = "normal"}
//        onClicked: {
//            //btnclicked()
//        }}
}

然后在新增一个ChatDlg.qml文件,里面写一个window 当作是登陆后的主界面

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.9Window {id: chatWindowvisible: truewidth: 800height: 600minimumWidth: 250minimumHeight: 150maximumWidth: 1000maximumHeight: 600color: "white"title: qsTr("聊天窗口")Row{id: layoutRanchors.centerIn: parentspacing: 5 //行或列的像素间隔Column {ListView {id: chatGroupwidth: 180height: 500//anchors.verticalCenter:   parent.verticalCentermodel: ["聊天1","聊天2","聊天3","聊天4","聊天5","聊天6","聊天7","聊天8","聊天9","聊天10","聊天11"]spacing: 2delegate: MyIconButton {btn_txt: modelData}}}Column {id: layoutC//anchors.centerIn: parentspacing: 5 //行或列的像素间隔Image {id: m_Logowidth: 600height: 250anchors.left: chatGroup.rightfillMode: Image.PreserveAspectFit   //保持宽高比source: "/new/img/048.jpg.emoji.jpg"//anchors.verticalCenter:   parent.verticalCenter}Rectangle {width: 600height: 250color: "lightgrey"border.color: "grey"TextEdit {id: m_Inputwidth: 600height: 250//color: "#20c9b3"//anchors.top: m_Logo.bottom//anchors.horizontalCenter:   parent.horizontalCenter//anchors.verticalCenter:   parent.verticalCenter//anchors.left: chatGroup.right//anchors.leftMargin: 5}}//登录按钮MyButton {id: btnSendwidth: 168height: 36text: "发送"//tip_text: ""enabled: trueonBtnclicked: {//showAni.start()}}}}}

登录窗口设计如下:

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.4Window {id: mainWindvisible: truewidth: 300height: 500minimumWidth: 250minimumHeight: 150maximumWidth: 1000maximumHeight: 600color: "white"title: qsTr("WX")//头像Image {id: m_LogosourceSize.height: 100sourceSize.width: 100fillMode: Image.PreserveAspectFit   //保持宽高比source: "/new/img/048.jpg.emoji.jpg"anchors.horizontalCenter: parent.horizontalCentery: parent.height/6}Text {id: nametext: qsTr("小熊猫")anchors.horizontalCenter: parent.horizontalCenteranchors.top: m_Logo.bottomanchors.topMargin: 20}//登录后弹出聊天主界面ChatDlg {id: chatDialogvisible: false}//登录按钮MyButton {id: btn1width: 168height: 36text: "登录"tip_text: "Login your account"anchors.horizontalCenter: parent.horizontalCenteranchors.top: name.bottomanchors.topMargin: 50onBtnclicked: {chatDialog.visible = truemainWind.visible = false//showAni.start()}}
}

按下登录按钮后弹出主界面,隐藏登录界面

你学废了吗?

http://www.yayakq.cn/news/433392/

相关文章:

  • 网站系统建设支出分录建设明星网站的目的论文
  • 北京网站优化服务网站的功能定位
  • 怎样为企业设计网站阿里云 wordpress 安装
  • ftp上传网站之后深圳龙华建网站
  • 域名不变 网站改版写作网站5秒不写就删除
  • 百度山西网站建设和百度推广展示型网站举例
  • 新手如何建立自己网站中文网站做google广告怎么样
  • 成都网站排名提升wordpress更改网页标题
  • 山东建设厅执业资格注册中心网站一个网站 多个域名
  • 重庆手机网站建设公司开发app的费用
  • 免费一级域名网站计算机专业培训机构有哪些
  • 企业门户网站建设情况旅游网站论文
  • 设计排版优秀网站在什么网站可以接国外的模具做
  • 微网站 .net网站推广找
  • 公司注册网站需要什么资料网站手机页面如何做
  • 360建站平台wordpress 评级插件
  • 企业网站的建设包括沧州seo推广
  • p2p网站开发申请网站就是做网站吗
  • 工业互联网六大应用场景泉州seo管理
  • 湖南电子科技网站建设个人网页设计作品手绘
  • 网站的布局方式有哪些成都有名的软件开发公司
  • 网站按照规模分为哪几类工业和信息化部教育与考试中心
  • 淘宝客做网站推广赚钱吗网站建设文化事业建设费
  • wordpresS追踪访问轨迹企业网站seo报价
  • 山东省建设厅网站维护电话wordpress 邀请码插件
  • 建设网站的重点与难点在于代理注册企业登记
  • 外贸网站推广怎么做全屋整装十大排名全国前十强
  • 58同城北京网站建设网站设计基本流程
  • 河北省城乡住房和城乡建设厅网站360云主机可以建设网站吗
  • 设计企业品牌网站自媒体账号注册平台