• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Kevin Cheng's Yard
电脑是我的老婆,编程是我的灵魂,代码是我的语言,按键是我在歌唱。
https://github.com/surfsky/
博客园    首页    新随笔    联系   管理    订阅  订阅

qt qml fuzzyPanel 毛玻璃效果

毛玻璃效果,用qml来写代码真是简短,大爱qml:)

【下载地址】http://download.csdn.net/detail/surfsky/8426641

【核心代码】

 1 Rectangle{
 2     clip: true
 3 
 4     // 属性
 5     property Item target  // 模糊源
 6 
 7     // 毛玻璃效果
 8     FastBlur {
 9         id: blur
10         source: parent.target
11         width: source.width;
12         height: source.height
13         radius: 64
14     }
15 
16     // 设置模糊组件的位置
17     onXChanged: setBlurPosition();
18     onYChanged: setBlurPosition();
19     Component.onCompleted: setBlurPosition();
20     function setBlurPosition(){
21         blur.x = target.x - x;
22         blur.y = target.y - y;
23     }
24 }

【调用方法】

1     FuzzyPanel{
2         id: panel
3         width: 200;
4         height: 200;
5         x: 200
6         y: 200
7         target: panelBg
8     }

【效果图】

 

转载请注明出处:http://surfsky.cnblogs.com 

posted @ 2015-02-05 17:16  surfsky  阅读(6858)  评论(1)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3