完善标题栏的搜索框,效果如下:

搜索栏:自定义组合控件

    //搜索Rectangle{id:searchTextEditanchors{left:titleLabel.rightleftMargin: 20*dptop:parent.toptopMargin: 12*dpbottom: parent.bottombottomMargin: 12*dp}color: "#a82828"radius: 20width: 300Controls_1_4.TextField{id:textEditanchors.fill: parentanchors.leftMargin: 7*dpanchors.rightMargin: 10*dp//text: "123123123"verticalAlignment: Text.AlignVCenterfont.pixelSize: 14textColor: "#C77373"placeholderText: qsTr("搜索音乐,歌手,歌词,用户");style: TextFieldStyle{placeholderTextColor: "#C77373";background: Rectangle{color: "#a82828";}}Keys.enabled: true;Keys.onReturnPressed: {searchBtn.btnClicked();}onActiveFocusChanged: {if(activeFocus){if(text.length===0){searchDlg.open();icon_SearchRect.visible = true;console.log("open")}}else{searchDlg.close();icon_SearchRect.visible = false;console.log("close")}}//            onTextChanged: {
//                    if(text.length>0){
//                        searchDlg.close();
//                        console.log("close")
//                    }
//                    else{
//                        searchDlg.open();
//                        console.log("open")
//                    }
//            }Label{id:icon_SearchRectvisible: falseanchors{top:parent.bottomleft: parent.leftleftMargin: 12*dp}height: 12*dpwidth: heightcolor: "#ffffff"text: "\uf0d8";font.family: icomoonFont.namefont.pixelSize: 16*dp;}}Label{font.family: icomoonFont.namefont.pixelSize: 18;verticalAlignment:Label.AlignVCenter;horizontalAlignment: Label.AlignHCenter;color: "#C77373"text:"\uf002"anchors.right: searchTextEdit.rightanchors.left: textEdit.rightanchors.rightMargin: 15*dpanchors.bottom: searchTextEdit.bottomanchors.top: searchTextEdit.top}Popup{topMargin: titleBar.height+1*dp;id:searchDlg;//visible: false;width: searchTextEdit.width*1.5;height: 300*dpbackground: Loader{source: "qrc:/FramelessWindow/SearchRect.qml";}onClosed: textEdit.focus=false;}Component.onCompleted:{searchDlg.close();}}

弹出框:

import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3Rectangle {id: rectangle1property color backgroug: "#fafafa"color: "#ffffff"radius: 5border.color: "#f0f0f0"border.width: 3anchors.fill: parentRectangle {id: rectangleheight: 33color: "#ffffff"border.width: 1border.color: "#f0f0f0"anchors.right: parent.horizontalCenteranchors.rightMargin: 0anchors.left: parent.leftanchors.leftMargin: 2anchors.top: parent.topanchors.topMargin: 2Label {id: hotSearchwidth: heightcolor: "#e1e1e1"verticalAlignment: Text.AlignVCenterhorizontalAlignment: Text.AlignHCenteranchors.left: parent.leftanchors.leftMargin: 1anchors.bottom: parent.bottomanchors.bottomMargin: 0anchors.top: parent.topanchors.topMargin: 1font{family: icomoonFont.name;pixelSize: 12*dp;}text: "\uf002"}Label {id: hotSearch1color: "#c1c1c1"anchors.right: parent.rightanchors.rightMargin: 0anchors.left: hotSearch.rightanchors.leftMargin: 0anchors.bottom: parent.bottomanchors.bottomMargin: 0anchors.top: parent.topanchors.topMargin: 1verticalAlignment: Text.AlignVCenterfont{family: "Microsoft YaHei";pixelSize: 12*dp;}text: qsTr("热门搜索")}}Rectangle {id: rectangle2color: "#ffffff"border.color: "#f0f0f0"anchors.bottom: rectangle.bottomanchors.bottomMargin: 0anchors.left: parent.horizontalCenteranchors.leftMargin: 0anchors.right: parent.rightanchors.rightMargin: 3anchors.top: parent.topanchors.topMargin: 2Label {id: historySearchwidth: heightcolor: "#e1e1e1"verticalAlignment: Text.AlignVCenterhorizontalAlignment: Text.AlignHCenteranchors.left: parent.leftanchors.leftMargin: 0anchors.bottom: parent.bottomanchors.bottomMargin: 0anchors.top: parent.topanchors.topMargin: 1font{family: regularIcomoonFont.name;pixelSize: 12*dp;}text: "\uf017"}Label {id: historySearch1color: "#c1c1c1"anchors.left: historySearch.rightanchors.leftMargin: 0anchors.right: parent.rightanchors.rightMargin: 2anchors.bottom: parent.bottomanchors.bottomMargin: 0anchors.top: parent.topanchors.topMargin: 1verticalAlignment: Text.AlignVCenterfont{family: "Microsoft YaHei";pixelSize: 12*dp;}text: qsTr("搜索历史")}}Rectangle {id:listViewcolor: "#ffffff"border.color: "#f0f0f0"anchors.right: parent.horizontalCenteranchors.rightMargin: 0anchors.top: rectangle.bottomanchors.topMargin: 0anchors.bottom: parent.bottomanchors.bottomMargin: 1anchors.left: parent.leftanchors.leftMargin: 1ListView{id:hotSearchTextViewanchors.fill: parentmodel:hotSearchTextListdelegate:hotSearchTextViewDelegate}ListModel{id:hotSearchTextListListElement { text_: qsTr("李志") }ListElement { text_: qsTr("没有理由") }ListElement { text_: qsTr("林宥嘉") }ListElement { text_: qsTr("侧田") }ListElement { text_: qsTr("周杰伦") }}Component{id:hotSearchTextViewDelegateButton{height: 30*dpwidth: parent.widthbackground: Rectangle{color: hovered ? "#f0f0f0":"#ffffff"}Label{anchors.fill: parentanchors.leftMargin: 20*dptext: text_font.family: "Microsoft YaHei";font.pixelSize: 12*dpverticalAlignment: Label.AlignVCenter}}}}Rectangle {border.color: "#f0f0f0"anchors.left: listView.rightanchors.leftMargin: 0anchors.right: parent.rightanchors.rightMargin: 1anchors.bottom: parent.bottomanchors.bottomMargin: 1anchors.top: rectangle2.bottomanchors.topMargin: 0}}

qml之从零开始编写网易云音乐目录

qml之从零开始编写网易云音乐(二)相关推荐

  1. 网易云音乐二维码登录官方版

    二维码登录 官网链接(https://binaryify.github.io/NeteaseCloudMusicApi)) 下载官方API到本地,打开NeteaseCloudMusicApi文件夹,在 ...

  2. 如何将一首网易云音乐,生成一个音乐二维码?

    有人说,阿黛尔的[Someone like you]这首歌名的中文翻译是:终有弱水替沧海,再无相思寄巫山: 有人说,他家的猫听了马克西姆的[出埃及记]后,再也没有回来: 有人说,他失恋了,听火星哥的[ ...

  3. SpringBoot+vue仿网易云音乐网站(二)-数据库设计

    一.需求分析 仿网易云,那么需求的话就照着网易云音乐来做了. 首先可以听歌,可以查看歌手,歌手又有对应的专辑,有用户,用户可以新建歌单,收藏歌单,歌单可以增删歌曲,用户还可以评论歌曲.专辑.歌单,还有 ...

  4. 从零开始实现实时多人点歌机器人 (来自网易云音乐)

    偶然的机会,发现了B站的点歌机器人,觉得挺好玩的就自己做了一个简易版点歌机器人,预览如下: 功能 使用websocket,支持多人同时点歌,发送弹幕聊天 具有搜索suggestion,用户体验更佳 点 ...

  5. 基于React全家桶开发「网易云音乐PC」项目实战(二)

    前言 本篇开始做 「网易云音乐PC」项目,建议最好有以下基础react.redux.redux-thunk.react-router,上一章只是对项目进行初步介绍认识,本章节会带你完成:网易云的基本骨 ...

  6. 网易云音乐工程师,亲自揭晓评论实现技术(二)| 技术头条

    欢迎大家回到网易云音乐评论技术探秘之旅,上一篇我们介绍了云音乐评论的业务场景和基础架构,这一篇将围绕云音乐评论的核心功能:评论发表.评论获取和评论点赞进行剖析探秘. 评论发表 首先我们先看上图,这是我 ...

  7. python爬取网易云音乐_Python 从零开始爬虫(七)——实战:网易云音乐评论爬取(附加密算法)...

    前言 某宝评论区已经成功爬取了,jd的也是差不多的方法,说实话也没什么好玩的,我是看上它们分析简单,又没加密才拿来试手的.如果真的要看些有趣的评论的话,我会选择网易云音乐,里面汇聚了哲学家,小说家,s ...

  8. 自定义QListWidget实现item被hover时改变图标样式(模仿网易云音乐选项列表)(方法二)

    环境配置 :MinGW + QT 5.12 效果图: 这里需要说明一下:QListWidget是鼠标press时item就会被选中,自定义的TestListWidget类重写了mousePressEv ...

  9. 自己编写代码去听网易云音乐的歌曲,以及观看MV,还可以下载奥

    注意:本html文件不能收听或者下载试听歌曲 代码: <!DOCTYPE html> <html><head><title>听歌进行时</titl ...

最新文章

  1. RDKit | 基于RDKit的SMILES转canonical SMILES
  2. python创建数组放入矩阵_python创建数组并存入数据库
  3. vs2005 + ASP.NET 页面布局应注意问题及方法步骤
  4. 数据库菜鸟不可不看 简单SQL语句小结
  5. 【报错】TypeError: ‘int‘ object is not callable_Python系列学习笔记
  6. java将图片保存进mysql_Java存储图片到Mysql
  7. Service混合开启笔记(startService+bindService)
  8. server取出多个最小值 sql_SQL汇总查询及分组查询
  9. pytorch模型保存
  10. 删除mysql数据库_安装/删除MySQL数据库
  11. Ajax无刷新评论的PHP代码,PHP Ajax实现页面无刷新发表评论
  12. java 开发电商平台,JAVA项目实战开发电商项目案例(一)前后端项目分离
  13. Java中强、软、弱、虚引用
  14. java定时从数据库抓取数据库,java查询数据库java如何实现定时从数据库查询新增的数据?...
  15. 数据分析中的常用数学模型实战教程笔记(下)
  16. 【Practical】最小二乘与正规方程
  17. Ubuntu查看usb 设备
  18. 堆(Heap)数据结构介绍
  19. 完美解决(有图)Gitee个人空间地址更改后本地连接失败问题
  20. R语言基础学习:矩阵及矩阵的基础操作

热门文章

  1. 牛客网NOIP赛前集训营-提高组(第七场)C 洞穴
  2. LeetCode OJ平台上的Climbing Stairs题目用java迭代解决
  3. 如何取得当前插入记录的ID
  4. Java中将数组转成List
  5. 电脑显示器和电视显示器底座的拆卸方法
  6. 51单片机学习记录(五)矩阵按键
  7. 网页前端知识汇总(四)——网页前端搜索框用get或者post提交方式的区别
  8. python 动画随人脸动作变化_用Python获取摄像头并实时控制人脸的实现示例
  9. 使用 Windows Virtual PC 创建一个虚拟机
  10. 老牌系统Zencart与新型系统ueeshop的较量