Table of Contents
Weekend Project #2: Simple Qt Text Editor
The Simple Qt Text Editor is a Microsoft Notepad clone that was developed using Qt 6.5. It supports all functionality that Notepad does on Windows, Linux, and Mac OSX, including zoom, copy/paste, find/replace, changing fonts, printing, and multiple languages. The features are intended to be as barebone and as close to Notepad as possible, however a few minor enhancements have been added. The most notable departure is the find/replace functionality, however there is also support for changing line endings or UTF text format, redo functionality, command line features, and a preferences menu that allows setting the time/date output format and a few other default settings.
Extra Large file support (opening files larger than 500MB) is planned in the future, likely using a “paging” scheme. This could also be extended to support more features, including syntax highlighting or Markdown editing.
Basic App Usage
All of the menu options do the same thing their corresponding options do in Notepad, with a few minor changes. For example:
- The Time/Date menu option will output a string according to the format chosen in the Preferences dialog, rather than how the OS displays the time and date on the Taskbar. This is necessary because this app is meant to work on operating systems that are not Windows, and ensuring there was a way to get the user's time and date settings for each possible DE that can be installed on Linux is way too much work.
- The Find and Replace dialogs are integrated into a single dialog, and have a different shortcut key schema as well as different functionality. See the Find and Replace section below for more info.
- The Format and View menus seen in Notepad are integrated on this editor.
As such, it is basically like using Notepad.
Find and Replace
The Find and Replace functionality is interesting in that there are some hidden shortcut keys that allow for different searching capabilities. The Ctrl+F and Ctrl+R shortcut keys let you find the next string and replace the current string then find the next one respectively. This is good, but there's a need to allow for going backwards, as well as searching for whole words. This can be done with the variant keys, namely Ctrl+D and Ctrl+E for find and replace backwards respectively, and Ctrl+G and Ctrl+T for find and replace whole words respectively. This is a neat UI enhancement that makes it easy to find and replace text in a large text document!
Still To-Do
Here is stuff that still needs to be done:
- The end line and text format detection and modification system is completely not there. It should be relatively trivial to detect what line endings and text format are in use, but right now the UI just reports “UNIX (LF)” for line endings regardless of the text and uses UTF-8 exclusively.
- There are some right-click context menu stuff using Windows IME in Notepad I have no idea how to implement, or if I even need to.
- There should be a preferences menu, this hasn't been implemented yet, nor has user configuration been set up.
- The find and replace dialog window should remember its old location when it is closed, so it can open in the same location (trivial fix).