I am coding a simple text editor with several basic features. Currently it has a QMainWindow with QTabWidget set to centralWidget . Now I am implementing a few shortcuts; ctrl+s to save, ctrl+o to open and ctrl+t/ctrl+w to create a new tab / close the current tab.
I know how to implement all the functions, but the question is: where to implement the functions? Should all shortcuts be members of QMainWindow and let it take care of everything, or should I try to highlight shortcuts in my matching classes? For example, creating a new tab ( ctrl+t ) will be part of QTabWidget . Now what about ctrl+s (save, duh) if it will be part of QTextEdit , as this is the text I save, or ...?
Basically my program contains three classes; QMainWindow , which contains a QTabWidget , and each tab is a QTextEdit .
source share