标题:[已解决] 怎么动态应用Glow效果
作者:yurenjimi
日期:2012-03-16 17:40
内容:
当点击Rectangle时,应用Glow 效果。
上码:
import QtQuick 2.0
import QtGraphicalEffects 1.0
Rectangle {
width: 200; height: 200
color: "black"
Text {
id: text
anchors.centerIn: parent
text: "Hello Qt!"
font.pixelSize: 30
color: "white"
}
/* 可以用,但是是静态的
Glow {
anchors.fill: text
source: text
color: "red"
radius: 10
samples: 20
visible: true
NumberAnimation on spread {
from: 0; to: 0.8; duration: 1000
loops: NumberAnimation.Infinite
easing.type: Easing.InOutQuad
}
}*/
Loader {
id: loader
focus: true
}
MouseArea {
anchors.fill: parent
onClicked: {
  ..
#1 [yurenjimi 03-19 09:59]
Anyone ?
#2 [yurenjimi 03-19 16:09]
问题出在两个方面,第一个是source, 第二个是anchors.fill。修改如下:
//anchors.fill: parent // 弃用
x: text.x; y: text.y //必须指定
width: text.width; height: text.height // 必须指定
source: text