简体   繁体   English

使用C ++在我的应用程序菜单栏中创建“保存当前设置”功能

[英]Creating a “Save Current Setting” feature in the menu bar of my app using C++

I currently implemented an application with features that perform some image processing functions. 我目前实现的应用程序具有执行某些图像处理功能的功能。 Everytime I run the app, I lose my previous settings that I used for analyzing images. 每次运行该应用程序时,都会丢失用于分析图像的先前设置。 Currently, the app doesn't contain a menu bar feature. 目前,该应用程序不包含菜单栏功能。 I am hoping with the menu bar, I can save the current setting (I mean the parameters that I set) so that it would be easy for me to revert back to the original setting whenever I want. 我希望菜单栏可以保存当前设置(我指的是我设置的参数),以便我随时可以轻松恢复到原始设置。 I was thinking of implementing a "Save Current Setting" feature in my app. 我当时正在考虑在我的应用程序中实现“保存当前设置”功能。 Can some one guide me on how I would go about doing this? 有人可以指导我如何去做吗?

Note: I am working on Windows 7 OS and I wish to create the UI in QT or MFC. 注意:我正在Windows 7 OS上工作,并且希望在QT或MFC中创建UI。

EDIT (Re posting form the comment): The application takes in images and allows the tool operator to analyze them. 编辑(从评论重新发布):该应用程序将图像输入,并允许工具操作员对其进行分析。 I vary the parameters (For eg: the scroll bars for adjusting the window sizes for the filters, radio buttons, check boxes, list boxes etc) in the app. 我在应用程序中更改参数(例如:用于调整过滤器,单选按钮,复选框,列表框等的窗口大小的滚动条)。 I get different results with different settings. 使用不同的设置会得到不同的结果。 Currently it doesn't have any menu bar feature. 当前它没有任何菜单栏功能。 I want to have a button that allows to me save the parameter setting. 我想要一个按钮,可以让我保存参数设置。 Suppose if I run the app 5 times and I find the 3 run to be better, I need to save that setting so that I can revert back to it whenever I want. 假设如果我运行该应用程序5次,但发现3次运行效果更好,我需要保存该设置,以便随时可以恢复到该设置。

Thanks 谢谢

I don't use either (Qt, MFC), but I think it's basically the same concept everywhere: 我都不使用(Qt,MFC),但我认为到处都是相同的概念:

  1. Settings 设定值

If you want to be able to store application settings, put them in a file and read the file when the app starts. 如果您希望能够存储应用程序设置,请将它们放入文件中,并在应用程序启动时读取文件。 Some systems have built-in technology for app settings (such as GSettings in Glib). 某些系统具有用于应用程序设置的内置技术(例如Glib中的GSettings)。 I'm sure Qt has some interface for settings. 我确定Qt有一些设置界面。 Even if not, just write them to a key file (aka INI). 即使没有,也只需将它们写入密钥文件(也称为INI)。

  1. Menu item 菜单项

I strongly suggest you do serious interface design. 我强烈建议您进行认真的界面设计。 Do it as a separate part of the project, and don't mix coding with the interface design. 将其作为项目的单独部分进行,不要将编码与界面设计混在一起。 Keep a separate list of the actions your app needs to do, and try to arrange them in buttons and menus. 单独列出您的应用需要执行的操作,然后尝试将其排列在按钮和菜单中。 You're vert welcome to use conventions used by existing apps. 欢迎使用现有应用程序使用的约定。 For example, some GNOME apps have amazingly simple and easy-t0-use interfaces (sometimes at the cost of less features, though) which you can look at. 例如,您可以查看一些GNOME应用程序具有令人惊讶的简单易用的界面(有时以较少的功能为代价)。

You can also read the Gnome Human Interface Guidelines, which is an excellent document. 您还可以阅读Gnome人机界面指南,这是一个很好的文档。

  1. Adding a menu bar 添加菜单栏

I'm sure both MFC and Qt have a Menu class. 我确定MFC和Qt都具有Menu类。 Either you create an abject and pack it into your Window class, or you create the GUI using a GUI designer, maybe KDevelop or QtDesigner (or whatever KDE uses for Qt GUI design), and design it there. 您可以创建一个对象并将其打包到Window类中,或者使用GUI设计器(可能是KDevelop或QtDesigner(或KDE用于Qt GUI设计的任何一种))创建GUI,然后在此处进行设计。

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM