summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer/qmlviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 75a8f1c..af543c9 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -39,6 +39,7 @@
#include <QAction>
#include <QFileDialog>
#include <QTimer>
+#include <QNetworkProxyFactory>
class PreviewDeviceSkin : public DeviceSkin
{
@@ -153,6 +154,8 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q
if (mb)
layout->addWidget(mb);
layout->addWidget(canvas);
+
+ setupProxy();
}
QMenuBar *QmlViewer::menuBar() const
@@ -677,6 +680,21 @@ void QmlViewer::setDeviceKeys(bool on)
devicemode = on;
}
+void QmlViewer::setupProxy()
+{
+ class SystemProxyFactory : public QNetworkProxyFactory
+ {
+ public:
+ virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
+ {
+ return QNetworkProxyFactory::systemProxyForQuery(query);
+ }
+ };
+
+ QNetworkAccessManager * nam = canvas->engine()->networkAccessManager();
+ nam->setProxyFactory(new SystemProxyFactory);
+}
+
void QmlViewer::setCacheEnabled(bool on)
{
QNetworkAccessManager * nam = canvas->engine()->networkAccessManager();