qt - 从 Qt 中的查询中读取/回调多个 firebase 值
问题描述
我正在尝试从一个命令读取我的部分数据库的所有子项,因此我可以更新 Firebase,它会自动在我的应用程序中显示为各种标题。
我要阅读的数据库部分如下:
- 上市
- 大查询对象
- 标题1
- 标题2
- 标题3
- 标题4
- 大查询对象
我在 Qt 中工作,并尝试了使用 orderByKey、orderByChild 和 orderByValue 的不同组合,代码如下:
firebaseDb.getValue("public/bigqueryobject",{
orderByKeys: true
}, function(success, key, value) {
if(success) {
console.debug("Read user value for key", key, "fromFBDB: ", value);
myArray.push(value); combobox.model = myArray
}
})
执行上述操作时,我的日志状态:
“从 FBDB 读取 key bigqueryobject 的用户值:[object Object]
读取 keybigqueryobject 的值 [object Object]”
但是没有显示任何响应,这可能是什么问题?!?
解决方案
因此,在之前尝试将读取值推送到数组以添加到我的组合框之后,我只获得了一个下拉选项,其中所有读取值都在一行中;只需删除数组即可完美运行,代码如下!
onFirebaseReady: {
firebaseDb.getValue("locationsDepartments/locations", {
orderByValue: true
}, function(success, key, value) {
if(success) {
combobox.model = value
}
})
}
Quick2.ComboBox {
id: combobox
model: []
delegate: Quick2.ItemDelegate {
width: combobox.width
height: combobox.height
contentItem: AppText {
text: modelData
}
highlighted: combobox.highlightedIndex == index
}
contentItem: AppText {
width: combobox.width - combobox.indicator.width - combobox2.spacing
text: combobox.displayText
wrapMode: Text.NoWrap
}
}
推荐阅读
- python - 使用 scipy 的 gaussian_kde 和 sklearn 的 KernelDensity 进行核密度估计会导致不同的结果
- powerapps - PowerApps 日期函数
- python - 如何在 python 的单独模块中使用全局变量?
- sql-server - 绕过 Vertica 错误 3326:执行时间超过 01:00 的运行时间上限?
- javascript - 基于 HTMLElement 上的属性覆盖
- hibernate - 使用 Protobuf 定义类作为 Hibernte 实体类:org.hibernate.MappingException
- python - 如何将具有不同 0 值的字符串转换为从 1 到 4 的单个值(n° 的值不为零)
- twisted - twisted:使用 uniq Perspective Broker TCP 连接进行多次登录
- usrp - 为什么 multi_usrp 不支持多个 B210 无线电?
- c - 遇到断点时如何在劳特巴赫中保存堆栈帧