Skip to content

Commit fadca6c

Browse files
arthursdootavio
authored andcommitted
browser: Add proxy support using environment variables
Updated project to support proxy settings based on `https_proxy` and `http_proxy` environment variables. Modified `browser.pro` to include the QT `network` module and altered `main.cpp` to utilize `QNetworkProxyFactory`, enabling the application to automatically adhere to system proxy configurations. Signed-off-by: Arthur Oliveira <[email protected]>
1 parent b01fd79 commit fadca6c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

browser.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TEMPLATE = app
22

3-
QT += qml quick core gui webenginequick widgets
3+
QT += qml quick core gui webenginequick widgets network
44

55
CONFIG += c++11
66

main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <QtQml/QQmlApplicationEngine>
1313
#include <QtQml/QQmlContext>
1414
#include <QtGui/QGuiApplication>
15+
#include <QNetworkProxyFactory>
1516

1617
#include "inputeventhandler.hpp"
1718
#include "browser.hpp"
@@ -22,6 +23,8 @@ int main(int argc, char *argv[])
2223

2324
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
2425
qputenv("QML_XHR_ALLOW_FILE_READ", QByteArray("1"));
26+
27+
QNetworkProxyFactory::setUseSystemConfiguration(true);
2528

2629
QtWebEngineQuick::initialize();
2730

0 commit comments

Comments
 (0)