Setting application info in a Qt executable file on Windows

Here’s how I do it… add a file called resources.rc to your project with the contents: IDI_ICON1 ICON DISCARDABLE “res/app.ico” #include <windows.h> #include “version.h” VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION BEGIN BLOCK “StringFileInfo” BEGIN BLOCK “040904E4” BEGIN VALUE “CompanyName”, VER_COMPANYNAME_STR VALUE “FileDescription”, VER_FILEDESCRIPTION_STR VALUE “FileVersion”, VER_FILEVERSION_STR VALUE “InternalName”, VER_INTERNALNAME_STR VALUE “LegalCopyright”, VER_LEGALCOPYRIGHT_STR VALUE “LegalTrademarks1”, VER_LEGALTRADEMARKS1_STR … Read more

Serialization with Qt

QDataStream handles a variety of C++ and Qt data types. The complete list is available at We can also add support for our own custom types by overloading the << and >> operators. Here’s the definition of a custom data type that can be used with QDataStream: class Painting { public: Painting() { myYear … Read more

How to “Reveal in Finder” or “Show in Explorer” with Qt

Qt Creator (source) has this functionality, it’s trivial to copy it: void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) { const QFileInfo fileInfo(pathIn); // Mac, Windows support folder or file. if (HostOsInfo::isWindowsHost()) { const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String(“explorer.exe”)); if (explorer.isEmpty()) { QMessageBox::warning(parent, QApplication::translate(“Core::Internal”, “Launching Windows Explorer Failed”), QApplication::translate(“Core::Internal”, “Could not find explorer.exe in path to launch Windows … Read more

Console output in a Qt GUI app?

Windows does not really support dual mode applications. To see console output you need to create a console application CONFIG += console However, if you double click on the program to start the GUI mode version then you will get a console window appearing, which is probably not what you want. To prevent the console … Read more

How do I compile a PyQt script (.py) to a single standalone executable file for windows (.exe) and/or linux?

if you want completelly create one stand alone executable, you can try PyInstaller . i feel it’s better to create one stand alone executable than cx_freeze or py2exe (in my experience). and easy to use (full documentation available in the site). It supports Python 3.6 or newer. Pass the –onefile argument if you want to … Read more