Step by step to create new Q4OS application, Trinity desktop, developer manual, rev. 10/2021
Step-by-step to create new Q4OS C++ Application
Contents
1. Introduction
2. Install development IDE
3. Create new C++ project
4. Add your own dialog to the project
5. Design new dialogs, write C++ code
6. Let create application installer
This document describes in an easy manner, how to create new, shiny, simple, C++ application, step-by-step under the Trinity desktop environment. Preferred way to write Q4OS applications is to use TQt libraries, your code will not be Q4OS specific, but broadly multiplatform. Please read related document Q4OS Application install howto, general recommendations.
At first, you need to install Q4OS Development Pack for the Trinity desktop environment in terminal:
$ sudo apt install q4os-devpack-trinity
Now you can start "TDevelop" C++ IDE from the Start menu.
3. Create new C++ Q4OS project
From top toolbar choose second button "Generate a new project from a template". New project wizard appears.
Expand the tree, select "C++ > Q4OS > 1. New Project (Q4OS/TDE)" and fill field "Application name" as "Project1".
Click "Next" for all wizard questions, new project will be created.
Press "F8" key and confirm "Run qmake" to build this new project.
This chapter describes procedure to create new dialog the best way, using subclassing wizard. This procedure is related to the new classes, forms and source code files.
Click "TQMake Manager" toolbar on the right side, TQMake Manager panel will open.
Click to "FORMS" with right mouse button and choose "Create new file..." from context menu.
Set "ui_form2" to "File name" field and select "TQT Dialog (.ui)" from drop-down list. It's important to keep "ui_" prefix for form names to avoid conflicts during building. Confirm "OK", new "ui_form2.ui" file will be opened in TQT Designer.
Modify new form to suite your wishes, save the form and close designer.
Right mouse button click to "ui_form2.ui" on TQMake Manager panel, choose "Subclassing Wizard..." from context menu.
Fill new class name as "Form2", let file name "form2" and other boxes unmodified. Click "Create" to create source and header files of the form.
Press "F8" to build the project again. Simple two-form Q4OS Application is now created.
5. Design new dialogs, write C++ code
Now its time to write C++ code and do some programming, you will use objects, classes, signals, slots, events, actions, etc.. QT programming is not part of this document..
optional: Connect "form2" to some action, for example button click, write C++ code.
6. Let create application installer
You need to be member of "sudo" group to process installer creation, as the installer needs root permissions definitely. "Installer Builder" tool will create both "*.deb" file for manual installation with "dpkg" command and "setup_*.esh" fully automated, convenient installer. You can choose which one to use.
"Installer Builder" is a part of Q4OS Development Pack, if you are planning to build your own custom Application installer, feel free to copy and use it as a skeleton or self-explainable example.
optional: If you want to modify installer settings edit configuration file "installer.cfg" in project directory, else let this file untouched with default values.
Click main menu "Tools -> Installer Builder" to start creating setup file.
Self extracting, user comfortable application installer will be generated automatically. Answer "Yes" to "Open installer location ?" question, when process will finish.
You can now proceed test installation of your new, shiny, simple, C++, Q4OS application. Doubleclick "setup_*.esh" file to run it and keep instructions on the screen to install "Project1". Start menu entry and desktop icon of "Project1" is now created.
Upload and publish this setup file somewhere on the Internet, Q4OS users will be happy for easy setup of your application.
Step by step to create new Q4OS application, Trinity desktop, developer manual, rev. 10/2021