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     }

【效果圖】

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM