开发者

Need GUI for my Project which has code written in C++ (GNU) and involves hash_map data structures

I am currently working in a project where i have perform some operations in data structure (hash_map/unordered_map) and display the time taken for performing those operations and in the end i have show a summary of all the time taken to perform different operations. I have written my code in GNU C++ in linux and i am able to show the above requirements in the terminal(vi editor) using a Menu Driven Program.

My problem started when my manager told me to use a GUI instead of Menu in the program. How can i integrate the GUI with my existing code in GNU C++. While googling I see they give QT and GTK+ as an option to create GUI in C++ but my problem is i have my code already written in C++ (GNU) and i include some s开发者_Go百科pecific headers (#include "hash_map" / #include "unordered_map") in my program.

So what should be my approach. Please help cause i am not being able to move forward in my project..


Qt is a great option to easily create GUIs with the C++ language

Your general process is going to be

1. Build your data structure operations into a shared or static library.

  • You can use QMake to do this (which should be included when you install QT Creator, the IDE for QT) or by modifying the existing way you build
  • Depending on how you have structured your code this may be a hard or easy task. Hopefully your main is delegating most of the work to other classes. (If it isn't you'll get to be familiar with an activity called "refactoring")

2. Link to the library and call it from your existing menu driven interface

  • If things work correctly, congratulations continue to creating a UI
  • If things don't behave the same, see previous comment about refactoring

3. Create a UI with QT Creator. Link to the library and call from the UI

  • Add functionality until it satisfies the requirements.
  • Do your future peers a favor and look into something called the model-view-controller design pattern and how it applies to UIs. A little organization is going to make your work less likely to be thrown away in the future.

References

  • http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
  • http://doc.qt.nokia.com/4.7/qmake-project-files.html
  • http://doc.qt.nokia.com/4.7/tutorials.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜