简体   繁体   English

qml 中弹出的形状

[英]Shape for popup in qml

I want to create a popup as the root element and the shape of the popup is shown in the image(ie small triangle shape)我想创建一个弹出窗口作为根元素,弹出窗口的形状显示在图像中(即小三角形)

带有小三角形形状的弹出窗口,即指示作为放置目标的项目的方向

Do qml have any property where i can define this shape (if yes then how). qml 是否具有我可以定义此形状的任何属性(如果是,那么如何定义)。 If no then what is the best way to customize the shape of the popup.如果没有,那么自定义弹出窗口形状的最佳方法是什么。 Also is it possible to use delegate and model property for popup (if yes then how)?是否可以使用委托和 model 属性进行弹出(如果是,那么如何)?

You can give a Popup a background:您可以给Popup一个背景:

Popup {
    background: Canvas {
        onPaint: {
            var ctx = getContext("2d")
            ctx.fillStyle = "white"
            ctx.beginPath()
            ctx.moveTo(0,10)
            ctx.lineTo(width * 0,5 - 10, 10)
            ctx.lineTo(width * 0,5, 0)
            ctx.lineTo(width * 0,5 + 10, 10)
            ctx.lineTo(width, 10)
            ctx.lineTo(width, height)
            ctx.lineTo(0, height)
            ctx.closePath()
            ctx.fill()
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM