diff --git a/sandbox/Others.qml b/sandbox/Others.qml index 966c1412..0f23752b 100644 --- a/sandbox/Others.qml +++ b/sandbox/Others.qml @@ -17,4 +17,8 @@ GridLayout { StatusLetterIdenticon { name: "#status" } + + StatusRoundedImage { + image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" + } } diff --git a/src/StatusQ/Components/StatusRoundedImage.qml b/src/StatusQ/Components/StatusRoundedImage.qml new file mode 100644 index 00000000..5f4d880c --- /dev/null +++ b/src/StatusQ/Components/StatusRoundedImage.qml @@ -0,0 +1,31 @@ +import QtQuick 2.13 +import QtGraphicalEffects 1.0 +import StatusQ.Core 0.1 +import StatusQ.Core.Theme 0.1 + +Rectangle { + id: statusRoundImage + property alias image: image + + implicitWidth: 40 + implicitHeight: 40 + color: "transparent" + radius: width / 2 + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + x: statusRoundImage.x; y: statusRoundImage.y + width: statusRoundImage.width + height: statusRoundImage.height + radius: statusRoundImage.radius + } + } + + Image { + id: image + sourceSize.width: parent.implicitWidth + sourceSize.height: parent.implicitHeight + fillMode: Image.PreserveAspectFit + cache: true + } +} diff --git a/src/StatusQ/Components/qmldir b/src/StatusQ/Components/qmldir index 92d661f8..705e95bc 100644 --- a/src/StatusQ/Components/qmldir +++ b/src/StatusQ/Components/qmldir @@ -2,3 +2,4 @@ module StatusQ.Components StatusLetterIdenticon 0.1 StatusLetterIdenticon.qml StatusLoadingIndicator 0.1 StatusLoadingIndicator.qml +StatusRoundedImage 0.1 StatusRoundedImage.qml