Add Icon (CMake)#
We first need to prepare our
.ico file :
.pngwith a size of 64x64
Download and install ImageMagick’s convert tool
From a command prompt, run
magick convert nameofpng.png nameoficon.ico
You now have your icon file.
Create a file
appicon.rcwith the following line inside :
IDI_ICON1 ICON DISCARDABLE "path/to/icon/icon.ico"
CMakescript and, under
Your program should now create your .exe with your icon packed !
If you want to have a simple, well-formatted, automatic file location, timestamp’ed logger, the following repo contains two files that can be included in your Qt project (they are standalones files).
To use it, call
installFormattedColorOutput(bool usecolor); at the beginning of your main.
Enabling it will also modify the behavior of
qDebug(), qInfo() ... while adding a (colored) header stating the current debug level.
Afterward, simply use one of the provided macro to log your messages with information in which file and on which line the statement is located :
FDEBUG("Debug msg"); FINFO("Info msg"); FWARN("Warn msg"); FCRITICAL("Critical msg"); FFATAL("Fatal msg"); FLN(); // for simple line return without debug data
Standard Qt functions like
qDebug() can still be used. They will have the log level as header.