From 6396fc8e5aaf256c87d770d00603dd55ec9bbfd8 Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Mon, 12 Jun 2023 15:30:30 +0200 Subject: [PATCH] Windows indicator: print output when ran in console --- indicator/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/indicator/main.cpp b/indicator/main.cpp index 6d2349c59..738dd0d5d 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -9,6 +9,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #ifdef QSYSTRAY #include #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);