[PATCH] Ask Qt to use system proxies in Subsurface

Thiago Macieira thiago at macieira.org
Sat Jul 13 05:42:26 PDT 2013

This causes the Marble widget to use proxies automatically too.

On Mac, this gets the global proxy settings; on Windows, it gets the
IE settings; on Unix, it uses environment variables (set http_proxy
and all_proxy).

Signed-off-by: Thiago Macieira <thiago at macieira.org>
 qt-gui.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qt-gui.cpp b/qt-gui.cpp
index eab282d..f955809 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -35,6 +35,7 @@
 #include <QDebug>
 #include <QMap>
 #include <QMultiMap>
+#include <QNetworkProxy>
 const char *default_dive_computer_vendor;
 const char *default_dive_computer_product;
@@ -97,6 +98,10 @@ void init_ui(int *argcp, char ***argvp)
 	application = new QApplication(*argcp, *argvp);
+        // tell Qt to use system proxies
+        // note: on Linux, "system" == "environment variables"
+        QNetworkProxyFactory::setUseSystemConfiguration(true);
 	// the Gtk theme makes things unbearably ugly
 	// so switch to Oxygen in this case
 	if (application->style()->objectName() == "gtk+")

More information about the subsurface mailing list