The editor of this chapter is a more advanced version of the editor of Chapter 5, Qt Graphical Applications. In this version, it is possible to change the font and alignment of the text, to mark text, and to cut and paste text.
The EditorWindow
class of this chapter is similar to the class of Chapter 5, Qt Graphical Applications. It catches the key pressing event and the window closing event.
EditorWindow.h:
#ifndef EDITORWINDOW_H #define EDITORWINDOW_H #include <QMainWindow> #include <QActionGroup> #include <QPair> #include <QMap> #include "..\MainWindow\MainWindow.h" #include "EditorWidget.h" class EditorWindow : public MainWindow { Q_OBJECT public: EditorWindow(QWidget *parentWidgetPtr = nullptr); ~EditorWindow(); protected: void keyPressEvent(QKeyEvent* eventPtr); void closeEvent(QCloseEvent* eventPtr); private...