Qt5 - 图形特效

来源:互联网 发布:c语言函数调用 编辑:程序博客网 时间:2024/05/19 00:37
Qt5 - 图形特效
 
安装QtGraphicalEffects 插件:
git clone git@gitorious.org:qt-labs/qtgraphicaleffects.git
cd qtgraphicaleffects
qmake && nmake && nmake install
 
字体发光 (Glow Text):
.qml

import QtQuick 2.0import QtGraphicalEffects 1.0Rectangle {    width: 640    height: 480    color: "black"    Text  {        id: xd        anchors.centerIn: parent        text: qsTr("\u6211\u662f\u4e2d\u6587Hello Qt")        color: "red"        font.pixelSize: 80    }    Glow {        id: effect        anchors.fill: xd        color: "#FFFFFFFF"//        spread: 0.8        radius: 10        NumberAnimation on spread {            from: 0; to: 0.8; duration: 1000            loops: NumberAnimation.Infinite            easing.type: Easing.InOutQuad        }        // Worse//        NumberAnimation on radius {//            from: 1.0; to: 10; duration: 1000;//            loops: NumberAnimation.Infinite//            easing.type: Easing.InOutQuad//        }        samples: 20        visible: true        source: xd    }    MouseArea {        anchors.fill: parent        onClicked: {            Qt.quit();        }    }}


 
参考:
http://labs.qt.nokia.com/2012/02/02/qt-graphical-effects-in-qt-labs/
原创粉丝点击