为我的应用程序保存用户数据第 2 部分 [英] Saving user's data for my application part 2

查看:19
本文介绍了为我的应用程序保存用户数据第 2 部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个问题是:我应该使用 dom、sax 还是 sqlite 来保存用户输入到我的应用程序中的数据.我的答案是使用 DOM.

My first question was: should I use dom, sax, or sqlite to save the data the user is inputting into my application. The answer I am going with is to use DOM.

我的第二个问题是:当用户决定打开文件时,我应该如何将文件内容加载到应用程序中?一旦用户单击文件上的打开",它是否应该遍历整个文件并将所有数据分发到 GUI 中的正确位置?还是应该只在用户点击某些区域时才打开内容?

My second question is: How should I load the contents of the file into the application when the user decides to open the file? Should it go through the whole file and distribute all the data to the correct spots in the GUI once the user clicks "open" on the file? Or should it only open the stuff up as the user clicks on certain areas?

我的第三个问题是:当事情发生变化时,qt 如何处理?我如何知道用户何时更改了某些内容并要求他们保存文件?

My third question is: How does qt handle knowing when things have changed? How would i know when the user has changed something and ask them to save the file?

如果你不明白,请告诉我,我会再次尝试解释.

If you do not understand, please let me know and I will try to explain again.

示例:

我不仅在阅读 gui 位置.而是那些内容.为了实例.用户可以创建包含编辑文本框的选项卡.和这些选项卡与项目相关联在列表中.当用户单击用户列表中的项目将呈现一整套新标签.每个标签都有一些编辑表格.该文件将需要包含列表中的内容,哪些选项卡用户已在每个项目下创建在那个列表和每个的内容与每个选项卡相关联的选项卡列表中的项目.

I am not only reading gui locations. But the contents of those. For instance. The user is able to create tabs that contain edit text boxes. And those tabs are associated with items that are in a list. When the user clicks on an item in the list the user will be presented with a whole set of new tabs. And each tab has some editing forms. The file will need to contain what is in the list, what tabs the user has created under each item in that list and the contents of each tab associated with the tab of each item in the list.

抱歉,我发布了另一个与我上一个类似的问题,但另一个问题已得到解答,现在我需要一个新帖子.

Sorry that I posted another question that is similar to my last, but the other question was answered and now I need a new post.

推荐答案

问题 2:这在很大程度上取决于您要处理的数据量.一步加载所有内容会容易得多.如果您需要复杂的文档,最好逐步进行,但我强烈建议您从更简单的方法开始.

Question 2: This very much depends on how much data you're dealing with. It will be much easier to load everything in one step. If you are expecting complex documents, it might be better to do it incrementally, but I would strongly recommend starting with the simpler approach.

问题 3:Qt 不处理这个问题,除非小部件在修改时会触发信号.你需要这样做,使用某种模型.您可以直接使用 DOM 文档作为模型,尽管抽象保存格式可能有助于可维护性.用户所做的每一次更改都会导致模型的更改.您将需要检测何时例如用户编辑一些文本,适当地更新您的模型并跟踪自上次保存以来它是否已更改.

Question 3: Qt does not handle this, except in as far as widgets will fire signals when they are modified. You need to do it, using a model of some sort. You could just use the DOM document directly as the model, although it may help maintainability to abstract the save format. Each change the user makes would cause a change in the model. You will need to detect when e.g. the user edits some text, update your model appropriately and keep track of whether it has changed since the last save.

这篇关于为我的应用程序保存用户数据第 2 部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆