The example you provided is very good and most of apps i worked on were using the similar approach.
Coming to the QApplication issue.
Inheriting from QApp should be done when you want to extend the original class's functionality. For example QApplication extends QCoreApplication to provide GUI.
Now lets suppose you app is requried to run in console mode, then you need to use QCoreApplication, which you cant because you are inheriting from QApplication.
Similarly you cannot use other Classes like QtSignleApplication (inherites from QApplication), because now you have to change your MyApp code to inherit from QtSignleApplication.
Furthurmore, you are designing you main Security class inherited from QApplication, which makes it Qt depended. All your serial generation/comparision etc should be independent of Qt to use in in any C++ as you mentioned.
I can explain why your protection in main() is easy to defeat, but i dont think they are implemented as such in your real program.
Bookmarks