【问题标题】:QML BusyIndicator how to overlay the current window, like ProgressDialog in AndroidQML BusyIndi​​cator 如何覆盖当前窗口,如 Android 中的 ProgressDialog
【发布时间】:2021-09-23 19:45:58
【问题描述】:

当用户登录或在页面中加载数据或类似的东西时,我正在使用 QML Busyindicator,我希望能够使 busyindicator 覆盖当前窗口并使窗口不可编辑,类似于消息框时它会显示并禁用所有窗口,因此在加载完成之前我无法与此窗口上的小部件进行交互,类似于 Android 中的 ProgressDialog。

这是我的代码和我尝试做的事情,我也尝试使用 MessageDialog 并在其中使用此指示器并删除所有按钮,但它不起作用。

Popup {
    id: waitpop
    width: 100
    height: 100
    BusyIndicator {
        id: login_progress
        running: true
        anchors.fill: parent
    }
    anchors.centerIn: Overlay.overlay
    closePolicy: Popup.NoAutoClose
}

这段代码显示了忙碌指示器,但用户仍然可以与按钮和文本字段以及所有内容进行交互,有什么想法吗?

【问题讨论】:

  • 您是否尝试将弹出窗口的modal 属性设置为true
  • 非常感谢它的工作。
  • 能否请您添加它作为选择它的答案,谢谢。

标签: qt qml qt5 qtquick2


【解决方案1】:

modal 属性可防止您在弹出窗口之外单击。

Popup {
    anchors.centerIn: Overlay.overlay
    closePolicy: Popup.NoAutoClose
    modal: true

    BusyIndicator {
        running: true
    }
}

【讨论】:

    猜你喜欢
    • 2011-11-16
    • 1970-01-01
    • 2011-10-06
    • 1970-01-01
    • 2021-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-07
    相关资源
    最近更新 更多