QCefView icon indicating copy to clipboard operation
QCefView copied to clipboard

[FEATURE] SetPreference 怎么设置网络代理?

Open LiYaLinIsLaoSix opened this issue 2 years ago • 2 comments

** Feature Description 【特性详细描述】** 在项目中我需要设置网页代理,但是没有看到示例和网上信息,只看到一些关于cef设置方法。

我在网上看到 CefRefPtr<CefDictionaryValue> dict = CefDictionaryValue::Create(); dict->SetString("mode", "fixed_servers"); dict->SetString("server", "192.168.1.100:8000");

CefRefPtr<CefValue> value = CefValue::Create(); value->SetDictionary(dict); context->SetPreference("proxy", value, error);

我需要怎么通过QCefView 里的方法设置网页代理?

LiYaLinIsLaoSix avatar Sep 27 '23 03:09 LiYaLinIsLaoSix

QCefConfig config;
config.addCommandLineSwitchWithValue("--proxy-server","http://127.0.0.1:1081");

StackExplode avatar Oct 24 '24 02:10 StackExplode

  QJsonObject proxy{
    { "mode", "fixed_servers" },        //
    { "server", "192.168.1.100:8000" }, //
  };
  QString error;
  qcefview->setPreference("proxy", QVariant(proxy), error);

需要在底层Browser已经创建完成之后

tishion avatar Oct 25 '24 04:10 tishion