This repository contains a simple example application built using Qt 6. Its main purpose is to showcase the capabilities of the QtWidgets framework, focusing on the GUI designer, translations, resource management, and dedicated application settings storage handling.
This example is NOT a set of best practices or examples of UI design guidelines!
- Qt 6 Official Documentation
- QtWidgets Module Overview
- Qt Resource System
- Qt Linguist and Translations
To start with this example, make sure you have Qt installed on your system. Once Qt is installed, follow these steps:
- Open the
CMakeLists.txt
file, either in Qt Creator or any other preferred IDE that supports CMake. - Configure and compile the project using your chosen IDE's build process.
- After compilation, you should be able to run the application to see the QtWidgets features in action.
For more details on compiling with CMake, you can refer to the CMake Documentation.
The following steps, including project confirmations, can be applied to Qt 6.7 and newer. Older versions can require CMake file modifications!
Qt library supports a multilanguage environment by applying a set of configurations and using two external tools: lupdate and lrelease.
The steps necessary to develop multilanguage application are:
- Modify the
CMakeLists.txt
- Generate translation files by calling lupdate (or enable corresponding build steps in the configuration of your IDE)
- Translate the string by using QLinquist app or by any text editor
- Compile your application
- Implement business logic to switch languages
//mainwindow.h
QTranslator translator;
//mainwindow.cpp
if (translator.load(":/i18n/SimpleTaxCalc_en.qm"))
QCoreApplication::installTranslator(&translator);
ui->retranslateUi(this);