如何在使用 BorderImage 时设置红色边框

How to set a red outline border while using BorderImage

我正在使用 BorderImage to display images on a GridView

以下是我正在做的事情:

BorderImage {
  source: some_image
  asynchronous: true
  cache: false
}

我想为我的图片设置红色边框我该怎么做

我查看了 Border.leftBorder.right 属性,但它们只是拉伸图像。

您将 Rectangle 添加到您的 (Border)Image

BorderImage {
    source: some_image

    Rectangle {
        anchors.fill: parent
        anchors.margins: -border.width
        z: -1
        border.width: 4
        color: 'red'
    }
}