先看一个普通组件()的阴影效果
import QtQuick 2.2
import QtGraphicalEffects 1.0
import QtQuick.Window 2.1
Window {
visible: true
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
id:testText
text: qsTr("Hello Match")
font.pixelSize: 18
anchors.centerIn: parent
}
//阴影必须在所有组件之后才会在最底层
DropShadow {
anchors.fill: testText
horizontalOffset: 5
verticalOffset: 5
radius: 2.0
samples: 16
fast: false
color: "#1d2833"
source: testText
}
}

本文记录了在Linux环境下,使用QML进行界面开发时如何为组件和程序主窗口添加阴影效果。通过代码示例展示了具体的实现方法,并指出开发测试所用的SDK版本及文件编码要求。
最低0.47元/天 解锁文章
1685

被折叠的 条评论
为什么被折叠?



