码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • qml 实现csdn搜索框,无规则圆角


    效果如下

    代码

    1. import QtQuick 2.15
    2. import QtQuick.Window 2.15
    3. import QtQuick.Controls 2.15
    4. import QtQuick.Layouts 1.15
    5. import QtGraphicalEffects 1.15
    6. ApplicationWindow {
    7. width: 640
    8. height: 480
    9. visible: true
    10. title: qsTr("qml 实现csdn的搜索框,不规则圆角实现")
    11. background: Rectangle{
    12. anchors.fill: parent
    13. color:"White"
    14. }
    15. Rectangle
    16. {
    17. id:searchBar
    18. anchors.centerIn: parent
    19. width:400
    20. height: 35
    21. border.color: "#fc5531"
    22. border.width: 1
    23. radius: searchBar.height / 2
    24. TextInput {
    25. anchors.leftMargin: 20
    26. anchors.right: btn.left
    27. anchors.left: parent.left
    28. font.pointSize: 12
    29. color: "Black"
    30. y:8
    31. maximumLength: 30
    32. focus: true
    33. MouseArea {
    34. anchors.fill: parent
    35. hoverEnabled: true
    36. onEntered: {
    37. searchBar.border.color = "#fc1944"
    38. }
    39. onExited: {
    40. searchBar.border.color = "#fc5531"
    41. }
    42. }
    43. }
    44. // right button #fc1944
    45. Rectangle {
    46. id:btn
    47. width: 80
    48. height: searchBar.height
    49. anchors.right: parent.right
    50. anchors.top: parent.top
    51. color: "#fc5531"
    52. layer.enabled: true
    53. layer.effect: OpacityMask{
    54. maskSource: Rectangle{
    55. width: 80
    56. height: btn.height
    57. radius: btn.height / 2
    58. //左侧
    59. Rectangle{
    60. width: 20
    61. height: btn.height
    62. }
    63. }
    64. }
    65. Image {
    66. id: image_search
    67. width: 20
    68. height:20
    69. x:10
    70. anchors.verticalCenter: parent.verticalCenter
    71. source: "qrc:/res/img/search.png"
    72. }
    73. Text {
    74. id: searchTxt
    75. color: "White"
    76. text: qsTr("搜索")
    77. anchors.verticalCenter: parent.verticalCenter
    78. anchors.left:image_search.right
    79. anchors.leftMargin: 1
    80. font.pointSize: 12
    81. font.bold: true
    82. }
    83. MouseArea {
    84. anchors.fill: parent
    85. hoverEnabled: true
    86. onEntered: {
    87. btn.color = "#fc1944"
    88. }
    89. onExited: {
    90. btn.color = "#fc5531"
    91. }
    92. }
    93. }
    94. }
    95. }

  • 相关阅读:
    【转载】 Bytedance火山引擎智能拥塞控制算法 VICC
    面试官:我们简单聊一下kafka的一些东西吧。
    业务员如何找客户?
    k8s+crio+podman搭建集群
    Koa 快速入门
    JavaWeb—HTTP状态 405 - 方法不允许【BUG已解决】
    关于外网java后端服务访问内网minio中间件,因连接minio超时,启动失败问题
    MySQL 5.7 安装教程(全步骤、保姆级教程)
    电影院订票选座小程序|基于微信小程序的电影院购票系统设计与实现(源码+数据库+文档)
    oracle函数使用
  • 原文地址:https://blog.csdn.net/ruglcc/article/details/125424527
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号