From a2a6e761a65fc35eba6f3a86fdfbcf1196ca19be Mon Sep 17 00:00:00 2001
From: Amin Bandali <amin.bandali@savoirfairelinux.com>
Date: Fri, 14 Jan 2022 16:52:22 -0500
Subject: [PATCH] misc: unset QT_STYLE_OVERRIDE

* src/main.cpp (main): unset QT_STYLE_OVERRIDE.  Some distros, like
Zorin OS, set QT_STYLE_OVERRIDE to force a particular Qt style.
This has been fine with Qt5 even when using our own Qt package
which may not have that style/theme available.  However, with Qt6,
attempting to override to a nonexistent style seems to result in the
main window simply not showing.  So here we unset this variable, also
because jami-qt currently has the Material style hard-coded anyway.
https://bugreports.qt.io/browse/QTBUG-99889

Change-Id: Ic261b46baf79cf36491578ff969b398b95363c94
---
 src/main.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/main.cpp b/src/main.cpp
index 17adf2bc5..cc8bdacf0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -65,6 +65,18 @@ main(int argc, char* argv[])
 #ifdef Q_OS_LINUX
     setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
     setenv("QML_DISABLE_DISK_CACHE", "1", true);
+
+    /*
+     * Some GNU/Linux distros, like Zorin OS, set QT_STYLE_OVERRIDE
+     * to force a particular Qt style.  This has been fine with Qt5
+     * even when using our own Qt package which may not have that
+     * style available.  However, with Qt6, attempting to override
+     * to a nonexistent style seems to result in the main window
+     * simply not showing.  So here we unset this variable, also
+     * because we currently hard-code the Material style anyway.
+     * https://bugreports.qt.io/browse/QTBUG-99889
+     */
+    unsetenv("QT_STYLE_OVERRIDE");
 #ifdef __GLIBC__
     // Current glibc is causing some bugs with font loading
     // See https://bugreports.qt.io/browse/QTBUG-92969
-- 
GitLab