qml 设置tooltip,Customizing ToolTip

        Button {
            id: btn
            text: "Tip"
            anchors.horizontalCenter: parent.horizontalCenter

//            ToolTip.timeout: 5000
//            ToolTip.visible: pressed
//            ToolTip.text: "This is a tool tip."

            ToolTip {
                id: control
                visible: btn.pressed
                ToolTip.timeout: 5000
                text: qsTr("A descriptive tool tip of what the button does")

                contentItem: Text {
                    text: control.text
                    font: control.font
                    color: "#21be2b"
                }

                background: Rectangle {
                    border.color: "#21be2b"
                }
            }

        }

原文地址:https://www.cnblogs.com/zhangxuan/p/6958145.html