HusPopover 气泡显示框

January 28, 2026 · View on GitHub

← 返回主目录

← 返回本类别目录

HusPopover 气泡显示框

点击元素,弹出气泡式的显示框。

  • 模块 { HuskarUI.Basic }

  • 继承自 { HusPopup }


支持的代理:

  • arrowDelegate: Component 箭头代理

  • iconDelegate: Component 图标代理

  • titleDelegate: Component 标题代理

  • descriptionDelegate: Component 描述代理

  • contentDelegate: Component 内容代理

  • bgDelegate: Component 背景代理

  • footerDelegate: Component 页脚代理


支持的属性:

属性名类型默认值描述
animationEnabledboolHusTheme.animationEnabled是否开启动画
iconSourceint丨stringHusIcon.ExclamationCircleFilled丨''图标源(来自 HusIcon)或图标链接
iconSizeint16图标大小
titlestring''标题文本
descriptionstring''描述文本
showArrowbooltrue是否显示箭头
arrowWidthint16箭头宽度
arrowHeightint8箭头高度
colorIconcolor-图标颜色
colorTitlecolor-标题文本颜色
colorDescriptioncolor-描述文本颜色
titleFontfont-标题文本字体
descriptionFontfont-描述文本字体

注意 需要显示给出弹出宽度,高度将根据内容自动计算


代码演示

示例 1 - 基本

最简单的用法,支持标题和描述。

通过 title 属性设置标题文本。

通过 description 属性设置描述文本。

import QtQuick
import HuskarUI.Basic

Row {
    spacing: 10

    HusButton {
        text: 'Hover'
        type: HusButton.Type_Outlined

        HusPopover {
            x: (parent.width - width) * 0.5
            y: parent.height + 6
            width: 300
            visible: parent.hovered || parent.down
            closePolicy: HusPopover.NoAutoClose
            title: 'Hover details'
            description: 'What are you doing here?'
        }
    }

    HusButton {
        text: 'Click'
        type: HusButton.Type_Outlined
        onClicked: popover.open();

        HusPopover {
            id: popover
            x: (parent.width - width) * 0.5
            y: parent.height + 6
            width: 300
            title: 'Click details'
            description: 'What are you doing here?'
        }
    }
}