【发布时间】:2017-01-16 21:45:07
【问题描述】:
我正在使用 Qt 5.7 和 QtQuick.Controls 2.0。我想让我的ComboBox 默认打开。为此,我只需将popup.visible 设置为true,但不幸的是,我在控制台中收到以下错误:QML Popup: cannot find any window to open popup in.。单击我的 ComboBox 打开和关闭它就好了,没有任何错误消息。我什至尝试做Component.onCompleted: _popup.open(),其中_popup 是我的ComboBox 中我的Popup 组件的id,但出现了相同的错误消息。
编辑1(添加一个简单的例子):
ApplicationWindow {
width: 200
height: 200
Item {
anchor.fill: parent
ComboBox {
popup.visible: true
model: ["First", "Second", "Third"]
}
}
【问题讨论】: