Windows indicator: print output when ran in console

This commit is contained in:
Albert Vaca Cintora 2023-06-12 15:30:30 +02:00
parent a6639a7f88
commit 6396fc8e5a

View file

@ -9,6 +9,10 @@
#include <QProcess>
#include <QThread>
#ifdef Q_OS_WIN
#include <Windows.h>
#endif
#ifdef QSYSTRAY
#include <QSystemTrayIcon>
#else
@ -32,6 +36,14 @@
int main(int argc, char **argv)
{
#ifdef Q_OS_WIN
// If ran from a console, redirect the output there
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
#endif
QIcon::setFallbackThemeName(QStringLiteral("breeze"));
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);