Qt Firebase日历(多用户)
我目前正在Qt中构建一个多用户日历应用程序,并打算使用firebase实时数据库来处理用户数据和计划任务 每个用户都可以登录到应用程序并选择日期,一旦单击“保存”按钮,这些日期将被锁定为自己的姓名。我以前没有使用firebase的经验,希望能得到一些帮助来开始构建数据库,我希望能够将用户划分为多个部门 下面是我的应用程序日历页面的代码,我会在firebase中输入什么来连接这两个页面 任何帮助都将不胜感激Qt Firebase日历(多用户),qt,firebase,firebase-realtime-database,calendar,Qt,Firebase,Firebase Realtime Database,Calendar,我目前正在Qt中构建一个多用户日历应用程序,并打算使用firebase实时数据库来处理用户数据和计划任务 每个用户都可以登录到应用程序并选择日期,一旦单击“保存”按钮,这些日期将被锁定为自己的姓名。我以前没有使用firebase的经验,希望能得到一些帮助来开始构建数据库,我希望能够将用户划分为多个部门 下面是我的应用程序日历页面的代码,我会在firebase中输入什么来连接这两个页面 任何帮助都将不胜感激 Page { title: "Calendar" rightBarIt
Page {
title: "Calendar"
rightBarItem: NavigationBarItem {
contentWidth: saveButton.width
AppButton {
id: saveButton
text: "Save & Request"
anchors.right: parent.right
}
}
SystemPalette {
id: systemPalette
}
Flow {
id: row
anchors.fill: parent
spacing: 10
layoutDirection: "RightToLeft"
Calendar {
id: calendar
width: (parent.width > parent.height ? parent.width * 0.6 - parent.spacing : parent.width)
height: (parent.height > parent.width ? parent.height * 0.6 - parent.spacing : parent.height)
selectedDate: new Date()
focus: true
style: CalendarStyle {
dayDelegate: Item {
readonly property color sameMonthDateTextColor: "#444"
readonly property color selectedDateColor: Qt.platformos === "osx" ? "#3778d0" : systemPalette.highlight
readonly property color selectedDateTextColor: "white"
readonly property color differentMonthDateTextColor: "#bbb"
readonly property color invalidDatecolor: "#dddddd"
Rectangle {
anchors.fill: parent
border.color: "#00000000"
color: styleData.date !== undefined && styleData.selected? selectedDateColor : "#00000000"
anchors.margins: styleData.selected ? -1 : 0
}
Label {
id: dayDelegateText
text: styleData.date.getDate()
anchors.centerIn: parent
color: {
var color = invalidDatecolor;
if (styleData.valid) {
color = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor ;
if (styleData.selected) {
color = selectedDateTextColor;
}
}
color ;
}
}
}
}
}
Component {
id: eventListHeader
Row {
id: eventDateRow
width: parent.width
height: eventDayLabel.height
spacing: 10
Label {
id: eventDayLabel
text: calendar.selectedDate.getDate()
font.pointSize: 35
}
Column {
height: eventDayLabel.height
Label {
readonly property var options: { weekday: "long" }
text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat)
font.pointSize: 18
}
Label {
text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth())
+ calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy")
font.pointSize: 12
}
}
}
}
Rectangle {
width: (parent.width > parent.height ? parent.width * 0.4 - parent.spacing : parent.width)
height: (parent.height > parent.width ? parent.height * 0.4 - parent.spacing : parent.height)
ListView {
id:eventListView
spacing: 4
clip: true
header: eventListHeader
anchors.fill: parent
anchors.margins: 10
model: eventModel.eventsForDate(calendar.selectedDate)
delegate: Rectangle {
width: eventListView.width
height: eventItemColumn.height
anchors.horizontalCenter: parent.horizontalCenter
Image {
anchors.top: parent.top
anchors.topMargin: 4
width: 12
height: width
source: "qrc:/images/eventindicator.png"
}
Rectangle {
width: parent.width
height: 1
color: "#eee"
}
Column {
id: eventItemColumn
anchors.left: parent.left
anchors.leftMargin: 20
anchors.right: parent.right
height: timeLabel.height + nameLabel.height + 8
Label {
id: nameLabel
width: parent.width
wrapMode: Text.Wrap
text: modelData.name
}
Label {
id: timeLabel
width: parent.width
wrapMode: Text.Wrap
text: modelData.startDate.toLocaleTimeString(calendar.locale, Locale.ShortFormat)
color: "#aaa"
}
}
}
}
}
}
}
如果我理解正确,您还没有将Firebase集成到您的Qt项目中 您可以查看使用Firebase和Qt Quick的插件:
然后你可以听到信号并相应地更新你的日历。Hey@eyllanesc,如果我是对的,你已经在我发布的代码中画了几行,你能解释一下你这样做的原因吗,你认为在我的示例中不需要吗?Hey@eyllanesc我的笔记本电脑说编辑了620行,这就是为什么我有点困惑的原因!我一点也不反对,哈哈!我在这里向更有经验的人寻求帮助/建议,这样我得到的帮助越多越好!谢谢关于您的问题,Firebase不随Qt提供,而是没有Qt模块提供对Firebase的访问,因此,您没有将大量代码放在特定问题上,除了指示您访问哪个模块或如何访问Firebase之外,还提供了,阅读@eyllanesc我正在我的ide中使用Firebase插件,该插件允许访问Firebase身份验证和实时数据库,并且在其他地方被告知,使用我的预期应用程序使用Firebase将是最好的途径。我完全理解问题中的最小代码,以避免将问题与无效代码混淆,但在该段包含功能页面的地方,我认为它可能在这个意义上适用!